Merge "Rename LauncherState QUICK_SWITCH to QUICK_SWITCH_FROM_HOME" into tm-qpr-dev am: 05dbd1aab8

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21266928

Change-Id: I76af8155fed13733aea785e119b6b1b21e888ac7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vinit Nayak
2023-02-06 19:38:31 +00:00
committed by Automerger Merge Worker
6 changed files with 25 additions and 20 deletions

View File

@@ -281,7 +281,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 */);

View File

@@ -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<T extends RecentsView>
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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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:

View File

@@ -131,7 +131,11 @@ public abstract class LauncherState implements BaseState<LauncherState> {
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);