Merge "Fixing reverted order of accessibility scrolling in Recents" into ub-launcher3-edmonton
This commit is contained in:
commit
4ae69dea49
|
@ -1311,4 +1311,20 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
|||
public void revealClearAllButton() {
|
||||
scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChildrenForAccessibility(ArrayList<View> outChildren) {
|
||||
if (FLIP_RECENTS) {
|
||||
for (int i = getChildCount() - 1; i >= 0; --i) {
|
||||
outChildren.add(getChildAt(i));
|
||||
}
|
||||
} else {
|
||||
super.addChildrenForAccessibility(outChildren);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPageOrderFlipped() {
|
||||
return FLIP_RECENTS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue