Merge "Add a new feature flag for the expand button in support lib."
This commit is contained in:
@@ -73,7 +73,8 @@ public class DisplaySettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.display_settings;
|
||||
return mProgressiveDisclosureMixin.isEnabled()
|
||||
? R.xml.display_settings : R.xml.display_settings_new_advance_button;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -60,7 +60,8 @@ public class AppAndNotificationDashboardFragment extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.app_and_notification;
|
||||
return mProgressiveDisclosureMixin.isEnabled()
|
||||
? R.xml.app_and_notification : R.xml.app_and_notification_new_advance_button;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -24,6 +24,7 @@ import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
@@ -42,6 +43,8 @@ import java.util.List;
|
||||
public class ProgressiveDisclosureMixin implements Preference.OnPreferenceClickListener,
|
||||
LifecycleObserver, OnCreate, OnSaveInstanceState {
|
||||
|
||||
@VisibleForTesting
|
||||
static final String FEATURE_FLAG_NEW_ADVANCE_BUTTON = "new_settings_advance_button";
|
||||
private static final String TAG = "ProgressiveDisclosure";
|
||||
private static final String STATE_USER_EXPANDED = "state_user_expanded";
|
||||
private static final int DEFAULT_TILE_LIMIT = 300;
|
||||
@@ -102,11 +105,17 @@ public class ProgressiveDisclosureMixin implements Preference.OnPreferenceClickL
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return !FeatureFlagUtils.isEnabled(FEATURE_FLAG_NEW_ADVANCE_BUTTON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the threshold to start collapsing preferences when there are too many.
|
||||
*/
|
||||
public void setTileLimit(int limit) {
|
||||
mTileLimit = limit;
|
||||
if (isEnabled()) {
|
||||
mTileLimit = limit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -86,7 +86,8 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.language_and_input;
|
||||
return mProgressiveDisclosureMixin.isEnabled()
|
||||
? R.xml.language_and_input : R.xml.language_and_input_new_advance_button;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -109,7 +109,8 @@ public class SoundSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.sound_settings;
|
||||
return mProgressiveDisclosureMixin.isEnabled()
|
||||
? R.xml.sound_settings : R.xml.sound_settings_new_advance_button;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user