Merge remote-tracking branch 'aosp/android12L-release' into 12.1-dev

This commit is contained in:
Suphon Thanakornpakapong
2022-05-08 18:41:13 +07:00
825 changed files with 38324 additions and 29270 deletions
+207 -96
View File
@@ -16,6 +16,8 @@
package com.android.launcher3;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import static com.android.launcher3.anim.Interpolators.SCROLL;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isObservedEventType;
@@ -48,6 +50,7 @@ import android.widget.OverScroller;
import android.widget.ScrollView;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
@@ -55,6 +58,7 @@ import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PagedOrientationHandler.ChildBounds;
import com.android.launcher3.util.EdgeEffectCompat;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.views.ActivityContext;
@@ -102,6 +106,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
@ViewDebug.ExportedProperty(category = "launcher")
protected int mCurrentPage;
// Difference between current scroll position and mCurrentPage's page scroll. Used to maintain
// relative scroll position unchanged in updateCurrentPageScroll. Cleared when snapping to a
// page.
protected int mCurrentPageScrollDiff;
// The current page the PagedView is scrolling over on it's way to the destination page.
protected int mCurrentScrollOverPage;
@ViewDebug.ExportedProperty(category = "launcher")
protected int mNextPage = INVALID_PAGE;
@@ -174,6 +184,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
mScroller = new OverScroller(context, SCROLL);
mCurrentPage = 0;
mCurrentScrollOverPage = 0;
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = configuration.getScaledTouchSlop();
@@ -199,7 +210,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public void initParentViews(View parent) {
if (mPageIndicatorViewId > -1) {
mPageIndicator = parent.findViewById(mPageIndicatorViewId);
mPageIndicator.setMarkersCount(getChildCount());
mPageIndicator.setMarkersCount(getChildCount() / getPanelCount());
}
}
@@ -232,10 +243,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return getChildAt(index);
}
protected int indexToPage(int index) {
return index;
}
/**
* Updates the scroll of the current page immediately to its final scroll position. We use this
* in CustomizePagedView to allow tabs to share the same PagedView while resetting the scroll of
@@ -245,11 +252,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// If the current page is invalid, just reset the scroll position to zero
int newPosition = 0;
if (0 <= mCurrentPage && mCurrentPage < getPageCount()) {
newPosition = getScrollForPage(mCurrentPage);
newPosition = getScrollForPage(mCurrentPage) + mCurrentPageScrollDiff;
}
mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, newPosition);
mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
forceFinishScroller(true);
forceFinishScroller();
}
/**
@@ -271,14 +278,16 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
}
private void forceFinishScroller(boolean resetNextPage) {
/**
* Immediately finishes any in-progress scroll, maintaining the current position. Also sets
* mNextPage = INVALID_PAGE and calls pageEndTransition().
*/
public void forceFinishScroller() {
mScroller.forceFinished(true);
// We need to clean up the next page here to avoid computeScrollHelper from
// updating current page on the pass.
if (resetNextPage) {
mNextPage = INVALID_PAGE;
pageEndTransition();
}
mNextPage = INVALID_PAGE;
pageEndTransition();
}
private int validateNewPage(int newPage) {
@@ -287,15 +296,21 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
newPage = Utilities.boundToRange(newPage, 0, getPageCount() - 1);
if (getPanelCount() > 1) {
// Always return left panel as new page
// Always return left most panel as new page
newPage = getLeftmostVisiblePageForIndex(newPage);
}
return newPage;
}
private int getLeftmostVisiblePageForIndex(int pageIndex) {
/**
* In most cases where panelCount is 1, this method will just return the page index that was
* passed in.
* But for example when two panel home is enabled we might need the leftmost visible page index
* because that page is the current page.
*/
public int getLeftmostVisiblePageForIndex(int pageIndex) {
int panelCount = getPanelCount();
return (pageIndex / panelCount) * panelCount;
return pageIndex - pageIndex % panelCount;
}
/**
@@ -305,24 +320,82 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return 1;
}
/**
* Returns an IntSet with the indices of the currently visible pages
*/
@VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public IntSet getVisiblePageIndices() {
return getPageIndices(mCurrentPage);
}
/**
* In case the panelCount is 1 this just returns the same page index in an IntSet.
* But in cases where the panelCount > 1 this will return all the page indices that belong
* together, i.e. on the Workspace they are next to each other and shown at the same time.
*/
private IntSet getPageIndices(int pageIndex) {
// we want to make sure the pageIndex is the leftmost page
pageIndex = getLeftmostVisiblePageForIndex(pageIndex);
IntSet pageIndices = new IntSet();
int panelCount = getPanelCount();
int pageCount = getPageCount();
for (int page = pageIndex; page < pageIndex + panelCount && page < pageCount; page++) {
pageIndices.add(page);
}
return pageIndices;
}
/**
* Returns an IntSet with the indices of the neighbour pages that are in the focus direction.
*/
private IntSet getNeighbourPageIndices(int focus) {
int panelCount = getPanelCount();
// getNextPage is more reliable than getCurrentPage
int currentPage = getNextPage();
int nextPage;
if (focus == View.FOCUS_LEFT) {
nextPage = currentPage - panelCount;
} else if (focus == View.FOCUS_RIGHT) {
nextPage = currentPage + panelCount;
} else {
// no neighbours to other directions
return new IntSet();
}
nextPage = validateNewPage(nextPage);
if (nextPage == currentPage) {
// We reached the end of the pages
return new IntSet();
}
return getPageIndices(nextPage);
}
/**
* Executes the callback against each visible page
*/
public void forEachVisiblePage(Consumer<View> callback) {
int panelCount = getPanelCount();
for (int i = mCurrentPage; i < mCurrentPage + panelCount; i++) {
View page = getPageAt(i);
getVisiblePageIndices().forEach(pageIndex -> {
View page = getPageAt(pageIndex);
if (page != null) {
callback.accept(page);
}
}
});
}
/**
* Returns true if the view is on one of the current pages, false otherwise.
*/
public boolean isVisible(View child) {
return getLeftmostVisiblePageForIndex(indexOfChild(child)) == mCurrentPage;
return isVisible(indexOfChild(child));
}
/**
* Returns true if the page with the given index is currently visible, false otherwise.
*/
private boolean isVisible(int pageIndex) {
return getLeftmostVisiblePageForIndex(pageIndex) == mCurrentPage;
}
/**
@@ -371,6 +444,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
int prevPage = overridePrevPage != INVALID_PAGE ? overridePrevPage : mCurrentPage;
mCurrentPage = validateNewPage(currentPage);
mCurrentScrollOverPage = mCurrentPage;
updateCurrentPageScroll();
notifyPageSwitchListener(prevPage);
invalidate();
@@ -426,6 +500,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
* to provide custom behavior during animation.
*/
protected void onPageEndTransition() {
mCurrentPageScrollDiff = 0;
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
AccessibilityManagerCompat.sendCustomAccessibilityEvent(getPageAt(mCurrentPage),
AccessibilityEvent.TYPE_VIEW_FOCUSED, null);
@@ -483,16 +558,18 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int oldPos = mOrientationHandler.getPrimaryScroll(this);
int newPos = mScroller.getCurrX();
if (oldPos != newPos) {
mOrientationHandler.set(this, VIEW_SCROLL_TO, mScroller.getCurrX());
mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, mScroller.getCurrX());
}
if (mAllowOverScroll) {
if (newPos < mMinScroll && oldPos >= mMinScroll) {
mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
mScroller.abortAnimation();
onEdgeAbsorbingScroll();
} else if (newPos > mMaxScroll && oldPos <= mMaxScroll) {
mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
mScroller.abortAnimation();
onEdgeAbsorbingScroll();
}
}
@@ -510,6 +587,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
sendScrollAccessibilityEvent();
int prevPage = mCurrentPage;
mCurrentPage = validateNewPage(mNextPage);
mCurrentScrollOverPage = mCurrentPage;
mNextPage = INVALID_PAGE;
notifyPageSwitchListener(prevPage);
@@ -562,7 +640,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
private int getPageWidthSize(int widthSize) {
return (widthSize - mInsets.left - mInsets.right) / getPanelCount();
// It's necessary to add the padding back because it is remove when measuring children,
// like when MeasureSpec.getSize in CellLayout.
return (widthSize - mInsets.left - mInsets.right - getPaddingLeft() - getPaddingRight())
/ getPanelCount() + getPaddingLeft() + getPaddingRight();
}
@Override
@@ -678,6 +759,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
final int scrollOffsetStart = mOrientationHandler.getScrollOffsetStart(this, mInsets);
final int scrollOffsetEnd = mOrientationHandler.getScrollOffsetEnd(this, mInsets);
boolean pageScrollChanged = false;
int panelCount = getPanelCount();
for (int i = startIndex, childStart = scrollOffsetStart; i != endIndex; i += delta) {
final View child = getPageAt(i);
@@ -695,14 +777,19 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
pageScrollChanged = true;
outPageScrolls[i] = pageScroll;
}
childStart += primaryDimension + mPageSpacing + getChildGap();
childStart += primaryDimension + getChildGap();
// This makes sure that the space is added after the page, not after each panel
int lastPanel = mIsRtl ? 0 : panelCount - 1;
if (i % panelCount == lastPanel) {
childStart += mPageSpacing;
}
}
}
int panelCount = getPanelCount();
if (panelCount > 1) {
for (int i = 0; i < childCount; i++) {
// In case we have multiple panels, always use left panel's page scroll for all
// In case we have multiple panels, always use left most panel's page scroll for all
// panels on the screen.
int adjustedScroll = outPageScrolls[getLeftmostVisiblePageForIndex(i)];
if (outPageScrolls[i] != adjustedScroll) {
@@ -748,7 +835,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
private void dispatchPageCountChanged() {
if (mPageIndicator != null) {
mPageIndicator.setMarkersCount(getChildCount());
mPageIndicator.setMarkersCount(getChildCount() / getPanelCount());
}
// This ensures that when children are added, they get the correct transforms / alphas
// in accordance with any scroll effects.
@@ -765,6 +852,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public void onViewRemoved(View child) {
super.onViewRemoved(child);
mCurrentPage = validateNewPage(mCurrentPage);
mCurrentScrollOverPage = mCurrentPage;
dispatchPageCountChanged();
}
@@ -781,8 +869,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
int page = indexToPage(indexOfChild(child));
if (page != mCurrentPage || !mScroller.isFinished()) {
int page = indexOfChild(child);
if (!isVisible(page) || !mScroller.isFinished()) {
if (immediate) {
setCurrentPage(page);
} else {
@@ -821,21 +909,25 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
direction = View.FOCUS_LEFT;
}
}
if (direction == View.FOCUS_LEFT) {
if (getCurrentPage() > 0) {
int nextPage = validateNewPage(getCurrentPage() - 1);
snapToPage(nextPage);
getChildAt(nextPage).requestFocus(direction);
return true;
}
} else if (direction == View.FOCUS_RIGHT) {
if (getCurrentPage() < getPageCount() - 1) {
int nextPage = validateNewPage(getCurrentPage() + 1);
snapToPage(nextPage);
getChildAt(nextPage).requestFocus(direction);
return true;
int currentPage = getNextPage();
int closestNeighbourIndex = -1;
int closestNeighbourDistance = Integer.MAX_VALUE;
// Find the closest neighbour page
for (int neighbourPageIndex : getNeighbourPageIndices(direction)) {
int distance = Math.abs(neighbourPageIndex - currentPage);
if (closestNeighbourDistance > distance) {
closestNeighbourDistance = distance;
closestNeighbourIndex = neighbourPageIndex;
}
}
if (closestNeighbourIndex != -1) {
View page = getPageAt(closestNeighbourIndex);
snapToPage(closestNeighbourIndex);
page.requestFocus(direction);
return true;
}
return false;
}
@@ -845,28 +937,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return;
}
// Add the current page's views as focusable and the next possible page's too. If the
// last focus change action was left then the left neighbour's views will be added, and
// if it was right then the right neighbour's views will be added.
// Unfortunately mCurrentPage can be outdated if there were multiple control actions in a
// short period of time, but mNextPage is up to date because it is always updated by
// method snapToPage.
int nextPage = getNextPage();
// XXX-RTL: This will be fixed in a future CL
if (nextPage >= 0 && nextPage < getPageCount()) {
getPageAt(nextPage).addFocusables(views, direction, focusableMode);
}
if (direction == View.FOCUS_LEFT) {
if (nextPage > 0) {
nextPage = validateNewPage(nextPage - 1);
getPageAt(nextPage).addFocusables(views, direction, focusableMode);
}
} else if (direction == View.FOCUS_RIGHT) {
if (nextPage < getPageCount() - 1) {
nextPage = validateNewPage(nextPage + 1);
getPageAt(nextPage).addFocusables(views, direction, focusableMode);
}
}
// nextPage is more reliable when multiple control movements have been done in a short
// period of time
getPageIndices(getNextPage())
.addAll(getNeighbourPageIndices(direction))
.forEach(pageIndex ->
getPageAt(pageIndex).addFocusables(views, direction, focusableMode));
}
/**
@@ -986,7 +1062,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
/**
* If being flinged and user touches the screen, initiate drag; otherwise don't.
*/
private void updateIsBeingDraggedOnTouchDown(MotionEvent ev) {
protected void updateIsBeingDraggedOnTouchDown(MotionEvent ev) {
// mScroller.isFinished should be false when being flinged.
final int xDist = Math.abs(mScroller.getFinalX() - mScroller.getCurrX());
final boolean finishedScrolling = (mScroller.isFinished() || xDist < mPageSlop / 3);
@@ -1056,26 +1132,25 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
protected float getScrollProgress(int screenCenter, View v, int page) {
final int halfScreenSize = getMeasuredWidth() / 2;
int delta = screenCenter - (getScrollForPage(page) + halfScreenSize);
int count = getChildCount();
int panelCount = getPanelCount();
int pageCount = getChildCount();
final int totalDistance;
int adjacentPage = page + 1;
int adjacentPage = page + panelCount;
if ((delta < 0 && !mIsRtl) || (delta > 0 && mIsRtl)) {
adjacentPage = page - 1;
adjacentPage = page - panelCount;
}
if (adjacentPage < 0 || adjacentPage > count - 1) {
totalDistance = v.getMeasuredWidth() + mPageSpacing;
final int totalDistance;
if (adjacentPage < 0 || adjacentPage > pageCount - 1) {
totalDistance = (v.getMeasuredWidth() + mPageSpacing) * panelCount;
} else {
totalDistance = Math.abs(getScrollForPage(adjacentPage) - getScrollForPage(page));
}
float scrollProgress = delta / (totalDistance * 1.0f);
scrollProgress = Math.min(scrollProgress, MAX_SCROLL_PROGRESS);
scrollProgress = Math.max(scrollProgress, - MAX_SCROLL_PROGRESS);
scrollProgress = Math.max(scrollProgress, -MAX_SCROLL_PROGRESS);
return scrollProgress;
}
@@ -1122,6 +1197,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
mAllowOverScroll = enable;
}
protected float getSignificantMoveThreshold() {
return SIGNIFICANT_MOVE_THRESHOLD;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
// Skip touch handling if there are no pages to swipe
@@ -1193,6 +1272,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
delta -= consumed;
}
delta /= mOrientationHandler.getPrimaryScale(this);
// Only scroll and update mLastMotionX if we have moved some discrete amount. We
// keep the remainder because we are actually testing if we've moved from the last
@@ -1202,7 +1282,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
mLastMotionRemainder = delta - movedDelta;
if (delta != 0) {
mOrientationHandler.set(this, VIEW_SCROLL_BY, movedDelta);
mOrientationHandler.setPrimary(this, VIEW_SCROLL_BY, movedDelta);
if (mAllowOverScroll) {
final float pulledToX = oldScroll + delta;
@@ -1245,11 +1325,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int velocity = (int) mOrientationHandler.getPrimaryVelocity(velocityTracker,
mActivePointerId);
int delta = (int) (primaryDirection - mDownMotionPrimary);
float delta = primaryDirection - mDownMotionPrimary;
delta /= mOrientationHandler.getPrimaryScale(this);
int pageOrientedSize = mOrientationHandler.getMeasuredSize(getPageAt(mCurrentPage));
boolean isSignificantMove = Math.abs(delta) > pageOrientedSize *
SIGNIFICANT_MOVE_THRESHOLD;
boolean isSignificantMove = Math.abs(delta)
> pageOrientedSize * getSignificantMoveThreshold();
mTotalMotion += Math.abs(mLastMotion + mLastMotionRemainder - primaryDirection);
boolean passedSlop = mAllowEasyFling || mTotalMotion > mPageSlop;
@@ -1343,6 +1424,20 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
protected void onNotSnappingToPageInFreeScroll() { }
/**
* Called when the view edges absorb part of the scroll. Subclasses can override this
* to provide custom behavior during animation.
*/
protected void onEdgeAbsorbingScroll() {
}
/**
* Called when the current page closest to the center of the screen changes as part of the
* scroll. Subclasses can override this to provide custom behavior during scroll.
*/
protected void onScrollOverPageChanged() {
}
protected boolean shouldFlingForVelocity(int velocity) {
float threshold = mAllowEasyFling ? mEasyFlingThresholdVelocity : mFlingThresholdVelocity;
return Math.abs(velocity) > threshold;
@@ -1441,8 +1536,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
setCurrentPage(nextPage);
}
int page = indexToPage(indexOfChild(child));
if (page >= 0 && page != getCurrentPage() && !isInTouchMode()) {
int page = indexOfChild(child);
if (page >= 0 && !isVisible(page) && !isInTouchMode()) {
snapToPage(page);
}
}
@@ -1488,7 +1583,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return getDisplacementFromScreenCenter(childIndex, screenCenter);
}
private int getScreenCenter(int primaryScroll) {
protected int getScreenCenter(int primaryScroll) {
float primaryScale = mOrientationHandler.getPrimaryScale(this);
float primaryPivot = mOrientationHandler.getPrimaryValue(getPivotX(), getPivotY());
int pageOrientationSize = mOrientationHandler.getMeasuredSize(this);
@@ -1573,7 +1668,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return false;
}
if (FeatureFlags.IS_STUDIO_BUILD) {
if (FeatureFlags.IS_STUDIO_BUILD && !Utilities.IS_RUNNING_IN_TEST_HARNESS) {
duration *= Settings.Global.getFloat(getContext().getContentResolver(),
Settings.Global.WINDOW_ANIMATION_SCALE, 1);
}
@@ -1612,7 +1707,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public boolean scrollLeft() {
if (getNextPage() > 0) {
snapToPage(getNextPage() - 1);
snapToPage(getNextPage() - getPanelCount());
return true;
}
return mAllowOverScroll;
@@ -1620,12 +1715,25 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public boolean scrollRight() {
if (getNextPage() < getChildCount() - 1) {
snapToPage(getNextPage() + 1);
snapToPage(getNextPage() + getPanelCount());
return true;
}
return mAllowOverScroll;
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
if (mScroller.isFinished()) {
// This was not caused by the scroller, skip it.
return;
}
int newDestinationPage = getDestinationPage();
if (newDestinationPage >= 0 && newDestinationPage != mCurrentScrollOverPage) {
mCurrentScrollOverPage = newDestinationPage;
onScrollOverPageChanged();
}
}
@Override
public CharSequence getAccessibilityClassName() {
// Some accessibility services have special logic for ScrollView. Since we provide same
@@ -1643,22 +1751,25 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
final boolean pagesFlipped = isPageOrderFlipped();
int offset = (mAllowOverScroll ? 0 : 1);
info.setScrollable(getPageCount() > offset);
if (getCurrentPage() < getPageCount() - offset) {
info.setScrollable(getPageCount() > 0);
int primaryScroll = mOrientationHandler.getPrimaryScroll(this);
if (getCurrentPage() < getPageCount() - getPanelCount()
|| (getCurrentPage() == getPageCount() - getPanelCount()
&& primaryScroll != getScrollForPage(getPageCount() - getPanelCount()))) {
info.addAction(pagesFlipped ?
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
if (Utilities.ATLEAST_Q) {
info.addAction(mIsRtl ?
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT);
}
}
if (getCurrentPage() >= offset) {
if (getCurrentPage() > 0
|| (getCurrentPage() == 0 && primaryScroll != getScrollForPage(0))) {
info.addAction(pagesFlipped ?
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
if (Utilities.ATLEAST_Q) {
info.addAction(mIsRtl ?
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT
@@ -1705,16 +1816,16 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
} break;
case android.R.id.accessibilityActionPageRight: {
if (!mIsRtl) {
return scrollRight();
return scrollRight();
} else {
return scrollLeft();
return scrollLeft();
}
}
case android.R.id.accessibilityActionPageLeft: {
if (!mIsRtl) {
return scrollLeft();
return scrollLeft();
} else {
return scrollRight();
return scrollRight();
}
}
}