Search in sources :

Example 1 with ChooseLockPasswordFragment

use of com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment in project android_packages_apps_Settings by LineageOS.

the class ChooseLockPasswordTest method setActivityAndGetIconDrawable.

private ShadowDrawable setActivityAndGetIconDrawable(boolean addFingerprintExtra) {
    ChooseLockPassword passwordActivity = Robolectric.buildActivity(ChooseLockPassword.class, new IntentBuilder(application).setUserId(UserHandle.myUserId()).setForFingerprint(addFingerprintExtra).build()).setup().get();
    ChooseLockPasswordFragment fragment = (ChooseLockPasswordFragment) passwordActivity.getFragmentManager().findFragmentById(R.id.main_content);
    return Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) ChooseLockPasswordFragment(com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)

Example 2 with ChooseLockPasswordFragment

use of com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment in project android_packages_apps_Settings by SudaMod.

the class ChooseLockPasswordTest method setActivityAndGetIconDrawable.

private ShadowDrawable setActivityAndGetIconDrawable(boolean addFingerprintExtra) {
    ChooseLockPassword passwordActivity = Robolectric.buildActivity(ChooseLockPassword.class, new IntentBuilder(application).setUserId(UserHandle.myUserId()).setForFingerprint(addFingerprintExtra).build()).setup().get();
    ChooseLockPasswordFragment fragment = (ChooseLockPasswordFragment) passwordActivity.getFragmentManager().findFragmentById(R.id.main_content);
    return Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) ChooseLockPasswordFragment(com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)

Example 3 with ChooseLockPasswordFragment

use of com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment in project android_packages_apps_Settings by DirtyUnicorns.

the class ChooseLockPasswordTest method setActivityAndGetIconDrawable.

private ShadowDrawable setActivityAndGetIconDrawable(boolean addFingerprintExtra) {
    ChooseLockPassword passwordActivity = Robolectric.buildActivity(ChooseLockPassword.class, new IntentBuilder(application).setUserId(UserHandle.myUserId()).setForFingerprint(addFingerprintExtra).build()).setup().get();
    ChooseLockPasswordFragment fragment = (ChooseLockPasswordFragment) passwordActivity.getFragmentManager().findFragmentById(R.id.main_content);
    return Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) ChooseLockPasswordFragment(com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)

Example 4 with ChooseLockPasswordFragment

use of com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment in project platform_packages_apps_Settings by BlissRoms.

the class ChooseLockPasswordTest method setActivityAndGetIconDrawable.

private ShadowDrawable setActivityAndGetIconDrawable(boolean addFingerprintExtra) {
    ChooseLockPassword passwordActivity = Robolectric.buildActivity(ChooseLockPassword.class, new IntentBuilder(application).setUserId(UserHandle.myUserId()).setForFingerprint(addFingerprintExtra).build()).setup().get();
    ChooseLockPasswordFragment fragment = (ChooseLockPasswordFragment) passwordActivity.getFragmentManager().findFragmentById(R.id.main_content);
    return Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) ChooseLockPasswordFragment(com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)

Example 5 with ChooseLockPasswordFragment

use of com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockPasswordTest method assertPasswordValidationResult.

private void assertPasswordValidationResult(@PasswordComplexity int minComplexity, int passwordType, String userEnteredPassword, String... expectedValidationResult) {
    Intent intent = new Intent();
    intent.putExtra(CONFIRM_CREDENTIALS, false);
    intent.putExtra(PASSWORD_TYPE_KEY, passwordType);
    intent.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, minComplexity);
    ChooseLockPassword activity = buildChooseLockPasswordActivity(intent);
    ChooseLockPasswordFragment fragment = getChooseLockPasswordFragment(activity);
    byte[] userEnteredPasswordBytes = userEnteredPassword != null ? userEnteredPassword.getBytes() : null;
    int validateResult = fragment.validatePassword(userEnteredPasswordBytes);
    String[] messages = fragment.convertErrorCodeToMessages(validateResult);
    assertThat(messages).asList().containsExactly((Object[]) expectedValidationResult);
}
Also used : Intent(android.content.Intent) ChooseLockPasswordFragment(com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)

Aggregations

ChooseLockPasswordFragment (com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)8 IntentBuilder (com.android.settings.password.ChooseLockPassword.IntentBuilder)7 Intent (android.content.Intent)1