Use FooterPreference in FingerprintSettings page

Use the new FooterPreference and removed the old FooterPreferenceMixin
from the FingerprintSettings page.

Fixes: 139050306
Test: manual test
Change-Id: Ia4a2dda57512e30ee8628ad18d9c4263b88d13fc
This commit is contained in:
Sunny Shao
2019-08-07 20:35:24 +08:00
parent c9d8437287
commit 5cb18299a9

View File

@@ -132,6 +132,7 @@ public class FingerprintSettings extends SubSettings {
private boolean mLaunchedConfirm; private boolean mLaunchedConfirm;
private Drawable mHighlightDrawable; private Drawable mHighlightDrawable;
private int mUserId; private int mUserId;
private CharSequence mFooterTitle;
private static final String TAG_AUTHENTICATE_SIDECAR = "authenticate_sidecar"; private static final String TAG_AUTHENTICATE_SIDECAR = "authenticate_sidecar";
private static final String TAG_REMOVAL_SIDECAR = "removal_sidecar"; private static final String TAG_REMOVAL_SIDECAR = "removal_sidecar";
@@ -323,7 +324,6 @@ public class FingerprintSettings extends SubSettings {
launchChooseOrConfirmLock(); launchChooseOrConfirmLock();
} }
final FooterPreference pref = mFooterPreferenceMixin.createFooterPreference();
final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled( final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
activity, DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT, mUserId); activity, DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT, mUserId);
final AnnotationSpan.LinkInfo adminLinkInfo = new AnnotationSpan.LinkInfo( final AnnotationSpan.LinkInfo adminLinkInfo = new AnnotationSpan.LinkInfo(
@@ -334,11 +334,11 @@ public class FingerprintSettings extends SubSettings {
activity, getString(getHelpResource()), activity.getClass().getName()); activity, getString(getHelpResource()), activity.getClass().getName());
final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo( final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(
activity, ANNOTATION_URL, helpIntent); activity, ANNOTATION_URL, helpIntent);
pref.setTitle(AnnotationSpan.linkify(getText(admin != null mFooterTitle = AnnotationSpan.linkify(getText(admin != null
? R.string ? R.string
.security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled .security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled
: R.string.security_settings_fingerprint_enroll_disclaimer), : R.string.security_settings_fingerprint_enroll_disclaimer),
linkInfo, adminLinkInfo)); linkInfo, adminLinkInfo);
} }
protected void removeFingerprintPreference(int fingerprintId) { protected void removeFingerprintPreference(int fingerprintId) {
@@ -400,6 +400,7 @@ public class FingerprintSettings extends SubSettings {
root.addPreference(addPreference); root.addPreference(addPreference);
addPreference.setOnPreferenceChangeListener(this); addPreference.setOnPreferenceChangeListener(this);
updateAddPreference(); updateAddPreference();
createFooterPreference(root);
} }
private void updateAddPreference() { private void updateAddPreference() {
@@ -419,6 +420,18 @@ public class FingerprintSettings extends SubSettings {
addPreference.setEnabled(!tooMany && !removalInProgress); addPreference.setEnabled(!tooMany && !removalInProgress);
} }
private void createFooterPreference(PreferenceGroup root) {
final Context context = getActivity();
if (context == null) {
return;
}
final FooterPreference footerPreference = new FooterPreference(context);
footerPreference.setTitle(mFooterTitle);
footerPreference.setSelectable(false);
root.addPreference(footerPreference);
}
private static String genKey(int id) { private static String genKey(int id) {
return KEY_FINGERPRINT_ITEM_PREFIX + "_" + id; return KEY_FINGERPRINT_ITEM_PREFIX + "_" + id;
} }