From 7ebb54f24e3dfd2cae23b2cb0612539d5235f71a Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 12 Jun 2023 12:55:54 -0700 Subject: [PATCH] Polish redesgined tutorial home and overview animations - Added a 6th hotseat icon to the tablet and unfolded foldable - not animating the previous task view when animating to hotseat from the home step - updating the first hotseat icon's color and visibility at the correct times - cross fading the animating task view and hotseat icon's color Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL Fixes: 283967613 Test: ran the tutorial on handheld, tablet and foldable with ENABLE_NEW_GESTURE_NAV_TUTORIAL true and false Merged-In: I7a76646ca71502e924f45bba76d72be17d31249d Change-Id: I7a76646ca71502e924f45bba76d72be17d31249d --- ...d_gesture_tutorial_tablet_mock_hotseat.xml | 9 +++++- ...gesture_tutorial_foldable_mock_hotseat.xml | 10 ++++++- ...d_gesture_tutorial_tablet_mock_hotseat.xml | 10 ++++++- .../HomeGestureTutorialController.java | 2 +- .../SwipeUpGestureTutorialController.java | 28 +++++++++++++++++++ .../interaction/TutorialController.java | 3 +- 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/quickstep/res/layout-land/redesigned_gesture_tutorial_tablet_mock_hotseat.xml b/quickstep/res/layout-land/redesigned_gesture_tutorial_tablet_mock_hotseat.xml index 850f6e3c5a..4f1fabe538 100644 --- a/quickstep/res/layout-land/redesigned_gesture_tutorial_tablet_mock_hotseat.xml +++ b/quickstep/res/layout-land/redesigned_gesture_tutorial_tablet_mock_hotseat.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" app:constraint_referenced_ids="hotseat_search_bar, hotseat_icon_1, hotseat_icon_2, - hotseat_icon_3, hotseat_icon_4, hotseat_icon_5" + hotseat_icon_3, hotseat_icon_4, hotseat_icon_5, hotseat_icon_6" app:flow_horizontalStyle="spread" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -77,4 +77,11 @@ android:background="@drawable/redesigned_hotseat_icon" android:clipToOutline="true" /> + + \ No newline at end of file diff --git a/quickstep/res/layout/redesigned_gesture_tutorial_foldable_mock_hotseat.xml b/quickstep/res/layout/redesigned_gesture_tutorial_foldable_mock_hotseat.xml index 821628ac62..154ca1af62 100644 --- a/quickstep/res/layout/redesigned_gesture_tutorial_foldable_mock_hotseat.xml +++ b/quickstep/res/layout/redesigned_gesture_tutorial_foldable_mock_hotseat.xml @@ -40,7 +40,8 @@ android:layout_marginTop="@dimen/gesture_tutorial_hotseat_icon_search_margin" app:constraint_referenced_ids= - "hotseat_icon_1, hotseat_icon_2, hotseat_icon_3, hotseat_icon_4, hotseat_icon_5" + "hotseat_icon_1, hotseat_icon_2, hotseat_icon_3, hotseat_icon_4, hotseat_icon_5, + hotseat_icon_6" app:flow_horizontalStyle="spread_inside" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -81,4 +82,11 @@ android:background="@drawable/redesigned_hotseat_icon" android:clipToOutline="true" /> + + \ No newline at end of file diff --git a/quickstep/res/layout/redesigned_gesture_tutorial_tablet_mock_hotseat.xml b/quickstep/res/layout/redesigned_gesture_tutorial_tablet_mock_hotseat.xml index 821628ac62..154ca1af62 100644 --- a/quickstep/res/layout/redesigned_gesture_tutorial_tablet_mock_hotseat.xml +++ b/quickstep/res/layout/redesigned_gesture_tutorial_tablet_mock_hotseat.xml @@ -40,7 +40,8 @@ android:layout_marginTop="@dimen/gesture_tutorial_hotseat_icon_search_margin" app:constraint_referenced_ids= - "hotseat_icon_1, hotseat_icon_2, hotseat_icon_3, hotseat_icon_4, hotseat_icon_5" + "hotseat_icon_1, hotseat_icon_2, hotseat_icon_3, hotseat_icon_4, hotseat_icon_5, + hotseat_icon_6" app:flow_horizontalStyle="spread_inside" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -81,4 +82,11 @@ android:background="@drawable/redesigned_hotseat_icon" android:clipToOutline="true" /> + + \ No newline at end of file diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java index 333ecbbb2c..ebfa5591b7 100644 --- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java @@ -185,7 +185,7 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll showFeedback(R.string.home_gesture_feedback_swipe_too_far_from_edge); break; case OVERVIEW_GESTURE_COMPLETED: - fadeOutFakeTaskView(true, () -> { + fadeOutFakeTaskView(false, () -> { showFeedback(R.string.home_gesture_feedback_overview_detected); showFakeTaskbar(/* animateFromHotseat= */ false); }); diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java index f1cbfcc613..558d5dc238 100644 --- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java @@ -15,6 +15,9 @@ */ package com.android.quickstep.interaction; +import static android.view.View.INVISIBLE; +import static android.view.View.VISIBLE; + import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION; @@ -38,6 +41,7 @@ import android.view.ViewOutlineProvider; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.graphics.ColorUtils; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; @@ -46,6 +50,7 @@ import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; +import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.GestureState; import com.android.quickstep.OverviewComponentObserver; import com.android.quickstep.RecentsAnimationDeviceState; @@ -125,6 +130,9 @@ abstract class SwipeUpGestureTutorialController extends TutorialController { void resetTaskViews() { mFakeHotseatView.setVisibility(View.INVISIBLE); mFakeIconView.setVisibility(View.INVISIBLE); + if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) { + mFakeIconView.getBackground().setTint(getFakeTaskViewColor()); + } if (mTutorialFragment.getActivity() != null) { int height = mTutorialFragment.getRootView().getFullscreenHeight(); int width = mTutorialFragment.getRootView().getWidth(); @@ -133,6 +141,9 @@ abstract class SwipeUpGestureTutorialController extends TutorialController { mFakeTaskViewRadius = 0; mFakeTaskView.invalidateOutline(); mFakeTaskView.setVisibility(View.VISIBLE); + if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) { + mFakeTaskView.setBackgroundColor(getFakeTaskViewColor()); + } mFakeTaskView.setAlpha(1); mFakePreviousTaskView.setVisibility(View.INVISIBLE); mFakePreviousTaskView.setAlpha(1); @@ -250,6 +261,17 @@ abstract class SwipeUpGestureTutorialController extends TutorialController { // After home animation finishes, fade out and run onEndRunnable. PendingAnimation fadeAnim = new PendingAnimation(300); fadeAnim.setViewAlpha(mFakeIconView, 0, ACCEL); + final View hotseatIconView = mHotseatIconView; + if (hotseatIconView != null) { + hotseatIconView.setVisibility(INVISIBLE); + fadeAnim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); + hotseatIconView.setVisibility(VISIBLE); + } + }); + } if (onEndRunnable != null) { fadeAnim.addListener(AnimatorListeners.forSuccessCallback(onEndRunnable)); } @@ -371,6 +393,12 @@ abstract class SwipeUpGestureTutorialController extends TutorialController { false, /* isOpening */ mFakeIconView, mDp); mFakeIconView.setAlpha(1); + if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) { + int iconColor = ColorUtils.blendARGB( + getFakeTaskViewColor(), getHotseatIconColor(), progress); + mFakeIconView.getBackground().setTint(iconColor); + mFakeTaskView.setBackgroundColor(iconColor); + } mFakeTaskView.setAlpha(getWindowAlpha(progress)); mFakePreviousTaskView.setAlpha(getWindowAlpha(progress)); } diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java index a58f4538c8..178d75b2c6 100644 --- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java @@ -715,11 +715,12 @@ abstract class TutorialController implements BackGestureAttemptCallback, if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) { mExitingAppView.setBackgroundColor(getExitingAppColor()); mFakeTaskView.setBackgroundColor(getFakeTaskViewColor()); - updateHotseatChildViewColor(mFakeIconView); + updateHotseatChildViewColor(mHotseatIconView); updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_2)); updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_3)); updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_4)); updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_5)); + updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_6)); updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_search_bar)); } else { updateFakeViewLayout(mFakeTaskView, getMockAppTaskLayoutResId());