mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Add setting to disable the open button #126
This commit is contained in:
1 parent
acba7fc5de
commit
c3ac550c93
12 files changed
+81
-2
No files matched your search
@@ -121,6 +121,7 @@ public class PasswordActivity extends StylishActivity
|
||||
private CompoundButton checkboxPasswordView;
|
||||
private CompoundButton checkboxKeyfileView;
|
||||
private CompoundButton checkboxDefaultDatabaseView;
|
||||
private CompoundButton.OnCheckedChangeListener enableButtonOncheckedChangeListener;
|
||||
|
||||
private DefaultCheckChange defaultCheckChange;
|
||||
private ValidateButtonViewClickListener validateButtonViewClickListener;
|
||||
@@ -322,6 +323,18 @@ public class PasswordActivity extends StylishActivity
|
||||
// For check shutdown
|
||||
super.onResume();
|
||||
|
||||
// Enable or not the open button
|
||||
if (!PreferencesUtil.emptyPasswordAllowed(PasswordActivity.this)) {
|
||||
confirmButtonView.setEnabled(checkboxPasswordView.isChecked());
|
||||
} else {
|
||||
confirmButtonView.setEnabled(true);
|
||||
}
|
||||
enableButtonOncheckedChangeListener = (buttonView, isChecked) -> {
|
||||
if (!PreferencesUtil.emptyPasswordAllowed(PasswordActivity.this)) {
|
||||
confirmButtonView.setEnabled(isChecked);
|
||||
}
|
||||
};
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// Check if fingerprint well init (be called the first time the fingerprint is configured
|
||||
// and the activity still active)
|
||||
@@ -511,6 +524,9 @@ public class PasswordActivity extends StylishActivity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add old listener to enable the button, only be call here because of onCheckedChange bug
|
||||
enableButtonOncheckedChangeListener.onCheckedChanged(compoundButton, checked);
|
||||
});
|
||||
|
||||
// callback for fingerprint findings
|
||||
|
||||
@@ -152,6 +152,12 @@ public class PreferencesUtil {
|
||||
context.getString(R.string.setting_icon_pack_choose_default));
|
||||
}
|
||||
|
||||
public static boolean emptyPasswordAllowed(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.allow_no_password_key),
|
||||
context.getResources().getBoolean(R.bool.allow_no_password_default));
|
||||
}
|
||||
|
||||
/**
|
||||
* All preference keys associated with education
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user