From 82b8aa561ace1b92323978eb08c26e2ce5b8274d Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 3 Feb 2023 10:15:50 -0800 Subject: [PATCH] Rename LauncherState QUICK_SWITCH to QUICK_SWITCH_FROM_HOME Test: compiles Bug: 265734073 Change-Id: I38e23c62b1eeae6a26db9c388655a8ffceb025b6 --- .../TaskbarLauncherStateController.java | 2 +- .../BaseRecentsViewStateController.java | 5 +++-- .../NoButtonQuickSwitchTouchController.java | 22 +++++++++---------- .../QuickSwitchTouchController.java | 6 ++--- .../quickstep/LauncherActivityInterface.java | 4 ++-- src/com/android/launcher3/LauncherState.java | 6 ++++- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 62f12936dd..7b7f7101c8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -277,7 +277,7 @@ import java.util.StringJoiner; boolean committed = !hasAnyFlag(FLAG_TRANSITION_STATE_RUNNING); playStateTransitionAnim(animatorSet, duration, committed); - if (committed && mLauncherState == LauncherState.QUICK_SWITCH) { + if (committed && mLauncherState == LauncherState.QUICK_SWITCH_FROM_HOME) { // We're about to be paused, set immediately to ensure seamless handoff. updateStateForFlag(FLAG_RESUMED, false); applyState(0 /* duration */); diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index 8fb70300f6..955440b49a 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides; +import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; @@ -167,12 +168,12 @@ public abstract class BaseRecentsViewStateController LauncherState fromState = mLauncher.getStateManager().getState(); setter.setFloat(mRecentsView, TASK_THUMBNAIL_SPLASH_ALPHA, toState.showTaskThumbnailSplash() ? 1f : 0f, - !toState.showTaskThumbnailSplash() && fromState == LauncherState.QUICK_SWITCH + !toState.showTaskThumbnailSplash() && fromState == QUICK_SWITCH_FROM_HOME ? LINEAR : INSTANT); boolean showAsGrid = toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()); Interpolator gridProgressInterpolator = showAsGrid - ? fromState == LauncherState.QUICK_SWITCH ? LINEAR : INSTANT + ? fromState == QUICK_SWITCH_FROM_HOME ? LINEAR : INSTANT : FINAL_FRAME; setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f, gridProgressInterpolator); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index e0cb0b4ddb..f78d9cf0eb 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -19,7 +19,7 @@ import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_ACTIONS; -import static com.android.launcher3.LauncherState.QUICK_SWITCH; +import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME; import static com.android.launcher3.anim.AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; import static com.android.launcher3.anim.Interpolators.ACCEL_0_75; @@ -195,7 +195,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, nonOverviewBuilder.setInterpolator(ANIM_WORKSPACE_SCALE, FADE_OUT_INTERPOLATOR); nonOverviewBuilder.setInterpolator(ANIM_DEPTH, FADE_OUT_INTERPOLATOR); nonOverviewBuilder.setInterpolator(ANIM_VERTICAL_PROGRESS, TRANSLATE_OUT_INTERPOLATOR); - updateNonOverviewAnim(QUICK_SWITCH, nonOverviewBuilder); + updateNonOverviewAnim(QUICK_SWITCH_FROM_HOME, nonOverviewBuilder); mNonOverviewAnim.dispatchOnStart(); if (mRecentsView.getTaskViewCount() == 0) { @@ -220,7 +220,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, } private void setupOverviewAnimators() { - final LauncherState fromState = QUICK_SWITCH; + final LauncherState fromState = QUICK_SWITCH_FROM_HOME; final LauncherState toState = OVERVIEW; // Set RecentView's initial properties. @@ -243,7 +243,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // Use QuickSwitchState instead of OverviewState to determine scrim color, // since we need to take potential taskbar into account. xAnim.setViewBackgroundColor(mLauncher.getScrimView(), - QUICK_SWITCH.getWorkspaceScrimColor(mLauncher), LINEAR); + QUICK_SWITCH_FROM_HOME.getWorkspaceScrimColor(mLauncher), LINEAR); if (mRecentsView.getTaskViewCount() == 0) { xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR); } @@ -335,24 +335,24 @@ public class NoButtonQuickSwitchTouchController implements TouchController, } else { if (velocity.y > 0) { // Flinging right and down goes to quick switch. - targetState = QUICK_SWITCH; + targetState = QUICK_SWITCH_FROM_HOME; } else { // Flinging up and right could go either home or to quick switch. // Determine the target based on the higher velocity. targetState = Math.abs(velocity.x) > Math.abs(velocity.y) - ? QUICK_SWITCH : NORMAL; + ? QUICK_SWITCH_FROM_HOME : NORMAL; } } } else if (horizontalFling) { - targetState = velocity.x > 0 ? QUICK_SWITCH : NORMAL; + targetState = velocity.x > 0 ? QUICK_SWITCH_FROM_HOME : NORMAL; } else if (verticalFling) { - targetState = velocity.y > 0 ? QUICK_SWITCH : NORMAL; + targetState = velocity.y > 0 ? QUICK_SWITCH_FROM_HOME : NORMAL; } else { // If user isn't flinging, just snap to the closest state. boolean passedHorizontalThreshold = mXOverviewAnim.getInterpolatedProgress() > 0.5f; boolean passedVerticalThreshold = mYOverviewAnim.value > 1f; targetState = passedHorizontalThreshold && !passedVerticalThreshold - ? QUICK_SWITCH : NORMAL; + ? QUICK_SWITCH_FROM_HOME : NORMAL; } // Animate the various components to the target state. @@ -414,7 +414,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, nonOverviewAnim.setFloatValues(startProgress, endProgress); mNonOverviewAnim.dispatchOnStart(); } - if (targetState == QUICK_SWITCH) { + if (targetState == QUICK_SWITCH_FROM_HOME) { // Navigating to quick switch, add scroll feedback since the first time is not // considered a scroll by the RecentsView. VibratorWrapper.INSTANCE.get(mLauncher).vibrate( @@ -437,7 +437,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, .withSrcState(LAUNCHER_STATE_HOME) .withDstState(targetState.statsLogOrdinal) .log(getLauncherAtomEvent(mStartState.statsLogOrdinal, targetState.statsLogOrdinal, - targetState == QUICK_SWITCH + targetState == QUICK_SWITCH_FROM_HOME ? LAUNCHER_QUICKSWITCH_RIGHT : targetState.ordinal > mStartState.ordinal ? LAUNCHER_UNKNOWN_SWIPEUP diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index 56ac4c5b3a..c5383c3042 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -16,7 +16,7 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.LauncherState.QUICK_SWITCH; +import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; @@ -87,7 +87,7 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll if ((stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0) { return NORMAL; } - return isDragTowardPositive ? QUICK_SWITCH : NORMAL; + return isDragTowardPositive ? QUICK_SWITCH_FROM_HOME : NORMAL; } @Override @@ -110,7 +110,7 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll // Set RecentView's initial properties for coming in from the side. RECENTS_SCALE_PROPERTY.set(mOverviewPanel, - QUICK_SWITCH.getOverviewScaleAndOffset(mLauncher)[0] * 0.85f); + QUICK_SWITCH_FROM_HOME.getOverviewScaleAndOffset(mLauncher)[0] * 0.85f); ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mOverviewPanel, 1f); mOverviewPanel.setContentAlpha(1); diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java index 710de8c810..89e8f51930 100644 --- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java @@ -18,7 +18,7 @@ package com.android.quickstep; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.QUICK_SWITCH; +import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; @@ -346,7 +346,7 @@ public final class LauncherActivityInterface extends case RECENTS: return OVERVIEW; case NEW_TASK: - return QUICK_SWITCH; + return QUICK_SWITCH_FROM_HOME; case LAST_TASK: return BACKGROUND_APP; case HOME: diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index b9e4c175e2..81fbe79cb2 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -131,7 +131,11 @@ public abstract class LauncherState implements BaseState { public static final LauncherState OVERVIEW = new OverviewState(OVERVIEW_STATE_ORDINAL); public static final LauncherState OVERVIEW_MODAL_TASK = OverviewState.newModalTaskState( OVERVIEW_MODAL_TASK_STATE_ORDINAL); - public static final LauncherState QUICK_SWITCH = + /** + * State when user performs a quickswitch gesture from home/workspace to the most recent + * app + */ + public static final LauncherState QUICK_SWITCH_FROM_HOME = OverviewState.newSwitchState(QUICK_SWITCH_STATE_ORDINAL); public static final LauncherState BACKGROUND_APP = OverviewState.newBackgroundState(BACKGROUND_APP_STATE_ORDINAL);