From 474f3c4e90bcf3f41f602a800521b02e2bd22f02 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 10 May 2023 14:53:18 -0700 Subject: [PATCH] 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 --- .../gesture_tutorial_back_step_shape.xml | 2 +- .../gesture_tutorial_home_step_shape.xml | 2 +- .../gesture_tutorial_overview_step_shape.xml | 2 +- .../gesture_tutorial_back_step_shape.xml | 2 +- .../gesture_tutorial_home_step_shape.xml | 2 +- .../gesture_tutorial_overview_step_shape.xml | 2 +- ...ture_tutorial_action_button_background.xml | 5 +- .../gesture_tutorial_back_step_shape.xml | 2 +- .../gesture_tutorial_home_step_shape.xml | 2 +- ..._tutorial_menu_back_button_background.xml} | 1 + ...e_tutorial_menu_home_button_background.xml | 20 ++++ ...torial_menu_overview_button_background.xml | 20 ++++ .../gesture_tutorial_overview_step_shape.xml | 2 +- quickstep/res/drawable/hotseat_icon_home.xml | 2 +- .../redesigned_default_sandbox_app_icon.xml | 2 +- .../res/drawable/redesigned_top_task_view.xml | 21 +++++ .../gesture_tutorial_step_menu.xml | 19 ++-- .../gesture_tutorial_mock_task_view.xml | 3 +- .../res/layout/gesture_tutorial_step_menu.xml | 19 ++-- .../redesigned_gesture_tutorial_fragment.xml | 6 +- .../swipe_up_gesture_tutorial_shape.xml | 3 +- quickstep/res/values-night/styles.xml | 57 ++++++++++- quickstep/res/values/attrs.xml | 18 ++++ quickstep/res/values/colors.xml | 11 --- quickstep/res/values/styles.xml | 94 +++++++++++++++---- .../BackGestureTutorialController.java | 31 +++++- .../HomeGestureTutorialController.java | 39 ++++++-- .../OverviewGestureTutorialController.java | 41 ++++++-- .../interaction/RootSandboxLayout.java | 59 +++++++++++- .../interaction/TutorialController.java | 63 ++++++++----- 30 files changed, 445 insertions(+), 107 deletions(-) rename quickstep/res/drawable/{gesture_tutorial_menu_button_background.xml => gesture_tutorial_menu_back_button_background.xml} (94%) create mode 100644 quickstep/res/drawable/gesture_tutorial_menu_home_button_background.xml create mode 100644 quickstep/res/drawable/gesture_tutorial_menu_overview_button_background.xml create mode 100644 quickstep/res/drawable/redesigned_top_task_view.xml diff --git a/quickstep/res/drawable-sw600dp-land/gesture_tutorial_back_step_shape.xml b/quickstep/res/drawable-sw600dp-land/gesture_tutorial_back_step_shape.xml index 0f2650b83f..a07aeaadcc 100644 --- a/quickstep/res/drawable-sw600dp-land/gesture_tutorial_back_step_shape.xml +++ b/quickstep/res/drawable-sw600dp-land/gesture_tutorial_back_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="208"> + android:fillColor="?attr/onSurfaceBack"/> diff --git a/quickstep/res/drawable-sw600dp-land/gesture_tutorial_home_step_shape.xml b/quickstep/res/drawable-sw600dp-land/gesture_tutorial_home_step_shape.xml index fd14d346fa..68397187cf 100644 --- a/quickstep/res/drawable-sw600dp-land/gesture_tutorial_home_step_shape.xml +++ b/quickstep/res/drawable-sw600dp-land/gesture_tutorial_home_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="67"> + android:fillColor="?attr/onSurfaceHome"/> diff --git a/quickstep/res/drawable-sw600dp-land/gesture_tutorial_overview_step_shape.xml b/quickstep/res/drawable-sw600dp-land/gesture_tutorial_overview_step_shape.xml index f271c47bbd..4111718ed9 100644 --- a/quickstep/res/drawable-sw600dp-land/gesture_tutorial_overview_step_shape.xml +++ b/quickstep/res/drawable-sw600dp-land/gesture_tutorial_overview_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="94"> + android:fillColor="?attr/onSurfaceOverview"/> diff --git a/quickstep/res/drawable-sw720dp-land/gesture_tutorial_back_step_shape.xml b/quickstep/res/drawable-sw720dp-land/gesture_tutorial_back_step_shape.xml index 02f6ff9e38..e20458e350 100644 --- a/quickstep/res/drawable-sw720dp-land/gesture_tutorial_back_step_shape.xml +++ b/quickstep/res/drawable-sw720dp-land/gesture_tutorial_back_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="303"> + android:fillColor="?attr/onSurfaceBack"/> diff --git a/quickstep/res/drawable-sw720dp-land/gesture_tutorial_home_step_shape.xml b/quickstep/res/drawable-sw720dp-land/gesture_tutorial_home_step_shape.xml index 3e71a3d85a..0c050ca852 100644 --- a/quickstep/res/drawable-sw720dp-land/gesture_tutorial_home_step_shape.xml +++ b/quickstep/res/drawable-sw720dp-land/gesture_tutorial_home_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="73"> + android:fillColor="?attr/onSurfaceHome"/> diff --git a/quickstep/res/drawable-sw720dp-land/gesture_tutorial_overview_step_shape.xml b/quickstep/res/drawable-sw720dp-land/gesture_tutorial_overview_step_shape.xml index 2f111927d4..d012897ed3 100644 --- a/quickstep/res/drawable-sw720dp-land/gesture_tutorial_overview_step_shape.xml +++ b/quickstep/res/drawable-sw720dp-land/gesture_tutorial_overview_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="144"> + android:fillColor="?attr/onSurfaceOverview"/> diff --git a/quickstep/res/drawable/gesture_tutorial_action_button_background.xml b/quickstep/res/drawable/gesture_tutorial_action_button_background.xml index 98dc1a5f78..e5f1a56699 100644 --- a/quickstep/res/drawable/gesture_tutorial_action_button_background.xml +++ b/quickstep/res/drawable/gesture_tutorial_action_button_background.xml @@ -13,7 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - + - + \ No newline at end of file diff --git a/quickstep/res/drawable/gesture_tutorial_back_step_shape.xml b/quickstep/res/drawable/gesture_tutorial_back_step_shape.xml index 5f951e42b4..938934073f 100644 --- a/quickstep/res/drawable/gesture_tutorial_back_step_shape.xml +++ b/quickstep/res/drawable/gesture_tutorial_back_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="208"> + android:fillColor="?attr/onSurfaceBack"/> diff --git a/quickstep/res/drawable/gesture_tutorial_home_step_shape.xml b/quickstep/res/drawable/gesture_tutorial_home_step_shape.xml index 698cba140b..f04a38ebb5 100644 --- a/quickstep/res/drawable/gesture_tutorial_home_step_shape.xml +++ b/quickstep/res/drawable/gesture_tutorial_home_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="66"> + android:fillColor="?attr/onSurfaceHome"/> diff --git a/quickstep/res/drawable/gesture_tutorial_menu_button_background.xml b/quickstep/res/drawable/gesture_tutorial_menu_back_button_background.xml similarity index 94% rename from quickstep/res/drawable/gesture_tutorial_menu_button_background.xml rename to quickstep/res/drawable/gesture_tutorial_menu_back_button_background.xml index 1ab776bd6e..f83ee7f66c 100644 --- a/quickstep/res/drawable/gesture_tutorial_menu_button_background.xml +++ b/quickstep/res/drawable/gesture_tutorial_menu_back_button_background.xml @@ -15,5 +15,6 @@ + diff --git a/quickstep/res/drawable/gesture_tutorial_menu_home_button_background.xml b/quickstep/res/drawable/gesture_tutorial_menu_home_button_background.xml new file mode 100644 index 0000000000..a0833ddc9a --- /dev/null +++ b/quickstep/res/drawable/gesture_tutorial_menu_home_button_background.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/quickstep/res/drawable/gesture_tutorial_menu_overview_button_background.xml b/quickstep/res/drawable/gesture_tutorial_menu_overview_button_background.xml new file mode 100644 index 0000000000..3d37f05379 --- /dev/null +++ b/quickstep/res/drawable/gesture_tutorial_menu_overview_button_background.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/quickstep/res/drawable/gesture_tutorial_overview_step_shape.xml b/quickstep/res/drawable/gesture_tutorial_overview_step_shape.xml index cc2c491ef3..97a129df0e 100644 --- a/quickstep/res/drawable/gesture_tutorial_overview_step_shape.xml +++ b/quickstep/res/drawable/gesture_tutorial_overview_step_shape.xml @@ -19,5 +19,5 @@ android:viewportHeight="76"> + android:fillColor="?attr/onSurfaceOverview"/> diff --git a/quickstep/res/drawable/hotseat_icon_home.xml b/quickstep/res/drawable/hotseat_icon_home.xml index d59dd4a88e..9ef4863a36 100644 --- a/quickstep/res/drawable/hotseat_icon_home.xml +++ b/quickstep/res/drawable/hotseat_icon_home.xml @@ -16,6 +16,6 @@ - + \ No newline at end of file diff --git a/quickstep/res/drawable/redesigned_default_sandbox_app_icon.xml b/quickstep/res/drawable/redesigned_default_sandbox_app_icon.xml index cb94d9a8fc..2ab6749aa3 100644 --- a/quickstep/res/drawable/redesigned_default_sandbox_app_icon.xml +++ b/quickstep/res/drawable/redesigned_default_sandbox_app_icon.xml @@ -13,5 +13,5 @@ --> - + diff --git a/quickstep/res/drawable/redesigned_top_task_view.xml b/quickstep/res/drawable/redesigned_top_task_view.xml new file mode 100644 index 0000000000..2c136def5e --- /dev/null +++ b/quickstep/res/drawable/redesigned_top_task_view.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/quickstep/res/layout-sw600dp-land/gesture_tutorial_step_menu.xml b/quickstep/res/layout-sw600dp-land/gesture_tutorial_step_menu.xml index d24219d253..b13e8dc0ba 100644 --- a/quickstep/res/layout-sw600dp-land/gesture_tutorial_step_menu.xml +++ b/quickstep/res/layout-sw600dp-land/gesture_tutorial_step_menu.xml @@ -15,13 +15,15 @@ --> + android:background="?androidprv:attr/materialColorSurfaceContainer"> \ No newline at end of file + android:background="?attr/onSurfaceOverview" /> \ No newline at end of file diff --git a/quickstep/res/layout/gesture_tutorial_step_menu.xml b/quickstep/res/layout/gesture_tutorial_step_menu.xml index cf1e4d7b9c..7a302f437b 100644 --- a/quickstep/res/layout/gesture_tutorial_step_menu.xml +++ b/quickstep/res/layout/gesture_tutorial_step_menu.xml @@ -15,22 +15,23 @@ --> + android:background="?attr/surfaceHome" /> diff --git a/quickstep/res/values-night/styles.xml b/quickstep/res/values-night/styles.xml index e6b345010d..ed0bd5bc1b 100644 --- a/quickstep/res/values-night/styles.xml +++ b/quickstep/res/values-night/styles.xml @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/quickstep/res/values/attrs.xml b/quickstep/res/values/attrs.xml index f1d4dabf25..fb51919b57 100644 --- a/quickstep/res/values/attrs.xml +++ b/quickstep/res/values/attrs.xml @@ -28,4 +28,22 @@ + + + + + + + + + + + + + + + diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml index f69db49042..c84c5186ec 100644 --- a/quickstep/res/values/colors.xml +++ b/quickstep/res/values/colors.xml @@ -42,17 +42,6 @@ #3C4043 #E8EAED - - #FFAD91 - #4B64AE - #DBF59E - #F9A2B9 - #217500 - #DFF3AF - #7E44AD - #CABCD6 - #1C1B1F - #BDC1C6 #3C4043 diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml index ead5343ea4..6915417841 100644 --- a/quickstep/res/values/styles.xml +++ b/quickstep/res/values/styles.xml @@ -18,10 +18,10 @@ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - diff --git a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java index ab76fb422e..93dd4e6f4d 100644 --- a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java @@ -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 diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java index 0497f0a200..1c8750a3ad 100644 --- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java @@ -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 diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java index c5d0ebebe9..f280dec1c3 100644 --- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java @@ -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(); } } diff --git a/quickstep/src/com/android/quickstep/interaction/RootSandboxLayout.java b/quickstep/src/com/android/quickstep/interaction/RootSandboxLayout.java index b5084843b8..affedb9497 100644 --- a/quickstep/src/com/android/quickstep/interaction/RootSandboxLayout.java +++ b/quickstep/src/com/android/quickstep/interaction/RootSandboxLayout.java @@ -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 diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java index 198305fe04..22116e12cf 100644 --- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java @@ -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()); + } } }