Search in sources :

Example 6 with CancellationSignal

use of android.support.v4.os.CancellationSignal in project Signal-Android by signalapp.

the class PassphrasePromptActivity method initializeResources.

private void initializeResources() {
    ImageButton okButton = findViewById(R.id.ok_button);
    Toolbar toolbar = findViewById(R.id.toolbar);
    showButton = findViewById(R.id.passphrase_visibility);
    hideButton = findViewById(R.id.passphrase_visibility_off);
    visibilityToggle = findViewById(R.id.button_toggle);
    passphraseText = findViewById(R.id.passphrase_edit);
    passphraseAuthContainer = findViewById(R.id.password_auth_container);
    fingerprintPrompt = findViewById(R.id.fingerprint_auth_container);
    lockScreenButton = findViewById(R.id.lock_screen_auth_container);
    fingerprintManager = FingerprintManagerCompat.from(this);
    fingerprintCancellationSignal = new CancellationSignal();
    fingerprintListener = new FingerprintListener();
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle("");
    SpannableString hint = new SpannableString("  " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
    hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
    hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
    passphraseText.setHint(hint);
    okButton.setOnClickListener(new OkButtonClickListener());
    showButton.setOnClickListener(new ShowButtonOnClickListener());
    hideButton.setOnClickListener(new HideButtonOnClickListener());
    passphraseText.setOnEditorActionListener(new PassphraseActionListener());
    passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock), EditorInfo.IME_ACTION_DONE);
    fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
    fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN);
    lockScreenButton.setOnClickListener(v -> resumeScreenLock());
}
Also used : SpannableString(android.text.SpannableString) ImageButton(android.widget.ImageButton) RelativeSizeSpan(android.text.style.RelativeSizeSpan) CancellationSignal(android.support.v4.os.CancellationSignal) Toolbar(android.support.v7.widget.Toolbar) TypefaceSpan(android.text.style.TypefaceSpan)

Example 7 with CancellationSignal

use of android.support.v4.os.CancellationSignal in project KeePassDX by Kunzisoft.

the class FingerPrintHelper method startListening.

public synchronized void startListening() {
    // starts listening for fingerprints with the initialised crypto object
    cancellationSignal = new CancellationSignal();
    fingerprintManager.authenticate(cryptoObject, 0, /* flags */
    cancellationSignal, authenticationCallback, null);
}
Also used : CancellationSignal(android.support.v4.os.CancellationSignal)

Aggregations

CancellationSignal (android.support.v4.os.CancellationSignal)6 Manifest (android.Manifest)1 SuppressLint (android.annotation.SuppressLint)1 KeyguardManager (android.app.KeyguardManager)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 Cursor (android.database.Cursor)1 PorterDuff (android.graphics.PorterDuff)1 FingerprintManager (android.hardware.fingerprint.FingerprintManager)1 Build (android.os.Build)1 CancellationSignal (android.os.CancellationSignal)1 Handler (android.os.Handler)1 Looper (android.os.Looper)1 Vibrator (android.os.Vibrator)1 RequiresApi (android.support.annotation.RequiresApi)1 ContextCompat (android.support.v4.content.ContextCompat)1 FingerprintManagerCompat (android.support.v4.hardware.fingerprint.FingerprintManagerCompat)1 OperationCanceledException (android.support.v4.os.OperationCanceledException)1