From 5c5472ff96597e3a57f4217656462ee28601f405 Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Tue, 9 May 2023 21:21:53 +0000 Subject: [PATCH] Fix UI issues of fake task view in gesture nav tutorial. This change fixes the bug where the view for the fake task in the overview gesture was not being reset correctly. This was leading to UI issues such as lack of rounded corners and incorrect animations in the gesture navigation tutorial. Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL Fix: 281121451 Fix: 281121699 Fix: 281785378 Test: Manually went through the tutorial on handheld, foldable, and tablet devices Change-Id: I424a471013d2b8667724f790618d142ba7ae9a7b --- .../HomeGestureTutorialController.java | 2 + .../OverviewGestureTutorialController.java | 2 + .../SwipeUpGestureTutorialController.java | 40 ++++++++++--------- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java index 11c9e373eb..0497f0a200 100644 --- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java @@ -106,6 +106,7 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll case BACK_CANCELLED_FROM_LEFT: case BACK_CANCELLED_FROM_RIGHT: case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE: + resetTaskView(); showFeedback(R.string.home_gesture_feedback_swipe_too_far_from_edge); break; } @@ -135,6 +136,7 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll } case HOME_NOT_STARTED_TOO_FAR_FROM_EDGE: case OVERVIEW_NOT_STARTED_TOO_FAR_FROM_EDGE: + resetTaskView(); showFeedback(R.string.home_gesture_feedback_swipe_too_far_from_edge); break; case OVERVIEW_GESTURE_COMPLETED: diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java index dfbcf4d14a..4a0512e636 100644 --- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialController.java @@ -112,6 +112,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont case BACK_CANCELLED_FROM_LEFT: case BACK_CANCELLED_FROM_RIGHT: case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE: + resetTaskView(); showFeedback(R.string.overview_gesture_feedback_swipe_too_far_from_edge); break; } @@ -142,6 +143,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont } case HOME_NOT_STARTED_TOO_FAR_FROM_EDGE: case OVERVIEW_NOT_STARTED_TOO_FAR_FROM_EDGE: + resetTaskView(); showFeedback(R.string.overview_gesture_feedback_swipe_too_far_from_edge); break; case OVERVIEW_GESTURE_COMPLETED: diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java index a8af05e7d8..6d29cb6074 100644 --- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java +++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java @@ -61,7 +61,7 @@ import com.android.quickstep.util.TransformParams; @TargetApi(Build.VERSION_CODES.R) abstract class SwipeUpGestureTutorialController extends TutorialController { - private static final int FAKE_PREVIOUS_TASK_MARGIN = Utilities.dpToPx(12); + private static final int FAKE_PREVIOUS_TASK_MARGIN = Utilities.dpToPx(24); protected static final long TASK_VIEW_END_ANIMATION_DURATION_MILLIS = 300; private static final long HOME_SWIPE_ANIMATION_DURATION_MILLIS = 625; @@ -77,23 +77,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController { private final AnimatorListenerAdapter mResetTaskView = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mFakeHotseatView.setVisibility(View.INVISIBLE); - mFakeIconView.setVisibility(View.INVISIBLE); - if (mTutorialFragment.getActivity() != null) { - int height = mTutorialFragment.getRootView().getFullscreenHeight(); - int width = mTutorialFragment.getRootView().getWidth(); - mFakeTaskViewRect.set(0, 0, width, height); - } - mFakeTaskViewRadius = 0; - mFakeTaskView.invalidateOutline(); - mFakeTaskView.setVisibility(View.VISIBLE); - mFakeTaskView.setAlpha(1); - mFakePreviousTaskView.setVisibility(View.INVISIBLE); - mFakePreviousTaskView.setAlpha(1); - mFakePreviousTaskView.setToSingleRowLayout(false); - mShowTasks = false; - mShowPreviousTasks = false; - mRunningWindowAnim = null; + resetTaskView(); } }; @@ -137,6 +121,26 @@ abstract class SwipeUpGestureTutorialController extends TutorialController { mRunningWindowAnim = null; } + void resetTaskView() { + mFakeHotseatView.setVisibility(View.INVISIBLE); + mFakeIconView.setVisibility(View.INVISIBLE); + if (mTutorialFragment.getActivity() != null) { + int height = mTutorialFragment.getRootView().getFullscreenHeight(); + int width = mTutorialFragment.getRootView().getWidth(); + mFakeTaskViewRect.set(0, 0, width, height); + } + mFakeTaskViewRadius = 0; + mFakeTaskView.invalidateOutline(); + mFakeTaskView.setVisibility(View.VISIBLE); + mFakeTaskView.setAlpha(1); + mFakePreviousTaskView.setVisibility(View.INVISIBLE); + mFakePreviousTaskView.setAlpha(1); + mFakePreviousTaskView.setToSingleRowLayout(false); + mShowTasks = false; + mShowPreviousTasks = false; + mRunningWindowAnim = null; + } + /** Fades the task view, optionally after animating to a fake Overview. */ void fadeOutFakeTaskView(boolean toOverviewFirst, boolean reset, @Nullable Runnable onEndRunnable) {