BiometricEnrollIntroduction button update
No longer show the "No thanks" button until the user has scrolled to the bottom of the introduction text. This applies for both face and fingerprint enroll introduction screens. Fixes: 189268868 Test: Manual Change-Id: I0ccf6ae1d329df06f769f05288706ef22183bc21
This commit is contained in:
@@ -39,6 +39,8 @@ import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
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;
|
||||
import com.google.android.setupdesign.template.RequireScrollMixin.OnRequireScrollStateChangedListener;
|
||||
import com.google.android.setupdesign.util.DynamicColorPalette;
|
||||
|
||||
/**
|
||||
@@ -180,6 +182,35 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
launchConfirmLock(getConfirmLockTitleResId());
|
||||
}
|
||||
}
|
||||
|
||||
FooterButton primaryButton = getPrimaryFooterButton();
|
||||
FooterButton secondaryButton = getSecondaryFooterButton();
|
||||
if (primaryButton == null) {
|
||||
Log.d(TAG, "getPrimaryFooterButton() was null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (secondaryButton == null) {
|
||||
Log.d(TAG, "getSecondaryFooterButton() was null");
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup scroll mixin
|
||||
final RequireScrollMixin requireScrollMixin = getLayout().getMixin(
|
||||
RequireScrollMixin.class);
|
||||
requireScrollMixin.requireScrollWithButton(this, primaryButton, getScrollCompletedText(),
|
||||
this::onNextButtonClick);
|
||||
|
||||
secondaryButton.setVisibility(View.INVISIBLE);
|
||||
requireScrollMixin.setOnRequireScrollStateChangedListener(
|
||||
new OnRequireScrollStateChangedListener() {
|
||||
@Override
|
||||
public void onRequireScrollStateChanged(boolean scrollNeeded) {
|
||||
if (!scrollNeeded && secondaryButton.getVisibility() == View.INVISIBLE) {
|
||||
secondaryButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -335,4 +366,18 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
}
|
||||
return mIconColorFilter;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected FooterButton getPrimaryFooterButton() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected FooterButton getSecondaryFooterButton() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int getScrollCompletedText() {
|
||||
return R.string.security_settings_face_enroll_introduction_more;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user