diff --git a/app/src/main/java/eu/faircode/email/FragmentGmail.java b/app/src/main/java/eu/faircode/email/FragmentGmail.java index efbffe47f0..9fb7f25c9a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentGmail.java +++ b/app/src/main/java/eu/faircode/email/FragmentGmail.java @@ -149,14 +149,15 @@ public class FragmentGmail extends FragmentBase { @Override public void onClick(View v) { try { - etName.clearFocus(); - Helper.hideKeyboard(view); grpError.setVisibility(View.GONE); String name = etName.getText().toString().trim(); if (TextUtils.isEmpty(name)) throw new IllegalArgumentException(getString(R.string.title_no_name)); + etName.clearFocus(); + Helper.hideKeyboard(view); + Intent intent = newChooseAccountIntent( null, null, @@ -272,12 +273,12 @@ public class FragmentGmail extends FragmentBase { } private void onNoAccountSelected(int resultCode, Intent data) { - if (resultCode == RESULT_OK) { - AccountManager am = AccountManager.get(getContext()); - Account[] accounts = am.getAccountsByType(TYPE_GOOGLE); - if (accounts.length == 0) - Log.e("newChooseAccountIntent without result=" + resultCode + " data=" + data); + AccountManager am = AccountManager.get(getContext()); + Account[] accounts = am.getAccountsByType(TYPE_GOOGLE); + if (accounts.length == 0) + Log.e("newChooseAccountIntent without result=" + resultCode + " data=" + data); + if (resultCode == RESULT_OK) { tvError.setText(getString(R.string.title_no_account) + " (" + accounts.length + ")"); grpError.setVisibility(View.VISIBLE); } else diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 64b1f86409..cfd37447d7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -238,6 +238,10 @@ public class FragmentOAuth extends FragmentBase { throw new IllegalArgumentException(getString(R.string.title_email_invalid, email)); } + etName.clearFocus(); + etEmail.clearFocus(); + Helper.hideKeyboard(view); + etName.setEnabled(false); etEmail.setEnabled(false); cbUpdate.setEnabled(false); diff --git a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java index 53e79f685d..6fbd7351ea 100644 --- a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java @@ -19,6 +19,8 @@ package eu.faircode.email; Copyright 2018-2021 by Marcel Bokhorst (M66B) */ +import static eu.faircode.email.ServiceAuthenticator.AUTH_TYPE_PASSWORD; + import android.content.Context; import android.content.Intent; import android.graphics.Paint; @@ -53,8 +55,6 @@ import java.util.List; import javax.mail.AuthenticationFailedException; -import static eu.faircode.email.ServiceAuthenticator.AUTH_TYPE_PASSWORD; - public class FragmentQuickSetup extends FragmentBase { private ViewGroup view; private ScrollView scroll; @@ -470,6 +470,10 @@ public class FragmentQuickSetup extends FragmentBase { setManual(true); EmailProvider provider = args.getParcelable("provider"); + etName.clearFocus(); + etEmail.clearFocus(); + Helper.hideKeyboard(view); + if (ex instanceof AuthenticationFailedException) { String message = getString(R.string.title_setup_no_auth_hint); if (provider != null && provider.appPassword)