Search in sources :

Example 1 with FingerprintHandler

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);
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Button(android.widget.Button) AppCompatButton(android.support.v7.widget.AppCompatButton) FingerprintManager(android.hardware.fingerprint.FingerprintManager) FingerprintHandler(com.amaze.filemanager.utils.FingerprintHandler) View(android.view.View) TextView(android.widget.TextView) RequiresApi(android.support.annotation.RequiresApi)

Aggregations

FingerprintManager (android.hardware.fingerprint.FingerprintManager)1 RequiresApi (android.support.annotation.RequiresApi)1 AppCompatButton (android.support.v7.widget.AppCompatButton)1 View (android.view.View)1 Button (android.widget.Button)1 TextView (android.widget.TextView)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 FingerprintHandler (com.amaze.filemanager.utils.FingerprintHandler)1