Add progressive disclsoure
- Add a ProgressiveDisclosureMixin that contains all logic for collapse preference list when it's too long - Refactored PreferenceController's updateState to take a preference instead of PreferenceScreen, because with progressive disclosure the preference can either be in screen or the mixin. DashboardFragment is responsible finding the preference before passing it to controller. Bug: 32255863 Test: RunSettingsRoboTests Change-Id: I6713abd61c954ce12732902e5b3ca4d4c0b1563e
This commit is contained in:
@@ -16,7 +16,6 @@ package com.android.settings.display;
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.PreferenceController;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
@@ -38,13 +37,13 @@ public class WallpaperPreferenceController extends PreferenceController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPreferenceKey() {
|
||||
public String getPreferenceKey() {
|
||||
return KEY_WALLPAPER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(PreferenceScreen screen) {
|
||||
disablePreferenceIfManaged(screen);
|
||||
public void updateState(Preference preference) {
|
||||
disablePreferenceIfManaged((RestrictedPreference) preference);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,9 +51,7 @@ public class WallpaperPreferenceController extends PreferenceController {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void disablePreferenceIfManaged(PreferenceScreen screen) {
|
||||
final RestrictedPreference pref =
|
||||
(RestrictedPreference) screen.findPreference(KEY_WALLPAPER);
|
||||
private void disablePreferenceIfManaged(RestrictedPreference pref) {
|
||||
final String restriction = DISALLOW_SET_WALLPAPER;
|
||||
if (pref != null) {
|
||||
pref.setDisabledByAdmin(null);
|
||||
|
||||
Reference in New Issue
Block a user