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:
Fan Zhang
2016-10-18 12:58:31 -07:00
parent a5c421083a
commit db1112a221
34 changed files with 524 additions and 127 deletions

View File

@@ -17,7 +17,6 @@ import android.content.Context;
import android.content.res.Configuration;
import android.support.v7.preference.DropDownPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.MetricsProto;
import com.android.internal.view.RotationPolicy;
@@ -38,14 +37,13 @@ public class AutoRotatePreferenceController extends PreferenceController impleme
}
@Override
protected String getPreferenceKey() {
public String getPreferenceKey() {
return KEY_AUTO_ROTATE;
}
@Override
public void updateState(PreferenceScreen screen) {
final DropDownPreference rotatePreference =
(DropDownPreference) screen.findPreference(KEY_AUTO_ROTATE);
public void updateState(Preference preference) {
final DropDownPreference rotatePreference = (DropDownPreference) preference;
final int rotateLockedResourceId;
// The following block sets the string used when rotation is locked.
// If the device locks specifically to portrait or landscape (rather than current
@@ -69,7 +67,6 @@ public class AutoRotatePreferenceController extends PreferenceController impleme
1 : 0);
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
return false;