use of com.keepassdroid.fingerprint.FingerPrintDialog in project KeePassDX by Kunzisoft.
the class PasswordActivity method checkFingerprintAvailability.
@RequiresApi(api = Build.VERSION_CODES.M)
private synchronized void checkFingerprintAvailability() {
// or manually disable
if (!PreferencesUtil.isFingerprintEnable(getApplicationContext()) || !FingerPrintHelper.isFingerprintSupported(FingerprintManagerCompat.from(this))) {
setFingerPrintVisibility(View.GONE);
} else // fingerprint is available but not configured show icon but in disabled state with some information
{
// show explanations
fingerprintContainerView.setOnClickListener(view -> {
FingerPrintDialog fingerPrintDialog = new FingerPrintDialog();
fingerPrintDialog.show(getSupportFragmentManager(), "fingerprintDialog");
});
setFingerPrintVisibility(View.VISIBLE);
if (!fingerPrintHelper.hasEnrolledFingerprints()) {
// This happens when no fingerprints are registered. Listening won't start
setFingerPrintView(R.string.configure_fingerprint, true);
} else // finally fingerprint available and configured so we can use it
{
fingerprintMustBeConfigured = false;
// 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();
} else // all is set here so we can confirm to user and start listening for fingerprints
{
// listen for decryption
initDecryptData();
}
}
}
// Show fingerprint key deletion
invalidateOptionsMenu();
}
Aggregations