Changes page alignment in PagedView calcualtion

- Align pages to right (instead of left) in RTL, to make scroll calculation for grid overview easier for out of orientation tasks
- Changed TaskView pivot direction to be consistent with page alignment
- Add scroll offset for ClearAllButton to align to left in RTL
- Fixed Workspace scroll issues in RTL, and removed needs to use panelCount when calculating page scroll

Bug: 175939487
Test: Test carousel/grid overveiw, Workspace, Folder scroll view for normal/RTL
Change-Id: Ic0ba88e5d58638e1149d97a68a978d80fbf26774
This commit is contained in:
Alex Chau
2021-03-29 17:37:53 +01:00
parent e6583cbb75
commit b5c4d1108f
4 changed files with 18 additions and 40 deletions

View File

@@ -715,13 +715,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
final int primaryDimension = bounds.primaryDimension;
final int childPrimaryEnd = bounds.childPrimaryEnd;
// In case the pages are of different width, align the page to left or right edge
// based on the orientation.
// In case we have multiple panels on the screen, scrollOffsetEnd is the scroll
// needed for the whole visible area, so we have to divide it by panelCount.
final int pageScroll = mIsRtl
? (childStart - scrollOffsetStart)
: Math.max(0, childPrimaryEnd - scrollOffsetEnd / getPanelCount());
// In case the pages are of different width, align the page to left edge for non-RTL
// or right edge for RTL.
final int pageScroll =
mIsRtl ? childPrimaryEnd - scrollOffsetEnd : childStart - scrollOffsetStart;
if (outPageScrolls[i] != pageScroll) {
pageScrollChanged = true;
outPageScrolls[i] = pageScroll;