mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-05 02:16:49 +00:00
Add directional accessibility page actions to PagedView
For PagedView, when isPageOrderFlipped is true, it means the LTR mode is flipped. For the "recents" in launcher, isPageOrderFlipped is true. However, this doesn't affect the directional page operations since scrollLeft()/Right() already has correct Rtl considerations. See b/78788182 for more information on the LTR mode. Test: Tested with the "recents" in launcher. Verified that page left action always move pages to the right (so that the next page from the left side shows), and page right actions always move pages to the left (so that the next page from the right side shows). Also tested with the home screen 1/2, 2/2 paging. Bug: 136277517 Change-Id: I965d651c37d258eaa8ea347d1ad6f698f9b590bf
This commit is contained in:
@@ -1562,12 +1562,20 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
final boolean pagesFlipped = isPageOrderFlipped();
|
||||
info.setScrollable(getPageCount() > 1);
|
||||
if (getCurrentPage() < getPageCount() - 1) {
|
||||
info.addAction(pagesFlipped ? AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD
|
||||
: AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
|
||||
info.addAction(pagesFlipped ?
|
||||
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() > 0) {
|
||||
info.addAction(pagesFlipped ? AccessibilityNodeInfo.ACTION_SCROLL_FORWARD
|
||||
: AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
|
||||
info.addAction(pagesFlipped ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
|
||||
info.addAction(mIsRtl ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT);
|
||||
}
|
||||
|
||||
// Accessibility-wise, PagedView doesn't support long click, so disabling it.
|
||||
@@ -1607,8 +1615,21 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
if (pagesFlipped ? scrollRight() : scrollLeft()) {
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
case android.R.id.accessibilityActionPageRight: {
|
||||
if (!mIsRtl) {
|
||||
return scrollRight();
|
||||
} else {
|
||||
return scrollLeft();
|
||||
}
|
||||
}
|
||||
case android.R.id.accessibilityActionPageLeft: {
|
||||
if (!mIsRtl) {
|
||||
return scrollLeft();
|
||||
} else {
|
||||
return scrollRight();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user