com.github.ajalt.reprint.core.Reprint Java Examples
The following examples show how to use
com.github.ajalt.reprint.core.Reprint.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntroSeedFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Confirm button listener * * @param view View */ public void onClickConfirm(View view) { createAndStoreCredentials(binding.introSeedSeed.getText().toString()); accountService.open(); sharedPreferencesUtil.setConfirmedSeedBackedUp(true); if (!Reprint.isHardwarePresent() || !Reprint.hasFingerprintRegistered()) { // if no fingerprint software is present or user has not registered // a fingerprint show pin screen showCreatePinScreen(); } else { // otherwise, go on in goToHomeScreen(); } }
Example #2
Source File: KaliumApplication.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 6 votes |
public void onCreate() { super.onCreate(); // initialize Realm database Realm.init(this); if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); } // create new instance of the application component (DI) mApplicationComponent = DaggerApplicationComponent .builder() .applicationModule(new ApplicationModule(this)) .build(); // initialize vault Vault.initializeVault(this); generateEncryptionKey(); // initialize fingerprint Reprint.initialize(this); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); }
Example #3
Source File: NanoApplication.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 6 votes |
public void onCreate() { super.onCreate(); // initialize Realm database Realm.init(this); if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); } // create new instance of the application component (DI) mApplicationComponent = DaggerApplicationComponent .builder() .applicationModule(new ApplicationModule(this)) .build(); // initialize vault Vault.initializeVault(this); generateEncryptionKey(); // initialize fingerprint Reprint.initialize(this); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); }
Example #4
Source File: SettingsDialogFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
private void showFingerprintDialog(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(getString(R.string.settings_fingerprint_title)); builder.setMessage(getString(R.string.settings_fingerprint_description)); builder.setView(view); String negativeText = getString(android.R.string.cancel); builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication()); fingerprintDialog = builder.create(); fingerprintDialog.setCanceledOnTouchOutside(false); // display dialog fingerprintDialog.show(); }
Example #5
Source File: MarshmallowReprintModule.java From reprint with Apache License 2.0 | 5 votes |
private AuthCallback(int restartCount, Reprint.RestartPredicate restartPredicate, CancellationSignal cancellationSignal, AuthenticationListener listener) { this.restartCount = restartCount; this.restartPredicate = restartPredicate; this.cancellationSignal = cancellationSignal; this.listener = listener; }
Example #6
Source File: MarshmallowReprintModule.java From reprint with Apache License 2.0 | 5 votes |
void authenticate(final CancellationSignal cancellationSignal, final AuthenticationListener listener, final Reprint.RestartPredicate restartPredicate, final int restartCount) throws SecurityException { final FingerprintManager fingerprintManager = fingerprintManager(); if (fingerprintManager == null) { listener.onFailure(AuthenticationFailureReason.UNKNOWN, true, context.getString(R.string.fingerprint_error_hw_not_available), TAG, FINGERPRINT_ERROR_CANCELED); return; } final FingerprintManager.AuthenticationCallback callback = new AuthCallback(restartCount, restartPredicate, cancellationSignal, listener); // Why getCancellationSignalObject returns an Object is unexplained final android.os.CancellationSignal signalObject = cancellationSignal == null ? null : (android.os.CancellationSignal) cancellationSignal.getCancellationSignalObject(); // Occasionally, an NPE will bubble up out of FingerprintManager.authenticate try { fingerprintManager.authenticate(null, signalObject, 0, callback, null); } catch (NullPointerException e) { logger.logException(e, "MarshmallowReprintModule: authenticate failed unexpectedly"); listener.onFailure(AuthenticationFailureReason.UNKNOWN, true, context.getString(R.string.fingerprint_error_unable_to_process), TAG, FINGERPRINT_ERROR_CANCELED); } }
Example #7
Source File: MainActivity.java From reprint with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); setSupportActionBar(toolbar); hardwarePresent.setText(String.valueOf(Reprint.isHardwarePresent())); fingerprintsRegistered.setText(String.valueOf(Reprint.hasFingerprintRegistered())); running = false; }
Example #8
Source File: IntroNewWalletFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Confirm button listener * * @param view View */ public void onClickConfirm(View view) { analyticsService.track(AnalyticsEvents.SEED_CONFIRMATON_CONTINUE_BUTTON_PRESSED); // show the copy seed dialog AlertDialog.Builder builder; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder = new AlertDialog.Builder(getContext(), android.R.style.Theme_Material_Light_Dialog_Alert); } else { builder = new AlertDialog.Builder(getContext()); } builder.setTitle(R.string.intro_new_wallet_continue_title) .setMessage(R.string.intro_new_wallet_continue_message) .setPositiveButton(R.string.intro_new_wallet_continue_positive, (dialog, which) -> { if (!Reprint.isHardwarePresent() || !Reprint.hasFingerprintRegistered()) { // if no fingerprint software is present or user has not registered // a fingerprint show pin screen showCreatePinScreen(); } else { // otherwise, go on in goToHomeScreen(); } }) .setNegativeButton(R.string.intro_new_wallet_continue_negative, (dialog, which) -> { }) .show(); }
Example #9
Source File: SendConfirmDialogFragment.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
private void showFingerprintDialog(View view) { int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog; AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style); builder.setMessage(getString(R.string.send_fingerprint_description, !wallet.getSendNanoAmountFormatted().isEmpty() ? wallet.getSendNanoAmountFormatted() : "0")); builder.setView(view); SpannableString negativeText = new SpannableString(getString(android.R.string.cancel)); negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.ltblue)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication()); fingerprintDialog = builder.create(); fingerprintDialog.setCanceledOnTouchOutside(true); // display dialog fingerprintDialog.show(); }
Example #10
Source File: SettingsDialogFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
private void showSeed() { Credentials credentials = realm.where(Credentials.class).findFirst(); if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered()) { // show fingerprint dialog LayoutInflater factory = LayoutInflater.from(getContext()); @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null); showFingerprintDialog(viewFingerprint); com.github.ajalt.reprint.rxjava2.RxReprint.authenticate() .subscribe(result -> { switch (result.status) { case SUCCESS: showFingerprintSuccess(viewFingerprint); break; case NONFATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; case FATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; } }); } else if (credentials != null && credentials.getPin() != null) { showPinScreen(getString(R.string.settings_fingerprint_description)); } else if (credentials != null && credentials.getPin() == null) { showCreatePinScreen(); } }
Example #11
Source File: SendFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
private void showFingerprintDialog(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(getString(R.string.send_fingerprint_title)); builder.setMessage(getString(R.string.send_fingerprint_description, !wallet.getSendNanoAmountFormatted().isEmpty() ? wallet.getSendNanoAmountFormatted() : "0")); builder.setView(view); String negativeText = getString(android.R.string.cancel); builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication()); fingerprintDialog = builder.create(); fingerprintDialog.setCanceledOnTouchOutside(false); // display dialog fingerprintDialog.show(); }
Example #12
Source File: SendFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
public void onClickSend(View view) { if (!validateRequest()) { return; } Credentials credentials = realm.where(Credentials.class).findFirst(); if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered()) { // show fingerprint dialog LayoutInflater factory = LayoutInflater.from(getContext()); @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null); showFingerprintDialog(viewFingerprint); com.github.ajalt.reprint.rxjava2.RxReprint.authenticate() .subscribe(result -> { switch (result.status) { case SUCCESS: showFingerprintSuccess(viewFingerprint); break; case NONFATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; case FATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; } }); } else if (credentials != null && credentials.getPin() != null) { showPinScreen(getString(R.string.send_pin_description, wallet.getSendNanoAmount())); } else if (credentials != null && credentials.getPin() == null) { showCreatePinScreen(); } }
Example #13
Source File: SharedPreferencesUtil.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
public AuthMethod getAuthMethod() { if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered()) { return AuthMethod.valueOf(get(AUTH_METHOD, AuthMethod.FINGERPRINT.toString())); } else { return AuthMethod.PIN; } }
Example #14
Source File: ChangeRepDialogFragment.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
public void onClickChange(View view) { Address repAddress = new Address(binding.newRep.getText().toString()); if (!repAddress.isValidAddress()) { showAddressError(); return; } Credentials credentials = realm.where(Credentials.class).findFirst(); if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered() && sharedPreferencesUtil.getAuthMethod() == AuthMethod.FINGERPRINT) { // show fingerprint dialog LayoutInflater factory = LayoutInflater.from(getContext()); @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null); showFingerprintDialog(viewFingerprint); com.github.ajalt.reprint.rxjava2.RxReprint.authenticate() .subscribe(result -> { switch (result.status) { case SUCCESS: fingerprintDialog.dismiss(); executeChange(binding.newRep.getText().toString()); break; case NONFATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; case FATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; } }); } else if (credentials != null && credentials.getPin() != null) { showPinScreen(getString(R.string.change_representative_pin)); } else if (credentials != null && credentials.getPin() == null) { showCreatePinScreen(); } }
Example #15
Source File: ChangeRepDialogFragment.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
private void showFingerprintDialog(View view) { int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog; AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style); builder.setMessage(getString(R.string.change_representative_fingerprint)); builder.setView(view); SpannableString negativeText = new SpannableString(getString(android.R.string.cancel)); negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.ltblue)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication()); fingerprintDialog = builder.create(); fingerprintDialog.setCanceledOnTouchOutside(false); // display dialog fingerprintDialog.show(); }
Example #16
Source File: SettingsFragment.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
public void onClickBackupSeed(View view) { Credentials credentials = realm.where(Credentials.class).findFirst(); if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered() && sharedPreferencesUtil.getAuthMethod() == AuthMethod.FINGERPRINT) { // show fingerprint dialog LayoutInflater factory = LayoutInflater.from(getContext()); @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null); showFingerprintDialog(viewFingerprint); com.github.ajalt.reprint.rxjava2.RxReprint.authenticate() .subscribe(result -> { switch (result.status) { case SUCCESS: fingerprintDialog.dismiss(); showBackupSeedDialog(); break; case NONFATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; case FATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; } }); } else if (credentials != null && credentials.getPin() != null) { backupSeedPinEntered = true; showPinScreen(getString(R.string.settings_pin_title)); } else if (credentials != null && credentials.getPin() == null) { backupSeedPinEntered = true; showCreatePinScreen(); } }
Example #17
Source File: SettingsFragment.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
private void showFingerprintDialog(View view) { int style = android.os.Build.VERSION.SDK_INT >= 21 ? R.style.AlertDialogCustom : android.R.style.Theme_Holo_Dialog; AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), style); builder.setMessage(getString(R.string.settings_fingerprint_title)); builder.setView(view); SpannableString negativeText = new SpannableString(getString(android.R.string.cancel)); negativeText.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.ltblue)), 0, negativeText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setNegativeButton(negativeText, (dialog, which) -> Reprint.cancelAuthentication()); fingerprintDialog = builder.create(); fingerprintDialog.setCanceledOnTouchOutside(true); // display dialog fingerprintDialog.show(); }
Example #18
Source File: SendConfirmDialogFragment.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
public void onClickConfirm(View view) { Credentials credentials = realm.where(Credentials.class).findFirst(); if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered() && sharedPreferencesUtil.getAuthMethod() == AuthMethod.FINGERPRINT) { // show fingerprint dialog LayoutInflater factory = LayoutInflater.from(getContext()); @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null); showFingerprintDialog(viewFingerprint); com.github.ajalt.reprint.rxjava2.RxReprint.authenticate() .subscribe(result -> { switch (result.status) { case SUCCESS: fingerprintDialog.dismiss(); executeSend(); break; case NONFATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; case FATAL_FAILURE: showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint); break; } }); } else if (credentials != null && credentials.getPin() != null) { showPinScreen(getString(R.string.send_pin_description, wallet.getSendNanoAmount())); } else if (credentials != null && credentials.getPin() == null) { showCreatePinScreen(); } }
Example #19
Source File: MainActivity.java From reprint with Apache License 2.0 | 4 votes |
private void cancel() { result.setText("Cancelled"); running = false; fab.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_fingerprint_white_24dp)); Reprint.cancelAuthentication(); }
Example #20
Source File: SpassReprintModule.java From reprint with Apache License 2.0 | 4 votes |
@Override public void authenticate(final CancellationSignal cancellationSignal, final AuthenticationListener listener, final Reprint.RestartPredicate restartPredicate) { authenticate(cancellationSignal, listener, restartPredicate, 0); }
Example #21
Source File: TestApp.java From reprint with Apache License 2.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); Reprint.initialize(this); }
Example #22
Source File: TestReprintModule.java From reprint with Apache License 2.0 | 4 votes |
@Override public void authenticate(CancellationSignal cancellationSignal, AuthenticationListener listener, Reprint.RestartPredicate restartPredicate) { this.cancellationSignal = cancellationSignal; this.listener = listener; this.restartPredicate = restartPredicate; }
Example #23
Source File: MarshmallowReprintModule.java From reprint with Apache License 2.0 | 4 votes |
public MarshmallowReprintModule(Context context, Reprint.Logger logger) { this.context = context.getApplicationContext(); this.logger = logger; }
Example #24
Source File: MarshmallowReprintModule.java From reprint with Apache License 2.0 | 4 votes |
@Override public void authenticate(final CancellationSignal cancellationSignal, final AuthenticationListener listener, final Reprint.RestartPredicate restartPredicate) { authenticate(cancellationSignal, listener, restartPredicate, 0); }