Update Lottie animations for gesture navigation tutorial to enable custom colors

This change introduces tokens for all the lottie animations in the
gesture navigation tutorial so that the colors can be changed to match
with the current design spec at http://shortn/_aig7n8W7rF

Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL
Bug: 279823249
Bug: 281764891
Test: Tried changing colors and verified that lottie animations changed
appropriately.

Change-Id: If2c820826603fb1cf424f5f0c97d83b195d26606
This commit is contained in:
Saumya Prakash
2023-05-11 21:49:37 +00:00
committed by Schneider Victor-tulias
parent 474f3c4e90
commit 0a6fb2c9e1
17 changed files with 62 additions and 15 deletions
@@ -16,5 +16,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="?android:attr/dialogCornerRadius"/>
<solid android:color="?android:attr/colorAccent"/>
</shape>
@@ -26,7 +26,7 @@
<shape
android:shape="rectangle">
<corners android:radius="50dp"/>
<solid android:color="?androidprv:attr/materialColorPrimary"/>
<solid android:color="@android:color/white"/>
</shape>
</item>
</layer-list>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -28,6 +28,9 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
import com.android.quickstep.interaction.NavBarGestureHandler.NavBarGestureResult;
import com.android.quickstep.util.LottieAnimationColorUtils;
import java.util.Map;
/** A {@link TutorialController} for the Back tutorial. */
final class BackGestureTutorialController extends TutorialController {
@@ -36,6 +39,22 @@ final class BackGestureTutorialController extends TutorialController {
BackGestureTutorialController(BackGestureTutorialFragment fragment, TutorialType tutorialType) {
super(fragment, tutorialType);
// Set the Lottie animation colors specifically for the Back gesture
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
LottieAnimationColorUtils.updateColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceBack", fragment.mRootView.mColorOnSurfaceBack,
".surfaceBack", fragment.mRootView.mColorSurfaceBack,
".secondaryBack", fragment.mRootView.mColorSecondaryBack));
LottieAnimationColorUtils.updateColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceBack
: fragment.mRootView.mColorSecondaryBack,
".checkmarkBackground", fragment.mRootView.mColorSurfaceBack));
}
}
@Override
@@ -35,12 +35,22 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
HomeGestureTutorialController(HomeGestureTutorialFragment fragment, TutorialType tutorialType) {
super(fragment, tutorialType);
// Set the Lottie animation colors specifically for the Home gesture
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
LottieAnimationColorUtils.updateColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceHome", fragment.mRootView.mColorOnSurfaceHome,
".surfaceHome", fragment.mRootView.mColorSurfaceHome,
".arrow", fragment.mRootView.mColorSecondaryHome));
".secondaryHome", fragment.mRootView.mColorSecondaryHome));
LottieAnimationColorUtils.updateColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceHome
: fragment.mRootView.mColorSecondaryHome,
".checkmarkBackground", fragment.mRootView.mColorSurfaceHome));
}
}
@@ -34,8 +34,10 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.quickstep.SwipeUpAnimationLogic;
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
import com.android.quickstep.interaction.NavBarGestureHandler.NavBarGestureResult;
import com.android.quickstep.util.LottieAnimationColorUtils;
import java.util.ArrayList;
import java.util.Map;
/** A {@link TutorialController} for the Overview tutorial. */
@TargetApi(Build.VERSION_CODES.R)
@@ -44,6 +46,23 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
OverviewGestureTutorialController(OverviewGestureTutorialFragment fragment,
TutorialType tutorialType) {
super(fragment, tutorialType);
// Set the Lottie animation colors specifically for the Overview gesture
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
LottieAnimationColorUtils.updateColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceOverview", fragment.mRootView.mColorOnSurfaceOverview,
".surfaceOverview", fragment.mRootView.mColorSurfaceOverview,
".secondaryOverview", fragment.mRootView.mColorSecondaryOverview));
LottieAnimationColorUtils.updateColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceOverview
: fragment.mRootView.mColorSecondaryOverview,
".checkmarkBackground", fragment.mRootView.mColorSurfaceOverview));
}
}
@Override
public int getIntroductionTitle() {
@@ -120,7 +120,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
private boolean mGestureCompleted = false;
protected LottieAnimationView mAnimatedGestureDemonstration;
private LottieAnimationView mCheckmarkAnimation;
protected LottieAnimationView mCheckmarkAnimation;
private RelativeLayout mFullGestureDemonstration;
// These runnables should be used when posting callbacks to their views and cleared from their