use of com.amaze.filemanager.utils.FingerprintHandler in project AmazeFileManager by TeamAmaze.
the class GeneralDialogCreation method showDecryptFingerprintDialog.
@RequiresApi(api = M)
public static void showDecryptFingerprintDialog(final Context c, MainActivity main, final Intent intent, AppTheme appTheme, final EncryptDecryptUtils.DecryptButtonCallbackInterface decryptButtonCallbackInterface) throws GeneralSecurityException, IOException {
int accentColor = main.getColorPreference().getColor(ColorUsage.ACCENT);
MaterialDialog.Builder builder = new MaterialDialog.Builder(c);
builder.title(c.getString(R.string.crypt_decrypt));
View rootView = View.inflate(c, R.layout.dialog_decrypt_fingerprint_authentication, null);
Button cancelButton = (Button) rootView.findViewById(R.id.button_decrypt_fingerprint_cancel);
cancelButton.setTextColor(accentColor);
builder.customView(rootView, true);
builder.canceledOnTouchOutside(false);
builder.theme(appTheme.getMaterialDialogTheme());
final MaterialDialog dialog = builder.show();
cancelButton.setOnClickListener(v -> dialog.cancel());
FingerprintManager manager = (FingerprintManager) c.getSystemService(Context.FINGERPRINT_SERVICE);
FingerprintManager.CryptoObject object = new FingerprintManager.CryptoObject(CryptUtil.initCipher(c));
FingerprintHandler handler = new FingerprintHandler(c, intent, dialog, decryptButtonCallbackInterface);
handler.authenticate(manager, object);
}
Aggregations