Fixing reverted order of accessibility scrolling in Recents
Bug: 78788182 Change-Id: I275381e65bbd2fa24e427fea0bb9ca44366e0357 Testing: Manual
This commit is contained in:
parent
d10001b5d6
commit
0fc0713253
|
@ -1255,4 +1255,20 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||||
public void revealClearAllButton() {
|
public void revealClearAllButton() {
|
||||||
scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1495,17 +1495,24 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||||
return ScrollView.class.getName();
|
return ScrollView.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isPageOrderFlipped() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Accessibility */
|
/* Accessibility */
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||||
super.onInitializeAccessibilityNodeInfo(info);
|
super.onInitializeAccessibilityNodeInfo(info);
|
||||||
|
final boolean pagesFlipped = isPageOrderFlipped();
|
||||||
info.setScrollable(getPageCount() > 1);
|
info.setScrollable(getPageCount() > 1);
|
||||||
if (getCurrentPage() < 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) {
|
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.
|
// Accessibility-wise, PagedView doesn't support long click, so disabling it.
|
||||||
|
@ -1529,24 +1536,40 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||||
event.setScrollable(getPageCount() > 1);
|
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
|
@Override
|
||||||
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
||||||
if (super.performAccessibilityAction(action, arguments)) {
|
if (super.performAccessibilityAction(action, arguments)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
final boolean pagesFlipped = isPageOrderFlipped();
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
|
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
|
||||||
if (getCurrentPage() < getPageCount() - 1) {
|
if (pagesFlipped ? accessibilityScrollLeft() : accessibilityScrollRight()) {
|
||||||
scrollRight();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
|
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
|
||||||
if (getCurrentPage() > 0) {
|
if (pagesFlipped ? accessibilityScrollRight() : accessibilityScrollLeft()) {
|
||||||
scrollLeft();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue