Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c5472ff authored by Saumya Prakash's avatar Saumya Prakash
Browse files

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
parent a40de23f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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:
+2 −0
Original line number Diff line number Diff line
@@ -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:
+22 −18
Original line number Diff line number Diff line
@@ -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) {