Add accessibility actions for scrolling in different directions
b/20157498
ACTION_SCROLL_UP, ACTION_SCROLL_DOWN, ACTION_SCROLL_LEFT and ACTION_SCROLL_RIGHT
actionos were added in addition to ACTION_SCROLL_FORWARD/BACKWARD
Change-Id: I8d5182a8add32085a354b280496b3d38ec79be32
diff --git a/core/java/com/android/internal/widget/ViewPager.java b/core/java/com/android/internal/widget/ViewPager.java
index 441e640..e76302b 100644
--- a/core/java/com/android/internal/widget/ViewPager.java
+++ b/core/java/com/android/internal/widget/ViewPager.java
@@ -47,6 +47,8 @@
import android.widget.EdgeEffect;
import android.widget.Scroller;
+import com.android.internal.R;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -2720,10 +2722,12 @@
if (canScrollHorizontally(1)) {
info.addAction(AccessibilityAction.ACTION_SCROLL_FORWARD);
+ info.addAction(AccessibilityAction.ACTION_SCROLL_RIGHT);
}
if (canScrollHorizontally(-1)) {
info.addAction(AccessibilityAction.ACTION_SCROLL_BACKWARD);
+ info.addAction(AccessibilityAction.ACTION_SCROLL_LEFT);
}
}
@@ -2735,12 +2739,14 @@
switch (action) {
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:
+ case R.id.accessibilityActionScrollRight:
if (canScrollHorizontally(1)) {
setCurrentItem(mCurItem + 1);
return true;
}
return false;
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:
+ case R.id.accessibilityActionScrollLeft:
if (canScrollHorizontally(-1)) {
setCurrentItem(mCurItem - 1);
return true;