Merge changes I9749124a,Ic59b877c,Ibe8734e8 into sc-dev
* changes: Fix running task damped by overscroll when other tasks are offscreen When overview appears from motion pause, come up from bottom Align home/back button from overview with tap outside
This commit is contained in:
@@ -19,6 +19,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.FLAG_HIDE_BACK_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.NO_OFFSET;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
|
||||
@@ -343,7 +344,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
@Override
|
||||
public float[] getNormalOverviewScaleAndOffset() {
|
||||
return SysUINavigationMode.getMode(this).hasGestures
|
||||
? new float[] {1, 1} : new float[] {1.1f, 0};
|
||||
? new float[] {1, NO_OFFSET, 1} : new float[] {1.1f, NO_OFFSET, NO_OFFSET};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,8 +22,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FA
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_VERTICAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION;
|
||||
@@ -62,7 +64,8 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
public void setState(@NonNull LauncherState state) {
|
||||
float[] scaleAndOffset = state.getOverviewScaleAndOffset(mLauncher);
|
||||
RECENTS_SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]);
|
||||
ADJACENT_PAGE_OFFSET.set(mRecentsView, scaleAndOffset[1]);
|
||||
ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, scaleAndOffset[1]);
|
||||
ADJACENT_PAGE_VERTICAL_OFFSET.set(mRecentsView, scaleAndOffset[2]);
|
||||
TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f);
|
||||
|
||||
getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0);
|
||||
@@ -92,8 +95,10 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
float[] scaleAndOffset = toState.getOverviewScaleAndOffset(mLauncher);
|
||||
setter.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0],
|
||||
config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR));
|
||||
setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1],
|
||||
setter.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1],
|
||||
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
|
||||
setter.setFloat(mRecentsView, ADJACENT_PAGE_VERTICAL_OFFSET, scaleAndOffset[2],
|
||||
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
|
||||
PagedOrientationHandler orientationHandler =
|
||||
((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
|
||||
FloatProperty taskViewsFloat = orientationHandler.getSplitSelectTaskOffset(
|
||||
|
||||
@@ -83,11 +83,6 @@ public class AllAppsState extends LauncherState {
|
||||
return ALL_APPS_CONTENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getOverviewScaleAndOffset(Launcher launcher) {
|
||||
return new float[] {0.9f, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public LauncherState getHistoryForState(LauncherState previousState) {
|
||||
return previousState == OVERVIEW ? OVERVIEW : NORMAL;
|
||||
|
||||
@@ -96,6 +96,6 @@ public class BackgroundAppState extends OverviewState {
|
||||
BaseDraggingActivity activity) {
|
||||
return new float[] {
|
||||
((RecentsView) activity.getOverviewPanel()).getMaxScaleForFullScreen(),
|
||||
NO_OFFSET};
|
||||
NO_OFFSET, NO_OFFSET};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ public class OverviewModalTaskState extends OverviewState {
|
||||
float scale = Math.min((float) modalTaskSize.height() / taskSize.y,
|
||||
(float) modalTaskSize.width() / taskSize.x);
|
||||
|
||||
return new float[] {scale, NO_OFFSET};
|
||||
return new float[] {scale, NO_OFFSET, NO_OFFSET};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.android.launcher3.uioverrides.states;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -60,9 +59,8 @@ public class OverviewState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
// In no-button mode, overview comes in all the way from the left, so give it more time.
|
||||
boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(context).getMode() == NO_BUTTON;
|
||||
return isNoButtonMode ? 380 : 250;
|
||||
// In gesture modes, overview comes in all the way from the bottom, so give it more time.
|
||||
return SysUINavigationMode.INSTANCE.get(context).getMode().hasGestures ? 380 : 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,7 +78,7 @@ public class OverviewState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public float[] getOverviewScaleAndOffset(Launcher launcher) {
|
||||
return new float[] {NO_SCALE, NO_OFFSET};
|
||||
return new float[] {NO_SCALE, NO_OFFSET, NO_OFFSET};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+42
-29
@@ -23,34 +23,34 @@ import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.WorkspaceStateTransitionAnimation.getSpringScaleAnimator;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
|
||||
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
|
||||
import static com.android.launcher3.anim.Interpolators.INSTANT;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
|
||||
import static com.android.launcher3.anim.Interpolators.clampToProgress;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.allapps.AllAppsContainerView;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
@@ -65,6 +65,12 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
|
||||
// Scale recents takes before animating in
|
||||
private static final float RECENTS_PREPARE_SCALE = 1.33f;
|
||||
// Scale workspace takes before animating in
|
||||
private static final float WORKSPACE_PREPARE_SCALE_GESTURES = 0.97f;
|
||||
private static final float WORKSPACE_PREPARE_SCALE_BUTTONS = 0.92f;
|
||||
// When the overview to home transition reaches this percentage, immediately hide overview and
|
||||
// start animating away the scrim and animating in workspace.
|
||||
private static final float OVERVIEW_TO_HOME_HARD_HAND_OFF = 0.4f;
|
||||
|
||||
// Due to use of physics, duration may differ between devices so we need to calculate and
|
||||
// cache the value.
|
||||
@@ -79,21 +85,31 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
StateAnimationConfig config) {
|
||||
RecentsView overview = mActivity.getOverviewPanel();
|
||||
if (toState == NORMAL && fromState == OVERVIEW) {
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL);
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, ACCEL);
|
||||
config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
|
||||
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL_DEACCEL);
|
||||
|
||||
if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) {
|
||||
// Scrolling in tasks, so make visible straight away
|
||||
if (overview.getTaskViewCount() > 0) {
|
||||
config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME);
|
||||
} else {
|
||||
config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
|
||||
}
|
||||
final float workspacePrepareScale;
|
||||
if (SysUINavigationMode.getMode(mActivity).hasGestures
|
||||
&& overview.getTaskViewCount() > 0) {
|
||||
workspacePrepareScale = WORKSPACE_PREPARE_SCALE_GESTURES;
|
||||
// Overview is going offscreen, so keep it at its current scale and opacity.
|
||||
config.setInterpolator(ANIM_OVERVIEW_SCALE, FINAL_FRAME);
|
||||
config.setInterpolator(ANIM_OVERVIEW_FADE, clampToProgress(
|
||||
FINAL_FRAME, 0f, OVERVIEW_TO_HOME_HARD_HAND_OFF));
|
||||
config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(
|
||||
DEACCEL, 0f, OVERVIEW_TO_HOME_HARD_HAND_OFF));
|
||||
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, AGGRESSIVE_EASE_IN_OUT);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, clampToProgress(
|
||||
DEACCEL, OVERVIEW_TO_HOME_HARD_HAND_OFF, 1f));
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, clampToProgress(
|
||||
DEACCEL, OVERVIEW_TO_HOME_HARD_HAND_OFF, 1f));
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, clampToProgress(
|
||||
INSTANT, OVERVIEW_TO_HOME_HARD_HAND_OFF, 1f));
|
||||
} else {
|
||||
workspacePrepareScale = WORKSPACE_PREPARE_SCALE_BUTTONS;
|
||||
config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
|
||||
config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
|
||||
config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, LINEAR);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, LINEAR);
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL);
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
|
||||
}
|
||||
|
||||
Workspace workspace = mActivity.getWorkspace();
|
||||
@@ -106,25 +122,18 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
&& currentChild.getShortcutsAndWidgets().getAlpha() > 0;
|
||||
}
|
||||
if (!isWorkspaceVisible) {
|
||||
workspace.setScaleX(0.92f);
|
||||
workspace.setScaleY(0.92f);
|
||||
workspace.setScaleX(workspacePrepareScale);
|
||||
workspace.setScaleY(workspacePrepareScale);
|
||||
}
|
||||
Hotseat hotseat = mActivity.getHotseat();
|
||||
boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0;
|
||||
if (!isHotseatVisible) {
|
||||
hotseat.setScaleX(0.92f);
|
||||
hotseat.setScaleY(0.92f);
|
||||
AllAppsContainerView qsbContainer = mActivity.getAppsView();
|
||||
View qsb = qsbContainer.getSearchView();
|
||||
boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0;
|
||||
if (!qsbVisible) {
|
||||
qsbContainer.setScaleX(0.92f);
|
||||
qsbContainer.setScaleY(0.92f);
|
||||
}
|
||||
hotseat.setScaleX(workspacePrepareScale);
|
||||
hotseat.setScaleY(workspacePrepareScale);
|
||||
}
|
||||
} else if ((fromState == NORMAL || fromState == HINT_STATE
|
||||
|| fromState == HINT_STATE_TWO_BUTTON) && toState == OVERVIEW) {
|
||||
if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) {
|
||||
if (SysUINavigationMode.getMode(mActivity).hasGestures) {
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE,
|
||||
fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
|
||||
config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
|
||||
@@ -148,6 +157,10 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, OVERSHOOT_1_2);
|
||||
config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
|
||||
config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, t -> {
|
||||
// Animate at the same rate until reaching progress 1, and skip the overshoot.
|
||||
return Math.min(1, OVERSHOOT_1_2.getInterpolation(t));
|
||||
});
|
||||
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_2);
|
||||
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, OVERSHOOT_1_2);
|
||||
} else if (fromState == HINT_STATE && toState == NORMAL) {
|
||||
|
||||
+5
-3
@@ -41,7 +41,8 @@ import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT;
|
||||
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_VERTICAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
|
||||
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
@@ -221,7 +222,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
||||
|
||||
// Set RecentView's initial properties.
|
||||
RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]);
|
||||
ADJACENT_PAGE_OFFSET.set(mRecentsView, 1f);
|
||||
ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, 1f);
|
||||
ADJACENT_PAGE_VERTICAL_OFFSET.set(mRecentsView, 0f);
|
||||
mRecentsView.setContentAlpha(1);
|
||||
mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress());
|
||||
mLauncher.getActionsView().getVisibilityAlpha().setValue(
|
||||
@@ -233,7 +235,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
||||
// - OverviewScrim
|
||||
// - RecentsView fade (if it's empty)
|
||||
PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2));
|
||||
xAnim.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], LINEAR);
|
||||
xAnim.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], LINEAR);
|
||||
xAnim.setViewBackgroundColor(mLauncher.getScrimView(),
|
||||
toState.getWorkspaceScrimColor(mLauncher), LINEAR);
|
||||
if (mRecentsView.getTaskViewCount() == 0) {
|
||||
|
||||
+11
@@ -30,6 +30,9 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PR
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
|
||||
import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_VERTICAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
|
||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
|
||||
@@ -105,6 +108,14 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll
|
||||
StateAnimationConfig config = new StateAnimationConfig();
|
||||
setupInterpolators(config);
|
||||
config.duration = (long) (getShiftRange() * 2);
|
||||
|
||||
// Set RecentView's initial properties for coming in from the side.
|
||||
RECENTS_SCALE_PROPERTY.set(mOverviewPanel,
|
||||
QUICK_SWITCH.getOverviewScaleAndOffset(mLauncher)[0] * 0.85f);
|
||||
ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mOverviewPanel, 1f);
|
||||
ADJACENT_PAGE_VERTICAL_OFFSET.set(mOverviewPanel, 0f);
|
||||
mOverviewPanel.setContentAlpha(1);
|
||||
|
||||
mCurrentAnimation = mLauncher.getStateManager()
|
||||
.createAnimationToNewWorkspace(mToState, config);
|
||||
mCurrentAnimation.getTarget().addListener(mClearStateOnCancelListener);
|
||||
|
||||
@@ -23,8 +23,8 @@ import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION;
|
||||
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
|
||||
import static com.android.quickstep.SysUINavigationMode.getMode;
|
||||
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM;
|
||||
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
|
||||
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_Y_ANIM;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_VERTICAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
|
||||
@@ -469,17 +469,17 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
float fromTranslation = attached ? 1 : 0;
|
||||
float toTranslation = attached ? 0 : 1;
|
||||
mActivity.getStateManager()
|
||||
.cancelStateElementAnimation(INDEX_RECENTS_TRANSLATE_X_ANIM);
|
||||
.cancelStateElementAnimation(INDEX_RECENTS_TRANSLATE_Y_ANIM);
|
||||
if (!recentsView.isShown() && animate) {
|
||||
ADJACENT_PAGE_OFFSET.set(recentsView, fromTranslation);
|
||||
ADJACENT_PAGE_VERTICAL_OFFSET.set(recentsView, fromTranslation);
|
||||
} else {
|
||||
fromTranslation = ADJACENT_PAGE_OFFSET.get(recentsView);
|
||||
fromTranslation = ADJACENT_PAGE_VERTICAL_OFFSET.get(recentsView);
|
||||
}
|
||||
if (!animate) {
|
||||
ADJACENT_PAGE_OFFSET.set(recentsView, toTranslation);
|
||||
ADJACENT_PAGE_VERTICAL_OFFSET.set(recentsView, toTranslation);
|
||||
} else {
|
||||
mActivity.getStateManager().createStateElementAnimation(
|
||||
INDEX_RECENTS_TRANSLATE_X_ANIM,
|
||||
INDEX_RECENTS_TRANSLATE_Y_ANIM,
|
||||
fromTranslation, toTranslation).start();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_VERTICAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
@@ -86,8 +87,10 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
|
||||
float[] scaleAndOffset = state.getOverviewScaleAndOffset(mActivity);
|
||||
setter.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0],
|
||||
config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR));
|
||||
setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1],
|
||||
setter.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1],
|
||||
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
|
||||
setter.setFloat(mRecentsView, ADJACENT_PAGE_VERTICAL_OFFSET, scaleAndOffset[2],
|
||||
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
|
||||
setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f,
|
||||
config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public class RecentsState implements BaseState<RecentsState> {
|
||||
}
|
||||
|
||||
public float[] getOverviewScaleAndOffset(RecentsActivity activity) {
|
||||
return new float[] { NO_SCALE, NO_OFFSET };
|
||||
return new float[] { NO_SCALE, NO_OFFSET, NO_OFFSET };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +170,7 @@ public class RecentsState implements BaseState<RecentsState> {
|
||||
|
||||
@Override
|
||||
public float[] getOverviewScaleAndOffset(RecentsActivity activity) {
|
||||
return new float[] { NO_SCALE, 1 };
|
||||
return new float[] { NO_SCALE, NO_OFFSET, 1 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,44 +17,26 @@ package com.android.quickstep.util;
|
||||
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
||||
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.anim.Interpolators.clampToProgress;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.util.Log;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
|
||||
/**
|
||||
* Runs an animation from overview to home. Currently, this animation is just a wrapper around the
|
||||
* normal state transition, in order to keep RecentsView at the same scale and translationY that
|
||||
* it started out at as it translates offscreen. It also scrolls RecentsView to page 0 and may play
|
||||
* a {@link StaggeredWorkspaceAnim} if we're starting from an upward fling.
|
||||
* normal state transition and may play a {@link StaggeredWorkspaceAnim} if we're starting from an
|
||||
* upward fling.
|
||||
*/
|
||||
public class OverviewToHomeAnim {
|
||||
|
||||
private static final String TAG = "OverviewToHomeAnim";
|
||||
|
||||
// Constants to specify how to scroll RecentsView to the default page if it's not already there.
|
||||
private static final int DEFAULT_PAGE = 0;
|
||||
private static final int PER_PAGE_SCROLL_DURATION = 150;
|
||||
private static final int MAX_PAGE_SCROLL_DURATION = 750;
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private final Runnable mOnReachedHome;
|
||||
|
||||
@@ -95,24 +77,8 @@ public class OverviewToHomeAnim {
|
||||
mIsHomeStaggeredAnimFinished = true;
|
||||
}
|
||||
|
||||
RecentsView recentsView = mLauncher.getOverviewPanel();
|
||||
int numPagesToScroll = recentsView.getNextPage() - DEFAULT_PAGE;
|
||||
int scrollDuration = Math.min(MAX_PAGE_SCROLL_DURATION,
|
||||
numPagesToScroll * PER_PAGE_SCROLL_DURATION);
|
||||
int duration = Math.max(scrollDuration, startState.getTransitionDuration(mLauncher));
|
||||
|
||||
StateAnimationConfig config = new UseFirstInterpolatorStateAnimConfig();
|
||||
config.duration = duration;
|
||||
boolean isLayoutNaturalToLauncher = recentsView.getPagedOrientationHandler()
|
||||
.isLayoutNaturalToLauncher();
|
||||
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, isLayoutNaturalToLauncher
|
||||
? clampToProgress(FAST_OUT_SLOW_IN, 0, 0.75f) : FINAL_FRAME);
|
||||
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, FINAL_FRAME);
|
||||
config.setInterpolator(ANIM_OVERVIEW_SCALE, FINAL_FRAME);
|
||||
config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, LINEAR);
|
||||
if (!isLayoutNaturalToLauncher) {
|
||||
config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL);
|
||||
}
|
||||
StateAnimationConfig config = new StateAnimationConfig();
|
||||
config.duration = startState.getTransitionDuration(mLauncher);
|
||||
AnimatorSet stateAnim = stateManager.createAtomicAnimation(
|
||||
startState, NORMAL, config);
|
||||
stateAnim.addListener(new AnimationSuccessListener() {
|
||||
@@ -125,7 +91,6 @@ public class OverviewToHomeAnim {
|
||||
anim.play(stateAnim);
|
||||
stateManager.setCurrentAnimation(anim, NORMAL);
|
||||
anim.start();
|
||||
recentsView.snapToPage(DEFAULT_PAGE, duration);
|
||||
}
|
||||
|
||||
private void maybeOverviewToHomeAnimComplete() {
|
||||
@@ -133,17 +98,4 @@ public class OverviewToHomeAnim {
|
||||
mOnReachedHome.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around StateAnimationConfig that doesn't allow interpolators to be set if they are
|
||||
* already set. This ensures they aren't overridden before being used.
|
||||
*/
|
||||
private static class UseFirstInterpolatorStateAnimConfig extends StateAnimationConfig {
|
||||
@Override
|
||||
public void setInterpolator(int animId, Interpolator interpolator) {
|
||||
if (mInterpolators[animId] == null || interpolator == null) {
|
||||
super.setInterpolator(animId, interpolator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_VERTICAL_OFFSET;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
|
||||
import androidx.dynamicanimation.animation.DynamicAnimation;
|
||||
|
||||
import com.android.launcher3.anim.SpringAnimationBuilder;
|
||||
import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
@@ -29,7 +31,7 @@ public class RecentsAtomicAnimationFactory<ACTIVITY_TYPE extends StatefulActivit
|
||||
extends AtomicAnimationFactory<STATE_TYPE> {
|
||||
|
||||
public static final int INDEX_RECENTS_FADE_ANIM = AtomicAnimationFactory.NEXT_INDEX + 0;
|
||||
public static final int INDEX_RECENTS_TRANSLATE_X_ANIM = AtomicAnimationFactory.NEXT_INDEX + 1;
|
||||
public static final int INDEX_RECENTS_TRANSLATE_Y_ANIM = AtomicAnimationFactory.NEXT_INDEX + 1;
|
||||
|
||||
private static final int MY_ANIM_COUNT = 2;
|
||||
|
||||
@@ -46,14 +48,14 @@ public class RecentsAtomicAnimationFactory<ACTIVITY_TYPE extends StatefulActivit
|
||||
case INDEX_RECENTS_FADE_ANIM:
|
||||
return ObjectAnimator.ofFloat(mActivity.getOverviewPanel(),
|
||||
RecentsView.CONTENT_ALPHA, values);
|
||||
case INDEX_RECENTS_TRANSLATE_X_ANIM: {
|
||||
case INDEX_RECENTS_TRANSLATE_Y_ANIM: {
|
||||
RecentsView rv = mActivity.getOverviewPanel();
|
||||
return new SpringAnimationBuilder(mActivity)
|
||||
.setMinimumVisibleChange(1f / rv.getPageOffsetScale())
|
||||
.setMinimumVisibleChange(DynamicAnimation.MIN_VISIBLE_CHANGE_SCALE)
|
||||
.setDampingRatio(0.8f)
|
||||
.setStiffness(250)
|
||||
.setValues(values)
|
||||
.build(rv, ADJACENT_PAGE_OFFSET);
|
||||
.build(rv, ADJACENT_PAGE_VERTICAL_OFFSET);
|
||||
}
|
||||
default:
|
||||
return super.createStateElementAnimation(index, values);
|
||||
|
||||
@@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
@@ -39,7 +38,6 @@ import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.quickstep.LauncherActivityInterface;
|
||||
import com.android.quickstep.util.OverviewToHomeAnim;
|
||||
import com.android.systemui.plugins.PluginListener;
|
||||
import com.android.systemui.plugins.RecentsExtraCard;
|
||||
|
||||
@@ -90,15 +88,7 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
|
||||
|
||||
@Override
|
||||
public void startHome() {
|
||||
Runnable onReachedHome = () -> mActivity.getStateManager().goToState(NORMAL, false);
|
||||
OverviewToHomeAnim overviewToHomeAnim = new OverviewToHomeAnim(mActivity, onReachedHome);
|
||||
if (LIVE_TILE.get()) {
|
||||
switchToScreenshot(null,
|
||||
() -> finishRecentsAnimation(true /* toRecents */,
|
||||
() -> overviewToHomeAnim.animateWithVelocity(0)));
|
||||
} else {
|
||||
overviewToHomeAnim.animateWithVelocity(0);
|
||||
}
|
||||
mActivity.getStateManager().goToState(NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -213,19 +213,35 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
};
|
||||
|
||||
public static final FloatProperty<RecentsView> ADJACENT_PAGE_OFFSET =
|
||||
new FloatProperty<RecentsView>("adjacentPageOffset") {
|
||||
public static final FloatProperty<RecentsView> ADJACENT_PAGE_HORIZONTAL_OFFSET =
|
||||
new FloatProperty<RecentsView>("adjacentPageHorizontalOffset") {
|
||||
@Override
|
||||
public void setValue(RecentsView recentsView, float v) {
|
||||
if (recentsView.mAdjacentPageOffset != v) {
|
||||
recentsView.mAdjacentPageOffset = v;
|
||||
if (recentsView.mAdjacentPageHorizontalOffset != v) {
|
||||
recentsView.mAdjacentPageHorizontalOffset = v;
|
||||
recentsView.updatePageOffsets();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(RecentsView recentsView) {
|
||||
return recentsView.mAdjacentPageOffset;
|
||||
return recentsView.mAdjacentPageHorizontalOffset;
|
||||
}
|
||||
};
|
||||
|
||||
public static final FloatProperty<RecentsView> ADJACENT_PAGE_VERTICAL_OFFSET =
|
||||
new FloatProperty<RecentsView>("adjacentPageVerticalOffset") {
|
||||
@Override
|
||||
public void setValue(RecentsView recentsView, float v) {
|
||||
if (recentsView.mAdjacentPageVerticalOffset != v) {
|
||||
recentsView.mAdjacentPageVerticalOffset = v;
|
||||
recentsView.updateVerticalPageOffsets();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(RecentsView recentsView) {
|
||||
return recentsView.mAdjacentPageVerticalOffset;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -240,6 +256,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
@Override
|
||||
public void setValue(RecentsView recentsView, float v) {
|
||||
recentsView.setTaskViewsResistanceTranslation(v);
|
||||
recentsView.mLastComputedTaskBottomPushOutDistance = null;
|
||||
recentsView.updateVerticalPageOffsets();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -289,9 +307,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
view.setScaleY(scale);
|
||||
view.mLastComputedTaskStartPushOutDistance = null;
|
||||
view.mLastComputedTaskEndPushOutDistance = null;
|
||||
view.mLastComputedTaskBottomPushOutDistance = null;
|
||||
view.mLiveTileTaskViewSimulator.recentsViewScale.value = scale;
|
||||
view.updatePageOffsets();
|
||||
view.setTaskViewsResistanceTranslation(view.mTaskViewsSecondaryTranslation);
|
||||
view.updatePageOffsets();
|
||||
view.updateVerticalPageOffsets();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -330,6 +350,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot.
|
||||
protected Float mLastComputedTaskStartPushOutDistance = null;
|
||||
protected Float mLastComputedTaskEndPushOutDistance = null;
|
||||
protected Float mLastComputedTaskBottomPushOutDistance = null;
|
||||
protected boolean mEnableDrawingLiveTile = false;
|
||||
protected final Rect mTempRect = new Rect();
|
||||
protected final RectF mTempRectF = new RectF();
|
||||
@@ -373,7 +394,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
private boolean mOverviewGridEnabled;
|
||||
private boolean mOverviewFullscreenEnabled;
|
||||
|
||||
private float mAdjacentPageOffset = 0;
|
||||
private float mAdjacentPageHorizontalOffset = 0;
|
||||
private float mAdjacentPageVerticalOffset = 0;
|
||||
protected float mTaskViewsSecondaryTranslation = 0;
|
||||
protected float mTaskViewsPrimarySplitTranslation = 0;
|
||||
protected float mTaskViewsSecondarySplitTranslation = 0;
|
||||
@@ -622,28 +644,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// Draw overscroll
|
||||
if (mAllowOverScroll && (!mEdgeGlowRight.isFinished() || !mEdgeGlowLeft.isFinished())) {
|
||||
final int restoreCount = canvas.save();
|
||||
final int width = getWidth();
|
||||
final int height = getHeight();
|
||||
int primarySize = mOrientationHandler.getPrimaryValue(width, height);
|
||||
int secondarySize = mOrientationHandler.getSecondaryValue(width, height);
|
||||
|
||||
float effectiveShift = 0;
|
||||
if (!mEdgeGlowLeft.isFinished()) {
|
||||
mEdgeGlowLeft.setSize(secondarySize, primarySize);
|
||||
if (((TranslateEdgeEffect) mEdgeGlowLeft).getTranslationShift(mTempFloat)) {
|
||||
effectiveShift = mTempFloat[0];
|
||||
postInvalidateOnAnimation();
|
||||
}
|
||||
}
|
||||
if (!mEdgeGlowRight.isFinished()) {
|
||||
mEdgeGlowRight.setSize(secondarySize, primarySize);
|
||||
if (((TranslateEdgeEffect) mEdgeGlowRight).getTranslationShift(mTempFloat)) {
|
||||
effectiveShift -= mTempFloat[0];
|
||||
postInvalidateOnAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
int scroll = OverScroll.dampedScroll(effectiveShift * primarySize, primarySize);
|
||||
int primarySize = mOrientationHandler.getPrimaryValue(getWidth(), getHeight());
|
||||
int scroll = OverScroll.dampedScroll(getUndampedOverScrollShift(), primarySize);
|
||||
mOrientationHandler.set(canvas, CANVAS_TRANSLATE, scroll);
|
||||
|
||||
if (mOverScrollShift != scroll) {
|
||||
@@ -665,6 +668,31 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
private float getUndampedOverScrollShift() {
|
||||
final int width = getWidth();
|
||||
final int height = getHeight();
|
||||
int primarySize = mOrientationHandler.getPrimaryValue(width, height);
|
||||
int secondarySize = mOrientationHandler.getSecondaryValue(width, height);
|
||||
|
||||
float effectiveShift = 0;
|
||||
if (!mEdgeGlowLeft.isFinished()) {
|
||||
mEdgeGlowLeft.setSize(secondarySize, primarySize);
|
||||
if (((TranslateEdgeEffect) mEdgeGlowLeft).getTranslationShift(mTempFloat)) {
|
||||
effectiveShift = mTempFloat[0];
|
||||
postInvalidateOnAnimation();
|
||||
}
|
||||
}
|
||||
if (!mEdgeGlowRight.isFinished()) {
|
||||
mEdgeGlowRight.setSize(secondarySize, primarySize);
|
||||
if (((TranslateEdgeEffect) mEdgeGlowRight).getTranslationShift(mTempFloat)) {
|
||||
effectiveShift -= mTempFloat[0];
|
||||
postInvalidateOnAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
return effectiveShift * primarySize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the view shift due to overscroll
|
||||
*/
|
||||
@@ -1188,6 +1216,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// Update the set of visible task's data
|
||||
loadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
|
||||
setTaskModalness(0);
|
||||
updateVerticalPageOffsets();
|
||||
}
|
||||
|
||||
public void setFullscreenProgress(float fullscreenProgress) {
|
||||
@@ -2642,13 +2671,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
setTaskModalness(mTaskModalness);
|
||||
mLastComputedTaskStartPushOutDistance = null;
|
||||
mLastComputedTaskEndPushOutDistance = null;
|
||||
mLastComputedTaskBottomPushOutDistance = null;
|
||||
updatePageOffsets();
|
||||
updateVerticalPageOffsets();
|
||||
setImportantForAccessibility(isModal() ? IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||
: IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
}
|
||||
|
||||
private void updatePageOffsets() {
|
||||
float offset = mAdjacentPageOffset;
|
||||
float offset = mAdjacentPageHorizontalOffset;
|
||||
float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness);
|
||||
int count = getChildCount();
|
||||
|
||||
@@ -2659,10 +2690,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
float midpointOffsetSize = 0;
|
||||
float leftOffsetSize = midpoint - 1 >= 0
|
||||
? -getOffsetSize(midpoint - 1, midpoint, offset)
|
||||
? -getHorizontalOffsetSize(midpoint - 1, midpoint, offset)
|
||||
: 0;
|
||||
float rightOffsetSize = midpoint + 1 < count
|
||||
? getOffsetSize(midpoint + 1, midpoint, offset)
|
||||
? getHorizontalOffsetSize(midpoint + 1, midpoint, offset)
|
||||
: 0;
|
||||
|
||||
boolean showAsGrid = showAsGrid();
|
||||
@@ -2676,14 +2707,14 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// calculation is the task directly next to the focus task in the grid.
|
||||
int referenceIndex = modalMidpoint == 0 ? 1 : 0;
|
||||
gridOffsetSize = referenceIndex < count
|
||||
? getOffsetSize(referenceIndex, modalMidpoint, modalOffset)
|
||||
? getHorizontalOffsetSize(referenceIndex, modalMidpoint, modalOffset)
|
||||
: 0;
|
||||
} else {
|
||||
modalLeftOffsetSize = modalMidpoint - 1 >= 0
|
||||
? getOffsetSize(modalMidpoint - 1, modalMidpoint, modalOffset)
|
||||
? getHorizontalOffsetSize(modalMidpoint - 1, modalMidpoint, modalOffset)
|
||||
: 0;
|
||||
modalRightOffsetSize = modalMidpoint + 1 < count
|
||||
? getOffsetSize(modalMidpoint + 1, modalMidpoint, modalOffset)
|
||||
? getHorizontalOffsetSize(modalMidpoint + 1, modalMidpoint, modalOffset)
|
||||
: 0;
|
||||
}
|
||||
|
||||
@@ -2734,7 +2765,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
* translating away from the given midpoint.
|
||||
* @param offsetProgress From 0 to 1 where 0 means no offset and 1 means offset offscreen.
|
||||
*/
|
||||
private float getOffsetSize(int childIndex, int midpointIndex, float offsetProgress) {
|
||||
private float getHorizontalOffsetSize(int childIndex, int midpointIndex, float offsetProgress) {
|
||||
if (offsetProgress == 0) {
|
||||
// Don't bother calculating everything below if we won't offset anyway.
|
||||
return 0;
|
||||
@@ -2796,6 +2827,64 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
return distanceToOffscreen * offsetProgress;
|
||||
}
|
||||
|
||||
private void updateVerticalPageOffsets() {
|
||||
float offset = mAdjacentPageVerticalOffset;
|
||||
int count = getTaskViewCount();
|
||||
|
||||
TaskView runningTask = mRunningTaskId == -1 || !mRunningTaskTileHidden
|
||||
? null : getTaskView(mRunningTaskId);
|
||||
int midpoint = runningTask == null ? -1 : indexOfChild(runningTask);
|
||||
|
||||
float offsetSize = getVerticalOffsetSize(offset);
|
||||
float midpointOffsetSize = 0;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
float translation = i == midpoint
|
||||
? midpointOffsetSize
|
||||
: offsetSize;
|
||||
int directionFactor = mOrientationHandler.getSecondaryTranslationDirectionFactor() * -1;
|
||||
translation *= directionFactor;
|
||||
TaskView child = getTaskViewAt(i);
|
||||
FloatProperty translationProperty = child.getSecondaryTaskOffsetTranslationProperty();
|
||||
translationProperty.set(child, translation);
|
||||
if (LIVE_TILE.get() && mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
|
||||
mLiveTileTaskViewSimulator.taskSecondaryTranslation.value = translation;
|
||||
redrawLiveTile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the distance to offset the given child such that it is completely offscreen when
|
||||
* translating away from its position in overview.
|
||||
* @param offsetProgress From 0 to 1 where 0 means no offset and 1 means offset offscreen.
|
||||
*/
|
||||
private float getVerticalOffsetSize(float offsetProgress) {
|
||||
if (offsetProgress == 0) {
|
||||
// Don't bother calculating everything below if we won't offset anyway.
|
||||
return 0;
|
||||
}
|
||||
// First, find the distance to offscreen from the normal (centered) task position.
|
||||
mTempRectF.set(mLastComputedTaskSize);
|
||||
RectF taskPosition = mTempRectF;
|
||||
float desiredTop = getHeight();
|
||||
float distanceToOffscreen = desiredTop - taskPosition.top;
|
||||
// Next, we need to account for the resistance translation if any (e.g. long swipe up).
|
||||
float translationY = mTaskViewsSecondaryTranslation;
|
||||
distanceToOffscreen -= translationY;
|
||||
// Finally, we need to account for RecentsView scale, because it moves tasks based on its
|
||||
// pivot. To do this, we move the task position to where it would be offscreen at scale = 1
|
||||
// (computed above), then we apply the scale via getMatrix() to determine how much that
|
||||
// moves the task from its desired position, and adjust the computed distance accordingly.
|
||||
if (mLastComputedTaskBottomPushOutDistance == null) {
|
||||
taskPosition.offsetTo(0, desiredTop + translationY);
|
||||
getMatrix().mapRect(taskPosition);
|
||||
mLastComputedTaskBottomPushOutDistance = (taskPosition.top - desiredTop) / getScaleY();
|
||||
}
|
||||
distanceToOffscreen -= mLastComputedTaskBottomPushOutDistance;
|
||||
return distanceToOffscreen * offsetProgress;
|
||||
}
|
||||
|
||||
protected void setTaskViewsResistanceTranslation(float translation) {
|
||||
mTaskViewsSecondaryTranslation = translation;
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
@@ -2821,13 +2910,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Do not assume motion across X axis for adjacent page
|
||||
*/
|
||||
public float getPageOffsetScale() {
|
||||
return Math.max(getWidth(), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the visuals when exit modal state.
|
||||
*/
|
||||
@@ -3440,8 +3522,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
if (pageIndex == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int overScrollShift = getOverScrollShift();
|
||||
if (mAdjacentPageVerticalOffset > 0) {
|
||||
// Don't dampen the scroll (due to overscroll) if the adjacent tasks are offscreen, so
|
||||
// that the page can move freely given there's no visual indication why it shouldn't.
|
||||
overScrollShift = (int) Utilities.mapRange(mAdjacentPageVerticalOffset, overScrollShift,
|
||||
getUndampedOverScrollShift());
|
||||
}
|
||||
return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this)
|
||||
+ getOverScrollShift();
|
||||
+ overScrollShift;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1151,6 +1151,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y);
|
||||
}
|
||||
|
||||
public FloatProperty<TaskView> getSecondaryTaskOffsetTranslationProperty() {
|
||||
return getPagedOrientationHandler().getSecondaryValue(
|
||||
TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y);
|
||||
}
|
||||
|
||||
public FloatProperty<TaskView> getTaskResistanceTranslationProperty() {
|
||||
return getPagedOrientationHandler().getSecondaryValue(
|
||||
TASK_RESISTANCE_TRANSLATION_X, TASK_RESISTANCE_TRANSLATION_Y);
|
||||
|
||||
@@ -2780,7 +2780,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
* @see LauncherState#getOverviewScaleAndOffset(Launcher)
|
||||
*/
|
||||
public float[] getNormalOverviewScaleAndOffset() {
|
||||
return new float[] {NO_SCALE, NO_OFFSET};
|
||||
return new float[] {NO_SCALE, NO_OFFSET, NO_OFFSET};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -172,10 +172,12 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of two elements.
|
||||
* Returns an array of three elements.
|
||||
* The first specifies the scale for the overview
|
||||
* The second is the factor ([0, 1], 0 => center-screen; 1 => offscreen) by which overview
|
||||
* should be shifted horizontally.
|
||||
* The third is the factor ([0, 1], 0 => center-screen; 1 => offscreen) by which overview
|
||||
* should be shifted vertically.
|
||||
*/
|
||||
public float[] getOverviewScaleAndOffset(Launcher launcher) {
|
||||
return launcher.getNormalOverviewScaleAndOffset();
|
||||
|
||||
Reference in New Issue
Block a user