Remove demo button from animation and move to gesture navigation settings fragment

Flag: NONE N/A

Test: Built and tested flow, video in bug

Bug: 399034564

Change-Id: I9c8386e2d4236ab4f686daff49e0cd088ad5e126
This commit is contained in:
Randy Pfohl
2025-02-27 00:11:07 +00:00
parent e0dc58fc79
commit 25b8a583bd
4 changed files with 44 additions and 47 deletions

View File

@@ -78,15 +78,6 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
private static final String KEY_SHOW_A11Y_TUTORIAL_DIALOG = "show_a11y_tutorial_dialog_bool";
static final String LAUNCHER_PACKAGE_NAME = "com.google.android.apps.nexuslauncher";
static final String ACTION_GESTURE_SANDBOX = "com.android.quickstep.action.GESTURE_SANDBOX";
final Intent mLaunchSandboxIntent = new Intent(ACTION_GESTURE_SANDBOX)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("use_tutorial_menu", true)
.setPackage(LAUNCHER_PACKAGE_NAME);
private static final int MIN_LARGESCREEN_WIDTH_DP = 600;
private boolean mA11yTutorialDialogShown = false;
@@ -133,7 +124,6 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
mVideoPreference.applyDynamicColor();
}
setIllustrationVideo(mVideoPreference, getDefaultKey());
setIllustrationClickListener(mVideoPreference, getDefaultKey());
migrateOverlaySensitivityToSettings(context, mOverlayManager);
}
@@ -150,6 +140,7 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
final PreferenceScreen screen = getPreferenceScreen();
screen.removeAll();
screen.addPreference(mVideoPreference);
addPreferencesFromResource(getPreferenceScreenResId());
final List<BasePreferenceController> preferenceControllers = PreferenceControllerListHelper
.getPreferenceControllersFromXml(getContext(), getPreferenceScreenResId());
@@ -246,40 +237,9 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
if (!android.provider.Flags.a11yStandaloneGestureEnabled()) {
setGestureNavigationTutorialDialog(key);
}
setIllustrationClickListener(mVideoPreference, key);
return true;
}
private boolean isGestureTutorialAvailable() {
Context context = getContext();
return context != null
&& mLaunchSandboxIntent.resolveActivity(context.getPackageManager()) != null;
}
private void setIllustrationClickListener(IllustrationPreference videoPref,
String systemNavKey) {
switch (systemNavKey) {
case KEY_SYSTEM_NAV_GESTURAL:
if (isGestureTutorialAvailable()){
videoPref.setContentDescription(R.string.nav_tutorial_button_description);
videoPref.setOnPreferenceClickListener(preference -> {
startActivity(mLaunchSandboxIntent);
return true;
});
} else {
videoPref.setOnPreferenceClickListener(null);
}
break;
case KEY_SYSTEM_NAV_2BUTTONS:
case KEY_SYSTEM_NAV_3BUTTONS:
default:
videoPref.setOnPreferenceClickListener(null);
break;
}
}
static void migrateOverlaySensitivityToSettings(Context context,
IOverlayManager overlayManager) {
if (!SystemNavigationPreferenceController.isGestureNavigationEnabled(context)) {
@@ -338,12 +298,7 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
String systemNavKey) {
switch (systemNavKey) {
case KEY_SYSTEM_NAV_GESTURAL:
if (isGestureTutorialAvailable()) {
videoPref.setLottieAnimationResId(
R.raw.lottie_system_nav_fully_gestural_with_nav);
} else {
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_fully_gestural);
}
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_fully_gestural);
break;
case KEY_SYSTEM_NAV_2BUTTONS:
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_2_button);