Expand all preferences when launch from search.
- when the fragment is created, checks the argument to see if the extra fragment arg key is set. If so, do not hide the preferences in the preference screen inside the advanced button. Change-Id: I80fa20672024fe702ed2ddab448232bdc92ce05f Fixes: 68988454 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -150,8 +150,8 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
||||
}
|
||||
|
||||
// Prepare help url and enable menu if necessary
|
||||
Bundle arguments = getArguments();
|
||||
int helpResource;
|
||||
final Bundle arguments = getArguments();
|
||||
final int helpResource;
|
||||
if (arguments != null && arguments.containsKey(HELP_URI_RESOURCE_KEY)) {
|
||||
helpResource = arguments.getInt(HELP_URI_RESOURCE_KEY);
|
||||
} else {
|
||||
@@ -160,6 +160,17 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
||||
if (helpResource != 0) {
|
||||
mHelpUri = getResources().getString(helpResource);
|
||||
}
|
||||
|
||||
// Check if we should keep the preferences expanded.
|
||||
if (arguments != null) {
|
||||
mPreferenceKey = arguments.getString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY);
|
||||
if (!TextUtils.isEmpty(mPreferenceKey)) {
|
||||
final PreferenceScreen screen = getPreferenceScreen();
|
||||
if (screen != null) {
|
||||
screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,9 +235,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
final Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
mPreferenceKey = args.getString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY);
|
||||
if (mPreferenceKey != null) {
|
||||
highlightPreferenceIfNeeded();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user