Add ability to start DeveloperOptionsFragment with filter pre-applied
Repurposing EXTRA_FRAGMENT_ARG_KEY to set an initial filter. Test: adb shell 'am start -n com.google.android.apps.nexuslauncher/com.android.launcher3.settings.SettingsActivity --es ":settings:fragment" "com.android.launcher3.settings.DeveloperOptionsFragment" --es ":settings:fragment_args_key" "Education"' Bug: 199299382 Change-Id: I032f7ffc373daed51c8d381f3cacf722fb3fb198
This commit is contained in:
@@ -20,6 +20,7 @@ import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
|
||||
import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED;
|
||||
import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey;
|
||||
|
||||
@@ -159,6 +160,15 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
|
||||
}
|
||||
});
|
||||
|
||||
if (getArguments() != null) {
|
||||
String filter = getArguments().getString(EXTRA_FRAGMENT_ARG_KEY);
|
||||
// Normally EXTRA_FRAGMENT_ARG_KEY is used to highlight the preference with the given
|
||||
// key. This is a slight variation where we instead filter by the human-readable titles.
|
||||
if (filter != null) {
|
||||
filterBox.setText(filter);
|
||||
}
|
||||
}
|
||||
|
||||
View listView = getListView();
|
||||
final int bottomPadding = listView.getPaddingBottom();
|
||||
listView.setOnApplyWindowInsetsListener((v, insets) -> {
|
||||
|
||||
Reference in New Issue
Block a user