diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-15 11:06:36 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-15 13:51:43 -0700 |
commit | 08055f66528330ff1a1d1d13c856647d86dd967d (patch) | |
tree | 046498c25e62e26a2b526c1cd5376ec869a3d6a8 /src/com/android/launcher2/PagedView.java | |
parent | ceca4ff1891baf033cd9d6951ec5a1d31473642f (diff) | |
download | android_packages_apps_Trebuchet-08055f66528330ff1a1d1d13c856647d86dd967d.tar.gz android_packages_apps_Trebuchet-08055f66528330ff1a1d1d13c856647d86dd967d.tar.bz2 android_packages_apps_Trebuchet-08055f66528330ff1a1d1d13c856647d86dd967d.zip |
Adding accessibility scroll support to PagedView.
1. Added support for accessibility scroll action to
PagedView.
2. Exposed AppsCustomizePagedView and Workspace for
acessibility if otherwise specified.
bug:5932640
Change-Id: I812e7c285cbc4d925390b9fae48a18acc68432ce
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 5d9cf81eb..02f1c22b8 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; +import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; @@ -1854,7 +1855,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); - info.setScrollable(true); + info.setScrollable(getPageCount() > 1); + if (getCurrentPage() < getPageCount() - 1) { + info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); + } + if (getCurrentPage() > 0) { + info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); + } } @Override @@ -1868,6 +1875,28 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } } + @Override + public boolean performAccessibilityAction(int action, Bundle arguments) { + if (super.performAccessibilityAction(action, arguments)) { + return true; + } + switch (action) { + case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { + if (getCurrentPage() < getPageCount() - 1) { + scrollRight(); + return true; + } + } break; + case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { + if (getCurrentPage() > 0) { + scrollLeft(); + return true; + } + } break; + } + return false; + } + protected String getCurrentPageDescription() { return String.format(getContext().getString(R.string.default_scroll_format), getNextPage() + 1, getChildCount()); |