Loading app/ui/base/src/main/java/com/fsck/k9/ui/base/extensions/TextInputLayoutExtensions.kt +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ import com.google.android.material.textfield.TextInputLayout /** * Configures a [TextInputLayout] so the password can only be revealed after authentication. * * **IMPORTANT**: Only call this after the instance state has been restored! Otherwise, restoring the previous state * after the initial state has been set will be detected as replacing the whole text. In that case showing the password * will be allowed without authentication. */ fun TextInputLayout.configureAuthenticatedPasswordToggle( activity: FragmentActivity, Loading app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java +13 −10 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener private CheckBox mSubscribedFoldersOnly; private AuthTypeAdapter mAuthTypeAdapter; private ConnectionSecurity[] mConnectionSecurityChoices = ConnectionSecurity.values(); private boolean editSettings; public static void actionIncomingSettings(Activity context, Account account, boolean makeDefault) { Intent i = new Intent(context, AccountSetupIncoming.class); Loading Loading @@ -174,16 +175,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener mAuthTypeAdapter = AuthTypeAdapter.get(this, oAuthSupported); mAuthTypeView.setAdapter(mAuthTypeAdapter); boolean editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Loading Loading @@ -386,6 +379,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener mPasswordView.addTextChangedListener(validationTextWatcher); mServerView.addTextChangedListener(validationTextWatcher); mPortView.addTextChangedListener(validationTextWatcher); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); } } @Override Loading Loading @@ -538,7 +541,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener } if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { if (editSettings) { Preferences.getPreferences().saveAccount(mAccount); finish(); } else { Loading app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOutgoing.java +13 −10 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, private AuthTypeAdapter mAuthTypeAdapter; private Button mNextButton; private Account mAccount; private boolean editSettings; public static void actionOutgoingSettings(Context context, Account account) { Intent i = new Intent(context, AccountSetupOutgoing.class); Loading Loading @@ -149,16 +150,8 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, mAccount = Preferences.getPreferences().getAccount(accountUuid); } boolean editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Loading Loading @@ -321,6 +314,16 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, mPasswordView.addTextChangedListener(validationTextWatcher); mServerView.addTextChangedListener(validationTextWatcher); mPortView.addTextChangedListener(validationTextWatcher); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); } } @Override Loading Loading @@ -494,7 +497,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, } if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { if (editSettings) { Preferences.getPreferences().saveAccount(mAccount); finish(); } else { Loading Loading
app/ui/base/src/main/java/com/fsck/k9/ui/base/extensions/TextInputLayoutExtensions.kt +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ import com.google.android.material.textfield.TextInputLayout /** * Configures a [TextInputLayout] so the password can only be revealed after authentication. * * **IMPORTANT**: Only call this after the instance state has been restored! Otherwise, restoring the previous state * after the initial state has been set will be detected as replacing the whole text. In that case showing the password * will be allowed without authentication. */ fun TextInputLayout.configureAuthenticatedPasswordToggle( activity: FragmentActivity, Loading
app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java +13 −10 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener private CheckBox mSubscribedFoldersOnly; private AuthTypeAdapter mAuthTypeAdapter; private ConnectionSecurity[] mConnectionSecurityChoices = ConnectionSecurity.values(); private boolean editSettings; public static void actionIncomingSettings(Activity context, Account account, boolean makeDefault) { Intent i = new Intent(context, AccountSetupIncoming.class); Loading Loading @@ -174,16 +175,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener mAuthTypeAdapter = AuthTypeAdapter.get(this, oAuthSupported); mAuthTypeView.setAdapter(mAuthTypeAdapter); boolean editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Loading Loading @@ -386,6 +379,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener mPasswordView.addTextChangedListener(validationTextWatcher); mServerView.addTextChangedListener(validationTextWatcher); mPortView.addTextChangedListener(validationTextWatcher); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); } } @Override Loading Loading @@ -538,7 +541,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener } if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { if (editSettings) { Preferences.getPreferences().saveAccount(mAccount); finish(); } else { Loading
app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOutgoing.java +13 −10 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, private AuthTypeAdapter mAuthTypeAdapter; private Button mNextButton; private Account mAccount; private boolean editSettings; public static void actionOutgoingSettings(Context context, Account account) { Intent i = new Intent(context, AccountSetupOutgoing.class); Loading Loading @@ -149,16 +150,8 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, mAccount = Preferences.getPreferences().getAccount(accountUuid); } boolean editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction()); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Loading Loading @@ -321,6 +314,16 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, mPasswordView.addTextChangedListener(validationTextWatcher); mServerView.addTextChangedListener(validationTextWatcher); mPortView.addTextChangedListener(validationTextWatcher); if (editSettings) { TextInputLayoutHelper.configureAuthenticatedPasswordToggle( mPasswordLayoutView, this, getString(R.string.account_setup_basics_show_password_biometrics_title), getString(R.string.account_setup_basics_show_password_biometrics_subtitle), getString(R.string.account_setup_basics_show_password_need_lock) ); } } @Override Loading Loading @@ -494,7 +497,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, } if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { if (editSettings) { Preferences.getPreferences().saveAccount(mAccount); finish(); } else { Loading