mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-04 15:52:34 -08:00
Update fingerprint state with checkbox
This commit is contained in:
1 parent
cafeabdbc3
commit
1ebe8dc022
8 files changed
+46
-35
No files matched your search
@@ -2,6 +2,7 @@ KeepassDX (2.5.0.0beta10)
|
||||
* Upgrade translations
|
||||
* Fix classic dark theme
|
||||
* Add Material Icon Pack to the Free version
|
||||
* Update fingerprint state with checkbox
|
||||
* Fix bugs
|
||||
|
||||
KeepassDX (2.5.0.0beta9)
|
||||
|
||||
@@ -336,7 +336,7 @@ public class FingerPrintHelper {
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
NOT_CONFIGURED_MODE, STORE_MODE, OPEN_MODE
|
||||
NOT_CONFIGURED_MODE, WAITING_PASSWORD_MODE, STORE_MODE, OPEN_MODE
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@@ -490,32 +491,18 @@ public class PasswordActivity extends StylishActivity
|
||||
|
||||
fingerPrintHelper = new FingerPrintHelper(this, this);
|
||||
|
||||
// when text entered we can enable the logon/purchase button and if required update encryption/decryption mode
|
||||
passwordView.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(
|
||||
final CharSequence s,
|
||||
final int start,
|
||||
final int count,
|
||||
final int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(
|
||||
final CharSequence s,
|
||||
final int start,
|
||||
final int before,
|
||||
final int count) {}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(final Editable s) {
|
||||
if ( !fingerprintMustBeConfigured ) {
|
||||
final boolean validInput = s.length() > 0;
|
||||
// encrypt or decrypt mode based on how much input or not
|
||||
setFingerPrintView(validInput ? R.string.store_with_fingerprint : R.string.scanning_fingerprint);
|
||||
if (validInput)
|
||||
toggleFingerprintMode(FingerPrintHelper.Mode.STORE_MODE);
|
||||
else
|
||||
checkboxPasswordView.setOnCheckedChangeListener((compoundButton, checked) -> {
|
||||
if ( !fingerprintMustBeConfigured ) {
|
||||
// encrypt or decrypt mode based on how much input or not
|
||||
if (checked) {
|
||||
toggleFingerprintMode(FingerPrintHelper.Mode.STORE_MODE);
|
||||
} else {
|
||||
if (!prefsNoBackup.contains(getPreferenceKeyValue())) {
|
||||
// This happens when no fingerprints are registered.
|
||||
toggleFingerprintMode(FingerPrintHelper.Mode.WAITING_PASSWORD_MODE);
|
||||
} else {
|
||||
toggleFingerprintMode(FingerPrintHelper.Mode.OPEN_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -600,8 +587,25 @@ public class PasswordActivity extends StylishActivity
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
private void initWaitData() {
|
||||
setFingerPrintView(R.string.no_password_stored, true);
|
||||
fingerPrintMode = FingerPrintHelper.Mode.WAITING_PASSWORD_MODE;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
private synchronized void toggleFingerprintMode(final FingerPrintHelper.Mode newMode) {
|
||||
switch (newMode) {
|
||||
case WAITING_PASSWORD_MODE:
|
||||
setFingerPrintView(R.string.no_password_stored, true);
|
||||
break;
|
||||
case STORE_MODE:
|
||||
setFingerPrintView(R.string.store_with_fingerprint);
|
||||
break;
|
||||
case OPEN_MODE:
|
||||
setFingerPrintView(R.string.scanning_fingerprint);
|
||||
break;
|
||||
}
|
||||
if( !newMode.equals(fingerPrintMode) ) {
|
||||
fingerPrintMode = newMode;
|
||||
reInitWithFingerprintMode();
|
||||
@@ -614,6 +618,9 @@ public class PasswordActivity extends StylishActivity
|
||||
case STORE_MODE:
|
||||
initEncryptData();
|
||||
break;
|
||||
case WAITING_PASSWORD_MODE:
|
||||
initWaitData();
|
||||
break;
|
||||
case OPEN_MODE:
|
||||
initDecryptData();
|
||||
break;
|
||||
@@ -645,10 +652,6 @@ public class PasswordActivity extends StylishActivity
|
||||
setFingerPrintView(textId, false);
|
||||
}
|
||||
|
||||
private void setFingerPrintView(final CharSequence text) {
|
||||
setFingerPrintView(text, false);
|
||||
}
|
||||
|
||||
private void setFingerPrintView(final int textId, boolean lock) {
|
||||
setFingerPrintView(getString(textId), lock);
|
||||
}
|
||||
@@ -690,9 +693,13 @@ public class PasswordActivity extends StylishActivity
|
||||
|
||||
// fingerprint available but no stored password found yet for this DB so show info don't listen
|
||||
if (!prefsNoBackup.contains(getPreferenceKeyValue())) {
|
||||
setFingerPrintView(R.string.no_password_stored);
|
||||
// listen for encryption
|
||||
initEncryptData();
|
||||
if (checkboxPasswordView.isChecked()) {
|
||||
// listen for encryption
|
||||
initEncryptData();
|
||||
} else {
|
||||
// wait for typing
|
||||
initWaitData();
|
||||
}
|
||||
}
|
||||
// all is set here so we can confirm to user and start listening for fingerprints
|
||||
else {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_toStartOf="@+id/fingerprint_image"
|
||||
style="@style/KeepassDXStyle.TextAppearance.DefaultTextOnPrimary"
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
<string name="fingerprint_setting_way_text">Paramètres -> Sécurité -> Empreinte digitale</string>
|
||||
<string name="fingerprint_type_password_text">Tapez votre mot de passe dans Keepass DX</string>
|
||||
<string name="fingerprint_scan_to_store">Scannez votre empreinte digitale pour stocker votre mot de passe maître en toute sécurité</string>
|
||||
<string name="fingerprint_scan_to_open">Il suffit de scanner votre empreinte digitale dans Keepass DX lorsque le champ mot de passe est vide pour ouvrir la base de données</string>
|
||||
<string name="fingerprint_scan_to_open">Scanner votre empreinte digitale lorsque la case à cocher du mot de passe n\'est pas cochée pour ouvrir la base de données</string>
|
||||
<string name="usage">Usage</string>
|
||||
<string name="fingerprint">Empreinte digitale</string>
|
||||
<string name="fingerprint_enable_title">Écoute d\'empreintes digitales</string>
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<string name="fingerprint_setting_way_text">Settings -> Security -> Fingerprint</string>
|
||||
<string name="fingerprint_type_password_text">Type your password in Keepass DX</string>
|
||||
<string name="fingerprint_scan_to_store">Scan your fingerprint to store your master password securely</string>
|
||||
<string name="fingerprint_scan_to_open">Just scan your fingerprint in Keepass DX when the password field is empty to open the database</string>
|
||||
<string name="fingerprint_scan_to_open">Scan your fingerprint when the password checkbox is unchecked to open the database</string>
|
||||
<string name="usage">Usage</string>
|
||||
<string name="fingerprint">Fingerprint</string>
|
||||
<string name="fingerprint_enable_title">Fingerprint listening</string>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
* Upgrade translations
|
||||
* Fix classic dark theme
|
||||
* Add Material Icon Pack to the Free version
|
||||
* Update fingerprint state with checkbox
|
||||
* Fix bugs
|
||||
@@ -1,4 +1,5 @@
|
||||
* Mise à jour des traductions
|
||||
* Correction du thème sombre classic
|
||||
* Ajout du Pack d'Icones Material à la version gratuite
|
||||
* Mise à jour de l'état de l'empreinte digitale avec la boite à cocher
|
||||
* Corrections de bugs
|
||||
Reference in new issue
Block a user