mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Fix switch access for overview grid
- Removed overscroll checking in switch access, as overscroll isn't supported via snapToPage - Don't show forward/backward action if no further scroll is possible - When scrolling right in overveiw grid, snap to the next non-fully visible task - When scrolling left in overview grid, snap to a position that next non-fully visible task is on the left of the screen Fix: 204162346 Test: Use switch action in Workspace/Recents with and w/o RTL Change-Id: I0d4f201edf2da543703e88420e6f3255fb2ba16f
This commit is contained in:
@@ -1749,20 +1749,23 @@ 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);
|
||||
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);
|
||||
info.addAction(mIsRtl ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT);
|
||||
@@ -1807,16 +1810,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user