Merge "adding new animation to be used when gesture tutorial package is available" into udc-dev am: 00d12bbe22
am: 44d9d4d396
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22387145 Change-Id: Ief4f67edd4b8fd9124a5908cdff1f433639a4049 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
1
res/raw/lottie_system_nav_fully_gestural_with_nav.json
Normal file
1
res/raw/lottie_system_nav_fully_gestural_with_nav.json
Normal file
File diff suppressed because one or more lines are too long
@@ -75,6 +75,13 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
|
|||||||
|
|
||||||
private static final String KEY_SHOW_A11Y_TUTORIAL_DIALOG = "show_a11y_tutorial_dialog_bool";
|
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)
|
||||||
|
.setPackage(LAUNCHER_PACKAGE_NAME);
|
||||||
|
|
||||||
private static final int MIN_LARGESCREEN_WIDTH_DP = 600;
|
private static final int MIN_LARGESCREEN_WIDTH_DP = 600;
|
||||||
|
|
||||||
private boolean mA11yTutorialDialogShown = false;
|
private boolean mA11yTutorialDialogShown = false;
|
||||||
@@ -121,6 +128,7 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
|
|||||||
mVideoPreference.applyDynamicColor();
|
mVideoPreference.applyDynamicColor();
|
||||||
}
|
}
|
||||||
setIllustrationVideo(mVideoPreference, getDefaultKey());
|
setIllustrationVideo(mVideoPreference, getDefaultKey());
|
||||||
|
setIllustrationClickListener(mVideoPreference, getDefaultKey());
|
||||||
|
|
||||||
migrateOverlaySensitivityToSettings(context, mOverlayManager);
|
migrateOverlaySensitivityToSettings(context, mOverlayManager);
|
||||||
}
|
}
|
||||||
@@ -221,9 +229,39 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
|
|||||||
setCurrentSystemNavigationMode(mOverlayManager, key);
|
setCurrentSystemNavigationMode(mOverlayManager, key);
|
||||||
setIllustrationVideo(mVideoPreference, key);
|
setIllustrationVideo(mVideoPreference, key);
|
||||||
setGestureNavigationTutorialDialog(key);
|
setGestureNavigationTutorialDialog(key);
|
||||||
|
setIllustrationClickListener(mVideoPreference, key);
|
||||||
return true;
|
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.setOnPreferenceClickListener(preference -> {
|
||||||
|
startActivity(mLaunchSandboxIntent.putExtra("use_tutorial_menu", true));
|
||||||
|
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,
|
static void migrateOverlaySensitivityToSettings(Context context,
|
||||||
IOverlayManager overlayManager) {
|
IOverlayManager overlayManager) {
|
||||||
if (!SystemNavigationPreferenceController.isGestureNavigationEnabled(context)) {
|
if (!SystemNavigationPreferenceController.isGestureNavigationEnabled(context)) {
|
||||||
@@ -278,11 +316,16 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setIllustrationVideo(IllustrationPreference videoPref,
|
private void setIllustrationVideo(IllustrationPreference videoPref,
|
||||||
String systemNavKey) {
|
String systemNavKey) {
|
||||||
switch (systemNavKey) {
|
switch (systemNavKey) {
|
||||||
case KEY_SYSTEM_NAV_GESTURAL:
|
case KEY_SYSTEM_NAV_GESTURAL:
|
||||||
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_fully_gestural);
|
if (isGestureTutorialAvailable()) {
|
||||||
|
videoPref.setLottieAnimationResId(
|
||||||
|
R.raw.lottie_system_nav_fully_gestural_with_nav);
|
||||||
|
} else {
|
||||||
|
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_fully_gestural);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_SYSTEM_NAV_2BUTTONS:
|
case KEY_SYSTEM_NAV_2BUTTONS:
|
||||||
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_2_button);
|
videoPref.setLottieAnimationResId(R.raw.lottie_system_nav_2_button);
|
||||||
|
Reference in New Issue
Block a user