mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Fixing reverted order of accessibility scrolling in Recents" into ub-launcher3-edmonton
This commit is contained in:
committed by
Android (Google) Code Review
commit
4ae69dea49
@@ -1510,17 +1510,24 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
return ScrollView.class.getName();
|
||||
}
|
||||
|
||||
protected boolean isPageOrderFlipped() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Accessibility */
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
final boolean pagesFlipped = isPageOrderFlipped();
|
||||
info.setScrollable(getPageCount() > 1);
|
||||
if (getCurrentPage() < getPageCount() - 1) {
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
|
||||
info.addAction(pagesFlipped ? AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD
|
||||
: AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
|
||||
}
|
||||
if (getCurrentPage() > 0) {
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
|
||||
info.addAction(pagesFlipped ? AccessibilityNodeInfo.ACTION_SCROLL_FORWARD
|
||||
: AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
|
||||
}
|
||||
|
||||
// Accessibility-wise, PagedView doesn't support long click, so disabling it.
|
||||
@@ -1544,24 +1551,40 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
event.setScrollable(getPageCount() > 1);
|
||||
}
|
||||
|
||||
private boolean accessibilityScrollLeft() {
|
||||
if (getCurrentPage() > 0) {
|
||||
scrollLeft();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean accessibilityScrollRight() {
|
||||
if (getCurrentPage() < getPageCount() - 1) {
|
||||
scrollRight();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
||||
if (super.performAccessibilityAction(action, arguments)) {
|
||||
return true;
|
||||
}
|
||||
final boolean pagesFlipped = isPageOrderFlipped();
|
||||
switch (action) {
|
||||
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
|
||||
if (getCurrentPage() < getPageCount() - 1) {
|
||||
scrollRight();
|
||||
if (pagesFlipped ? accessibilityScrollLeft() : accessibilityScrollRight()) {
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
|
||||
if (getCurrentPage() > 0) {
|
||||
scrollLeft();
|
||||
if (pagesFlipped ? accessibilityScrollRight() : accessibilityScrollLeft()) {
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user