Merge "Revert "Move focused task to front when attaching RecentsView"" into sc-v2-dev am: c0fe7b1cc4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15301504 Change-Id: I0d48052a8cd0bf84107c37dffb4c58ddaabcf814
This commit is contained in:
commit
d69d4e9742
3 files changed
+3
-57
No files matched your search
@@ -539,7 +539,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
@Override
|
@Override
|
||||||
public void onMotionPauseDetected() {
|
public void onMotionPauseDetected() {
|
||||||
mHasMotionEverBeenPaused = true;
|
mHasMotionEverBeenPaused = true;
|
||||||
maybeUpdateRecentsAttachedState(true/* animate */, true/* moveFocusedTask */);
|
maybeUpdateRecentsAttachedState();
|
||||||
performHapticFeedback();
|
performHapticFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,24 +550,18 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeUpdateRecentsAttachedState() {
|
public void maybeUpdateRecentsAttachedState() {
|
||||||
maybeUpdateRecentsAttachedState(true /* animate */);
|
maybeUpdateRecentsAttachedState(true /* animate */);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeUpdateRecentsAttachedState(boolean animate) {
|
|
||||||
maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether to show or hide RecentsView. The window is always
|
* Determines whether to show or hide RecentsView. The window is always
|
||||||
* synchronized with its corresponding TaskView in RecentsView, so if
|
* synchronized with its corresponding TaskView in RecentsView, so if
|
||||||
* RecentsView is shown, it will appear to be attached to the window.
|
* RecentsView is shown, it will appear to be attached to the window.
|
||||||
*
|
*
|
||||||
* Note this method has no effect unless the navigation mode is NO_BUTTON.
|
* Note this method has no effect unless the navigation mode is NO_BUTTON.
|
||||||
* @param animate whether to animate when attaching RecentsView
|
|
||||||
* @param moveFocusedTask whether to move focused task to front when attaching
|
|
||||||
*/
|
*/
|
||||||
private void maybeUpdateRecentsAttachedState(boolean animate, boolean moveFocusedTask) {
|
private void maybeUpdateRecentsAttachedState(boolean animate) {
|
||||||
if (!mDeviceState.isFullyGesturalNavMode() || mRecentsView == null) {
|
if (!mDeviceState.isFullyGesturalNavMode() || mRecentsView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -586,12 +580,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
} else {
|
} else {
|
||||||
recentsAttachedToAppWindow = mHasMotionEverBeenPaused || mIsLikelyToStartNewTask;
|
recentsAttachedToAppWindow = mHasMotionEverBeenPaused || mIsLikelyToStartNewTask;
|
||||||
}
|
}
|
||||||
if (moveFocusedTask && !mAnimationFactory.hasRecentsEverAttachedToAppWindow()
|
|
||||||
&& recentsAttachedToAppWindow) {
|
|
||||||
// Only move focused task if RecentsView has never been attached before, to avoid
|
|
||||||
// TaskView jumping to new position as we move the tasks.
|
|
||||||
mRecentsView.moveFocusedTaskToFront();
|
|
||||||
}
|
|
||||||
mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate);
|
mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate);
|
||||||
|
|
||||||
// Reapply window transform throughout the attach animation, as the animation affects how
|
// Reapply window transform throughout the attach animation, as the animation affects how
|
||||||
|
|||||||
@@ -396,10 +396,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||||||
default boolean isRecentsAttachedToAppWindow() {
|
default boolean isRecentsAttachedToAppWindow() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasRecentsEverAttachedToAppWindow() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DefaultAnimationFactory implements AnimationFactory {
|
class DefaultAnimationFactory implements AnimationFactory {
|
||||||
@@ -409,7 +405,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||||||
private final Consumer<AnimatorControllerWithResistance> mCallback;
|
private final Consumer<AnimatorControllerWithResistance> mCallback;
|
||||||
|
|
||||||
private boolean mIsAttachedToWindow;
|
private boolean mIsAttachedToWindow;
|
||||||
private boolean mHasEverAttachedToWindow;
|
|
||||||
|
|
||||||
DefaultAnimationFactory(Consumer<AnimatorControllerWithResistance> callback) {
|
DefaultAnimationFactory(Consumer<AnimatorControllerWithResistance> callback) {
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
@@ -463,9 +458,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||||||
}
|
}
|
||||||
mIsAttachedToWindow = attached;
|
mIsAttachedToWindow = attached;
|
||||||
RecentsView recentsView = mActivity.getOverviewPanel();
|
RecentsView recentsView = mActivity.getOverviewPanel();
|
||||||
if (attached) {
|
|
||||||
mHasEverAttachedToWindow = true;
|
|
||||||
}
|
|
||||||
Animator fadeAnim = mActivity.getStateManager()
|
Animator fadeAnim = mActivity.getStateManager()
|
||||||
.createStateElementAnimation(INDEX_RECENTS_FADE_ANIM, attached ? 1 : 0);
|
.createStateElementAnimation(INDEX_RECENTS_FADE_ANIM, attached ? 1 : 0);
|
||||||
|
|
||||||
@@ -495,11 +487,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||||||
return mIsAttachedToWindow;
|
return mIsAttachedToWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasRecentsEverAttachedToAppWindow() {
|
|
||||||
return mHasEverAttachedToWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) {
|
protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) {
|
||||||
// Scale down recents from being full screen to being in overview.
|
// Scale down recents from being full screen to being in overview.
|
||||||
RecentsView recentsView = activity.getOverviewPanel();
|
RecentsView recentsView = activity.getOverviewPanel();
|
||||||
|
|||||||
@@ -1111,35 +1111,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves the focused task to the front of the carousel in tablets, to minimize animation
|
|
||||||
* required to focus the task in grid.
|
|
||||||
*/
|
|
||||||
public void moveFocusedTaskToFront() {
|
|
||||||
if (!(mActivity.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskView focusedTaskView = getFocusedTaskView();
|
|
||||||
if (focusedTaskView == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (indexOfChild(focusedTaskView) != mCurrentPage) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int primaryScroll = mOrientationHandler.getPrimaryScroll(this);
|
|
||||||
int currentPageScroll = getScrollForPage(mCurrentPage);
|
|
||||||
mCurrentPageScrollDiff = primaryScroll - currentPageScroll;
|
|
||||||
|
|
||||||
removeView(focusedTaskView);
|
|
||||||
addView(focusedTaskView, mTaskViewStartIndex);
|
|
||||||
setCurrentPage(0);
|
|
||||||
|
|
||||||
updateGridProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void applyLoadPlan(ArrayList<Task> tasks) {
|
protected void applyLoadPlan(ArrayList<Task> tasks) {
|
||||||
if (mPendingAnimation != null) {
|
if (mPendingAnimation != null) {
|
||||||
mPendingAnimation.addEndListener(success -> applyLoadPlan(tasks));
|
mPendingAnimation.addEndListener(success -> applyLoadPlan(tasks));
|
||||||
|
|||||||
Reference in new issue
Block a user