From 516584e64844c673afe2f7913f89a7bbaee6a363 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 5 Oct 2021 17:21:48 +0100 Subject: [PATCH] Adjust min/max scroll according to mSplitPlaceholderSize - RTL is not handled yet due to split select broken Bug: 200537659 Test: Split left and split right, check if min/max scroll is correct Change-Id: I734d890bb955601da52cd806074014ed2e7eba55 --- .../android/quickstep/views/RecentsView.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index e1a389582f..74c8e395c7 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -409,7 +409,7 @@ public abstract class RecentsView 0) { + int minScroll; if (mIsRtl) { // If we aren't showing the clear all button, use the rightmost task as the min // scroll. - return getScrollForPage(mDisallowScrollToClearAll ? indexOfChild( + minScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild( getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton)); + if (showAsGrid() && isSplitSelectionActive() + && mSplitSelectStateController.getActiveSplitStagePosition() + == SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) { + minScroll -= mSplitPlaceholderSize; + } } else { TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null; - return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView) + minScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView) : 0); + // TODO(b/200537659): Adjust according to mSplitPlaceholderSize. } + return minScroll; } return super.computeMinScroll(); } @@ -4366,16 +4375,24 @@ public abstract class RecentsView 0) { + int maxScroll; if (mIsRtl) { TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null; - return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView) + maxScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView) : 0); + if (showAsGrid() && isSplitSelectionActive() + && mSplitSelectStateController.getActiveSplitStagePosition() + == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) { + maxScroll += mSplitPlaceholderSize; + } } else { // If we aren't showing the clear all button, use the leftmost task as the min // scroll. - return getScrollForPage(mDisallowScrollToClearAll ? indexOfChild( + maxScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild( getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton)); + // TODO(b/200537659): Adjust according to mSplitPlaceholderSize. } + return maxScroll; } return super.computeMaxScroll(); }