support scroll backward to minus one screen via voice/switch access
Bug: 140406263 Test: Manual Change-Id: I604b12f8ba8706cbabc28acafd6c151166832f22
This commit is contained in:
1 parent
3463d1c5f9
commit
d5af944f41
2 files changed
+22
-7
No files matched your search
@@ -1543,7 +1543,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
snapToPage(getNextPage() - 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return onOverscroll(-getMeasuredWidth());
|
||||
}
|
||||
|
||||
public boolean scrollRight() {
|
||||
@@ -1551,7 +1551,15 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
snapToPage(getNextPage() + 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return onOverscroll(getMeasuredWidth());
|
||||
}
|
||||
|
||||
protected boolean onOverscroll(int amount) {
|
||||
if (!mAllowOverScroll) return false;
|
||||
onScrollInteractionBegin();
|
||||
overScroll(amount);
|
||||
onScrollInteractionEnd();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1571,8 +1579,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
final boolean pagesFlipped = isPageOrderFlipped();
|
||||
info.setScrollable(getPageCount() > 1);
|
||||
if (getCurrentPage() < getPageCount() - 1) {
|
||||
int offset = (mAllowOverScroll ? 0 : 1);
|
||||
info.setScrollable(getPageCount() > offset);
|
||||
if (getCurrentPage() < getPageCount() - offset) {
|
||||
info.addAction(pagesFlipped ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
|
||||
@@ -1580,7 +1589,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT);
|
||||
}
|
||||
if (getCurrentPage() > 0) {
|
||||
if (getCurrentPage() >= offset) {
|
||||
info.addAction(pagesFlipped ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
|
||||
@@ -1588,7 +1597,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT);
|
||||
}
|
||||
|
||||
// Accessibility-wise, PagedView doesn't support long click, so disabling it.
|
||||
// Besides disabling the accessibility long-click, this also prevents this view from getting
|
||||
// accessibility focus.
|
||||
@@ -1607,7 +1615,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
@Override
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
|
||||
super.onInitializeAccessibilityEvent(event);
|
||||
event.setScrollable(getPageCount() > 1);
|
||||
event.setScrollable(mAllowOverScroll || getPageCount() > 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user