Search in sources :

Example 1 with FingerprintUiHelper

use of com.github.omadahealth.lollipin.lib.managers.FingerprintUiHelper in project LolliPin by OrangeGangsters.

the class PinLockTest method testPinEnablingChecking.

public void testPinEnablingChecking() throws SecurityException {
    enablePin();
    // Go to unlock
    clickOnView(R.id.button_unlock_pin);
    solo.waitForActivity(CustomPinActivity.class);
    solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
    // Test fingerprint if available
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        ImageView fingerprintImageView = (ImageView) solo.getView(com.github.omadahealth.lollipin.lib.R.id.pin_code_fingerprint_imageview);
        TextView fingerprintTextView = (TextView) solo.getView(com.github.omadahealth.lollipin.lib.R.id.pin_code_fingerprint_textview);
        FingerprintManager fingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
        FingerprintUiHelper fingerprintUiHelper = new FingerprintUiHelper.FingerprintUiHelperBuilder(fingerprintManager).build(fingerprintImageView, fingerprintTextView, (CustomPinActivity) solo.getCurrentActivity());
        if (fingerprintManager.isHardwareDetected() && fingerprintUiHelper.isFingerprintAuthAvailable()) {
            assertEquals(View.VISIBLE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
            assertEquals(View.VISIBLE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
        } else {
            assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
            assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
        }
    } else {
        assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
        assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
    }
    // Enter the code
    clickOnView(R.id.pin_code_button_1);
    clickOnView(R.id.pin_code_button_2);
    clickOnView(R.id.pin_code_button_3);
    clickOnView(R.id.pin_code_button_4);
    // Check view
    solo.waitForActivity(MainActivity.class);
    solo.assertCurrentActivity("MainActivity", MainActivity.class);
}
Also used : FingerprintManager(android.hardware.fingerprint.FingerprintManager) TextView(android.widget.TextView) FingerprintUiHelper(com.github.omadahealth.lollipin.lib.managers.FingerprintUiHelper) ImageView(android.widget.ImageView)

Aggregations

FingerprintManager (android.hardware.fingerprint.FingerprintManager)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 FingerprintUiHelper (com.github.omadahealth.lollipin.lib.managers.FingerprintUiHelper)1