Added mandatory scrolling for FaceIntroduction
Test: Verified in SUW/Settings user must scroll through contents in order to go to the next screen. Bug: 141380294 Change-Id: I483ab6ae6a282c81ba2f2c4d1d9d1f21c6cb9453
This commit is contained in:
committed by
Joshua Mccloskey
parent
99f04da5dc
commit
af1e831ab7
@@ -33,6 +33,7 @@ import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
import com.google.android.setupcompat.template.FooterButton;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.android.setupdesign.span.LinkSpan;
|
||||
import com.google.android.setupdesign.template.RequireScrollMixin;
|
||||
|
||||
public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
|
||||
@@ -67,14 +68,25 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
);
|
||||
}
|
||||
|
||||
mFooterBarMixin.setPrimaryButton(
|
||||
new FooterButton.Builder(this)
|
||||
FooterButton.Builder nextButtonBuilder = new FooterButton.Builder(this)
|
||||
.setText(R.string.security_settings_face_enroll_introduction_agree)
|
||||
.setListener(this::onNextButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
.build()
|
||||
);
|
||||
.setTheme(R.style.SudGlifButton_Primary);
|
||||
if (maxFacesEnrolled()) {
|
||||
nextButtonBuilder.setListener(this::onNextButtonClick);
|
||||
mFooterBarMixin.setPrimaryButton(nextButtonBuilder.build());
|
||||
} else {
|
||||
final FooterButton agreeButton = nextButtonBuilder.build();
|
||||
mFooterBarMixin.setPrimaryButton(agreeButton);
|
||||
final RequireScrollMixin requireScrollMixin = getLayout().getMixin(
|
||||
RequireScrollMixin.class);
|
||||
requireScrollMixin.requireScrollWithButton(this, agreeButton,
|
||||
R.string.sud_more_button_label,
|
||||
button -> {
|
||||
onNextButtonClick(button);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,13 +146,22 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
return findViewById(R.id.error_text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int checkMaxEnrolled() {
|
||||
private boolean maxFacesEnrolled() {
|
||||
if (mFaceManager != null) {
|
||||
final int max = getResources().getInteger(
|
||||
com.android.internal.R.integer.config_faceMaxTemplatesPerUser);
|
||||
final int numEnrolledFaces = mFaceManager.getEnrolledFaces(mUserId).size();
|
||||
if (numEnrolledFaces >= max) {
|
||||
return numEnrolledFaces >= max;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Refactor this to something that conveys it is used for getting a string ID.
|
||||
@Override
|
||||
protected int checkMaxEnrolled() {
|
||||
if (mFaceManager != null) {
|
||||
if (maxFacesEnrolled()) {
|
||||
return R.string.face_intro_error_max;
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user