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.template.FooterButton;
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
import com.google.android.setupdesign.span.LinkSpan;
|
import com.google.android.setupdesign.span.LinkSpan;
|
||||||
|
import com.google.android.setupdesign.template.RequireScrollMixin;
|
||||||
|
|
||||||
public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||||
|
|
||||||
@@ -67,14 +68,25 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
mFooterBarMixin.setPrimaryButton(
|
FooterButton.Builder nextButtonBuilder = new FooterButton.Builder(this)
|
||||||
new FooterButton.Builder(this)
|
.setText(R.string.security_settings_face_enroll_introduction_agree)
|
||||||
.setText(R.string.security_settings_face_enroll_introduction_agree)
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
.setListener(this::onNextButtonClick)
|
.setTheme(R.style.SudGlifButton_Primary);
|
||||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
if (maxFacesEnrolled()) {
|
||||||
.setTheme(R.style.SudGlifButton_Primary)
|
nextButtonBuilder.setListener(this::onNextButtonClick);
|
||||||
.build()
|
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
|
@Override
|
||||||
@@ -134,13 +146,22 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
|||||||
return findViewById(R.id.error_text);
|
return findViewById(R.id.error_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean maxFacesEnrolled() {
|
||||||
protected int checkMaxEnrolled() {
|
|
||||||
if (mFaceManager != null) {
|
if (mFaceManager != null) {
|
||||||
final int max = getResources().getInteger(
|
final int max = getResources().getInteger(
|
||||||
com.android.internal.R.integer.config_faceMaxTemplatesPerUser);
|
com.android.internal.R.integer.config_faceMaxTemplatesPerUser);
|
||||||
final int numEnrolledFaces = mFaceManager.getEnrolledFaces(mUserId).size();
|
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;
|
return R.string.face_intro_error_max;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user