Update gesture tutorial colors
- Updated all redesigned gesture nav menu and tutorial colors to dynamic color spec Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL Bug: 281764891 Bug: 279823249 Test: launched tutorial menu and tutorial steps Change-Id: I03532b80c6e14867c1374bbdf9f984c1cece9809
This commit is contained in:
1 parent
e212779ffd
commit
474f3c4e90
30 files changed
+445
-107
No files matched your search
@@ -62,6 +62,28 @@ final class BackGestureTutorialController extends TutorialController {
|
||||
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTitleTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_MainTitle_Back;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuccessTitleTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_MainTitle_Success_Back;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoneButtonTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_ButtonLabel_Back;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoneButtonColor() {
|
||||
return Utilities.isDarkTheme(mContext)
|
||||
? mTutorialFragment.mRootView.mColorOnSurfaceBack
|
||||
: mTutorialFragment.mRootView.mColorSecondaryBack;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockAppTaskLayoutResId() {
|
||||
return getMockAppTaskCurrentPageLayoutResId();
|
||||
@@ -95,8 +117,13 @@ final class BackGestureTutorialController extends TutorialController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSwipeActionColorResId() {
|
||||
return R.color.gesture_tutorial_workspace_background;
|
||||
protected int getSwipeActionColor() {
|
||||
return mTutorialFragment.mRootView.mColorSurfaceContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExitingAppColor() {
|
||||
return mTutorialFragment.mRootView.mColorSurfaceBack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
|
||||
import com.android.quickstep.interaction.NavBarGestureHandler.NavBarGestureResult;
|
||||
import com.android.quickstep.util.LottieAnimationColorUtils;
|
||||
@@ -37,10 +38,9 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
||||
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
||||
LottieAnimationColorUtils.updateColors(
|
||||
mAnimatedGestureDemonstration,
|
||||
Map.of(".onSurfaceHome", R.color.gesture_tutorial_workspace_background,
|
||||
".surfaceHome", R.color.gesture_home_tutorial_background,
|
||||
".arrow", R.color.gesture_home_tutorial_arrow),
|
||||
mContext.getTheme());
|
||||
Map.of(".onSurfaceHome", fragment.mRootView.mColorOnSurfaceHome,
|
||||
".surfaceHome", fragment.mRootView.mColorSurfaceHome,
|
||||
".arrow", fragment.mRootView.mColorSecondaryHome));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,28 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
||||
: R.string.home_gesture_feedback_complete_with_follow_up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTitleTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_MainTitle_Home;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuccessTitleTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_MainTitle_Success_Home;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoneButtonTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_ButtonLabel_Home;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoneButtonColor() {
|
||||
return Utilities.isDarkTheme(mContext)
|
||||
? mTutorialFragment.mRootView.mColorOnSurfaceHome
|
||||
: mTutorialFragment.mRootView.mColorSecondaryHome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockAppTaskLayoutResId() {
|
||||
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
@@ -89,8 +111,13 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSwipeActionColorResId() {
|
||||
return R.color.gesture_tutorial_workspace_background;
|
||||
protected int getSwipeActionColor() {
|
||||
return mTutorialFragment.mRootView.mColorSurfaceContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExitingAppColor() {
|
||||
return mTutorialFragment.mRootView.mColorSurfaceHome;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+35
-6
@@ -28,6 +28,7 @@ import android.os.Handler;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.quickstep.SwipeUpAnimationLogic;
|
||||
@@ -68,6 +69,28 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
||||
: R.string.overview_gesture_feedback_complete_without_follow_up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTitleTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_MainTitle_Overview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuccessTitleTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_MainTitle_Success_Overview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoneButtonTextAppearance() {
|
||||
return R.style.TextAppearance_GestureTutorial_ButtonLabel_Overview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoneButtonColor() {
|
||||
return Utilities.isDarkTheme(mContext)
|
||||
? mTutorialFragment.mRootView.mColorOnSurfaceOverview
|
||||
: mTutorialFragment.mRootView.mColorSecondaryOverview;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockAppTaskLayoutResId() {
|
||||
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
@@ -87,15 +110,21 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSwipeActionColorResId() {
|
||||
return R.color.gesture_overview_background;
|
||||
protected int getSwipeActionColor() {
|
||||
return mTutorialFragment.mRootView.mColorSurfaceOverview;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockPreviousAppTaskThumbnailColorResId() {
|
||||
protected int getExitingAppColor() {
|
||||
return mTutorialFragment.mRootView.mColorOnSurfaceOverview;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockPreviousAppTaskThumbnailColor() {
|
||||
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
? R.color.gesture_overview_tutorial_swipe_rect
|
||||
: R.color.gesture_tutorial_fake_previous_task_view_color;
|
||||
? mTutorialFragment.mRootView.mColorSurfaceContainer
|
||||
: mContext.getResources().getColor(
|
||||
R.color.gesture_tutorial_fake_previous_task_view_color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,7 +242,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
||||
}
|
||||
|
||||
private void onSuccessAnimationComplete() {
|
||||
setLauncherViewColor(R.color.gesture_overview_tutorial_swipe_rect);
|
||||
mFakeLauncherView.setBackgroundColor(getMockPreviousAppTaskThumbnailColor());
|
||||
showSuccessFeedback();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ package com.android.quickstep.interaction;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
@@ -26,7 +28,9 @@ import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
@@ -39,21 +43,70 @@ public class RootSandboxLayout extends RelativeLayout {
|
||||
private final Rect mTempInclusionBounds = new Rect();
|
||||
private final Rect mTempExclusionBounds = new Rect();
|
||||
|
||||
@ColorInt final int mColorSurfaceContainer;
|
||||
@ColorInt final int mColorOnSurfaceHome;
|
||||
@ColorInt final int mColorSurfaceHome;
|
||||
@ColorInt final int mColorSecondaryHome;
|
||||
@ColorInt final int mColorOnSurfaceBack;
|
||||
@ColorInt final int mColorSurfaceBack;
|
||||
@ColorInt final int mColorSecondaryBack;
|
||||
@ColorInt final int mColorOnSurfaceOverview;
|
||||
@ColorInt final int mColorSurfaceOverview;
|
||||
@ColorInt final int mColorSecondaryOverview;
|
||||
|
||||
private View mFeedbackView;
|
||||
private View mTutorialStepView;
|
||||
private View mSkipButton;
|
||||
private View mDoneButton;
|
||||
|
||||
public RootSandboxLayout(Context context) {
|
||||
super(context);
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public RootSandboxLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public RootSandboxLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
public RootSandboxLayout(
|
||||
@NonNull Context context,
|
||||
@Nullable AttributeSet attrs,
|
||||
int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
TypedArray ta = context.obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.RootSandboxLayout,
|
||||
defStyleAttr,
|
||||
defStyleRes);
|
||||
boolean isDarkTheme = Utilities.isDarkTheme(context);
|
||||
int colorSurface = isDarkTheme ? Color.BLACK : Color.WHITE;
|
||||
int colorOnSurface = isDarkTheme ? Color.WHITE : Color.BLACK;
|
||||
int colorSecondary = Color.GRAY;
|
||||
|
||||
mColorSurfaceContainer = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_surfaceContainer, colorSurface);
|
||||
mColorOnSurfaceHome = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_onSurfaceHome, colorOnSurface);
|
||||
mColorSurfaceHome = ta.getColor(R.styleable.RootSandboxLayout_surfaceHome, colorSurface);
|
||||
mColorSecondaryHome = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_secondaryHome, colorSecondary);
|
||||
mColorOnSurfaceBack = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_onSurfaceBack, colorOnSurface);
|
||||
mColorSurfaceBack = ta.getColor(R.styleable.RootSandboxLayout_surfaceBack, colorSurface);
|
||||
mColorSecondaryBack = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_secondaryBack, colorSecondary);
|
||||
mColorOnSurfaceOverview = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_onSurfaceOverview, colorOnSurface);
|
||||
mColorSurfaceOverview = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_surfaceOverview, colorSurface);
|
||||
mColorSecondaryOverview = ta.getColor(
|
||||
R.styleable.RootSandboxLayout_secondaryOverview, colorSecondary);
|
||||
|
||||
ta.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.ColorRes;
|
||||
import android.annotation.RawRes;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -47,11 +46,13 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
|
||||
@@ -258,15 +259,17 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
return NO_ID;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getMockPreviousAppTaskThumbnailColorResId() {
|
||||
return R.color.gesture_tutorial_fake_previous_task_view_color;
|
||||
@ColorInt
|
||||
protected int getMockPreviousAppTaskThumbnailColor() {
|
||||
return mContext.getResources().getColor(
|
||||
R.color.gesture_tutorial_fake_previous_task_view_color);
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getSwipeActionColorResId() {
|
||||
return NO_ID;
|
||||
}
|
||||
@ColorInt
|
||||
protected abstract int getSwipeActionColor();
|
||||
|
||||
@ColorInt
|
||||
protected abstract int getExitingAppColor();
|
||||
|
||||
@DrawableRes
|
||||
public int getMockAppIconResId() {
|
||||
@@ -304,6 +307,24 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
return NO_ID;
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
public int getTitleTextAppearance() {
|
||||
return NO_ID;
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
public int getSuccessTitleTextAppearance() {
|
||||
return NO_ID;
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
public int getDoneButtonTextAppearance() {
|
||||
return NO_ID;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public abstract int getDoneButtonColor();
|
||||
|
||||
void showFeedback() {
|
||||
if (mGestureCompleted) {
|
||||
mFeedbackView.setTranslationY(0);
|
||||
@@ -417,9 +438,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
private void showSuccessPage() {
|
||||
mCheckmarkAnimation.setVisibility(View.VISIBLE);
|
||||
mCheckmarkAnimation.playAnimation();
|
||||
mFeedbackTitleView.setTextAppearance(R.style.TextAppearance_GestureTutorial_SuccessTitle);
|
||||
mFeedbackSubtitleView.setTextAppearance(
|
||||
R.style.TextAppearance_GestureTutorial_SuccessSubtitle);
|
||||
mFeedbackTitleView.setTextAppearance(mContext, getSuccessTitleTextAppearance());
|
||||
}
|
||||
|
||||
public boolean isGestureCompleted() {
|
||||
@@ -536,6 +555,9 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
updateLayout();
|
||||
|
||||
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
||||
mFeedbackTitleView.setTextAppearance(mContext, getTitleTextAppearance());
|
||||
mDoneButton.setTextAppearance(mContext, getDoneButtonTextAppearance());
|
||||
mDoneButton.getBackground().setTint(getDoneButtonColor());
|
||||
mCheckmarkAnimation.setAnimation(mTutorialFragment.isAtFinalStep()
|
||||
? R.raw.checkmark_animation_end
|
||||
: R.raw.checkmark_animation_in_progress);
|
||||
@@ -560,8 +582,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
|
||||
protected void resetViewsForBackGesture() {
|
||||
mFakeTaskView.setVisibility(View.VISIBLE);
|
||||
mFakeTaskView.setBackgroundColor(
|
||||
mContext.getColor(R.color.gesture_tutorial_workspace_background));
|
||||
mFakeTaskView.setBackgroundColor(getSwipeActionColor());
|
||||
mExitingAppView.setVisibility(View.VISIBLE);
|
||||
|
||||
// reset the exiting app's dimensions
|
||||
@@ -649,26 +670,26 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
}
|
||||
}
|
||||
|
||||
void setLauncherViewColor(@ColorRes int backgroundColorRes) {
|
||||
mFakeLauncherView.setBackgroundColor(mContext.getColor(backgroundColorRes));
|
||||
}
|
||||
|
||||
private void updateDrawables() {
|
||||
if (mContext != null) {
|
||||
mTutorialFragment.getRootView().setBackground(AppCompatResources.getDrawable(
|
||||
mContext, getMockWallpaperResId()));
|
||||
mTutorialFragment.updateFeedbackAnimation();
|
||||
setLauncherViewColor(ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
? getSwipeActionColorResId() : R.color.gesture_tutorial_fake_wallpaper_color);
|
||||
mFakeLauncherView.setBackgroundColor(ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
? getSwipeActionColor()
|
||||
: mContext.getColor(R.color.gesture_tutorial_fake_wallpaper_color));
|
||||
updateFakeViewLayout(mFakeHotseatView, getMockHotseatResId());
|
||||
mHotseatIconView = mFakeHotseatView.findViewById(R.id.hotseat_icon_1);
|
||||
updateFakeViewLayout(mFakeTaskView, getMockAppTaskLayoutResId());
|
||||
mFakeTaskView.animate().alpha(1).setListener(
|
||||
AnimatorListeners.forSuccessCallback(() -> mFakeTaskView.animate().cancel()));
|
||||
mFakePreviousTaskView.setFakeTaskViewFillColor(mContext.getResources().getColor(
|
||||
getMockPreviousAppTaskThumbnailColorResId()));
|
||||
mFakePreviousTaskView.setFakeTaskViewFillColor(getMockPreviousAppTaskThumbnailColor());
|
||||
mFakeIconView.setBackground(AppCompatResources.getDrawable(
|
||||
mContext, getMockAppIconResId()));
|
||||
|
||||
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
||||
mExitingAppView.setBackgroundColor(getExitingAppColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user