mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 10:18:20 +00:00
Adds option to launch Gesture Sandbox from dev settings.
This is set to have the same task affinity as Launcher so that it inherits the ability to ignore system gestures. Bug: 148542211 Change-Id: I29bc5599dea61c44be721dcc0bec7bc494c415c4
This commit is contained in:
@@ -96,6 +96,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
initFlags();
|
||||
loadPluginPrefs();
|
||||
maybeAddSandboxCategory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -203,6 +204,31 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
|
||||
});
|
||||
}
|
||||
|
||||
private void maybeAddSandboxCategory() {
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
Intent launchSandboxIntent =
|
||||
new Intent("com.android.quickstep.action.GESTURE_SANDBOX")
|
||||
.setPackage(context.getPackageName())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
if (launchSandboxIntent.resolveActivity(context.getPackageManager()) == null) {
|
||||
return;
|
||||
}
|
||||
PreferenceCategory sandboxCategory = newCategory("Sandbox");
|
||||
Preference launchSandboxPreference = new Preference(context);
|
||||
launchSandboxPreference.setKey("launchSandbox");
|
||||
launchSandboxPreference.setTitle("Launch Gesture Navigation Sandbox");
|
||||
launchSandboxPreference.setSummary(
|
||||
"This provides tutorials and a place to practice navigation gestures.");
|
||||
launchSandboxPreference.setOnPreferenceClickListener(preference -> {
|
||||
startActivity(launchSandboxIntent);
|
||||
return true;
|
||||
});
|
||||
sandboxCategory.addPreference(launchSandboxPreference);
|
||||
}
|
||||
|
||||
private String toName(String action) {
|
||||
String str = action.replace("com.android.systemui.action.PLUGIN_", "")
|
||||
.replace("com.android.launcher3.action.PLUGIN_", "");
|
||||
|
||||
Reference in New Issue
Block a user