Only adjust min/max scroll for split screen in landscape

- Portrait's split placeholder is at top/bottom and does not affect scroll

Bug: 200537659
Test: Split left and split right in portrait / landscape, check if min/max scroll is correct
Change-Id: Ib7eb09d3cc44c8e0d962920ad094c73abc5f0dbd
This commit is contained in:
Alex Chau 2021-10-06 12:31:10 +01:00
parent 6ab0d1e7be
commit aea42dc43e
1 changed files with 10 additions and 4 deletions

View File

@ -4359,12 +4359,14 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
protected int computeMinScroll() {
if (getTaskViewCount() > 0) {
int minScroll;
boolean isLandscapeGridSplit = mActivity.getDeviceProfile().isLandscape
&& showAsGrid() && isSplitSelectionActive();
if (mIsRtl) {
// If we aren't showing the clear all button, use the rightmost task as the min
// scroll.
minScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
if (showAsGrid() && isSplitSelectionActive()
if (isLandscapeGridSplit
&& mSplitSelectStateController.getActiveSplitStagePosition()
== SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) {
minScroll -= mSplitPlaceholderSize;
@ -4373,7 +4375,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
minScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
: 0);
// TODO(b/200537659): Adjust according to mSplitPlaceholderSize.
// TODO(b/200537659): Adjust according to mSplitPlaceholderSize when
// isLandscapeGridSplit is true.
}
return minScroll;
}
@ -4384,11 +4387,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
protected int computeMaxScroll() {
if (getTaskViewCount() > 0) {
int maxScroll;
boolean isLandscapeGridSplit = mActivity.getDeviceProfile().isLandscape
&& showAsGrid() && isSplitSelectionActive();
if (mIsRtl) {
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
maxScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
: 0);
if (showAsGrid() && isSplitSelectionActive()
if (isLandscapeGridSplit
&& mSplitSelectStateController.getActiveSplitStagePosition()
== SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
maxScroll += mSplitPlaceholderSize;
@ -4398,7 +4403,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
// scroll.
maxScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
// TODO(b/200537659): Adjust according to mSplitPlaceholderSize.
// TODO(b/200537659): Adjust according to mSplitPlaceholderSize when
// isLandscapeGridSplit is true.
}
return maxScroll;
}