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:
@@ -19,7 +19,6 @@ import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.preference.DropDownPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -42,18 +41,13 @@ public class VrDisplayPreferenceController extends PreferenceController implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPreferenceKey() {
|
||||
public String getPreferenceKey() {
|
||||
return KEY_VR_DISPLAY_PREF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(PreferenceScreen screen) {
|
||||
final DropDownPreference pref =
|
||||
(DropDownPreference) screen.findPreference(KEY_VR_DISPLAY_PREF);
|
||||
if (pref == null) {
|
||||
Log.d(TAG, "Could not find VR display preference.");
|
||||
return;
|
||||
}
|
||||
public void updateState(Preference preference) {
|
||||
final DropDownPreference pref = (DropDownPreference) preference;
|
||||
pref.setEntries(new CharSequence[]{
|
||||
mContext.getString(R.string.display_vr_pref_low_persistence),
|
||||
mContext.getString(R.string.display_vr_pref_off),
|
||||
|
Reference in New Issue
Block a user