Merge "Check for developer option on resuming settings activity." into sc-dev
This commit is contained in:
commit
e1d06c5ccd
1 file changed
+23
-3
@@ -129,6 +129,7 @@ public class SettingsActivity extends FragmentActivity
|
|||||||
private String mHighLightKey;
|
private String mHighLightKey;
|
||||||
private boolean mPreferenceHighlighted = false;
|
private boolean mPreferenceHighlighted = false;
|
||||||
private NotificationDotsPreference mNotificationSettingsChangedListener;
|
private NotificationDotsPreference mNotificationSettingsChangedListener;
|
||||||
|
private Preference mDeveloperOptionPref;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
@@ -202,18 +203,37 @@ public class SettingsActivity extends FragmentActivity
|
|||||||
return FeatureFlags.showFlagTogglerUi(getContext());
|
return FeatureFlags.showFlagTogglerUi(getContext());
|
||||||
|
|
||||||
case DEVELOPER_OPTIONS_KEY:
|
case DEVELOPER_OPTIONS_KEY:
|
||||||
// Show if plugins are enabled or flag UI is enabled.
|
mDeveloperOptionPref = preference;
|
||||||
return FeatureFlags.showFlagTogglerUi(getContext()) ||
|
return updateDeveloperOption();
|
||||||
PluginManagerWrapper.hasPlugins(getContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show if plugins are enabled or flag UI is enabled.
|
||||||
|
* @return True if we should show the preference option.
|
||||||
|
*/
|
||||||
|
private boolean updateDeveloperOption() {
|
||||||
|
boolean showPreference = FeatureFlags.showFlagTogglerUi(getContext())
|
||||||
|
|| PluginManagerWrapper.hasPlugins(getContext());
|
||||||
|
if (mDeveloperOptionPref != null) {
|
||||||
|
mDeveloperOptionPref.setEnabled(showPreference);
|
||||||
|
if (showPreference) {
|
||||||
|
getPreferenceScreen().addPreference(mDeveloperOptionPref);
|
||||||
|
} else {
|
||||||
|
getPreferenceScreen().removePreference(mDeveloperOptionPref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return showPreference;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
updateDeveloperOption();
|
||||||
|
|
||||||
if (isAdded() && !mPreferenceHighlighted) {
|
if (isAdded() && !mPreferenceHighlighted) {
|
||||||
PreferenceHighlighter highlighter = createHighlighter();
|
PreferenceHighlighter highlighter = createHighlighter();
|
||||||
if (highlighter != null) {
|
if (highlighter != null) {
|
||||||
|
|||||||
Reference in new issue
Block a user