Announce wallpaper selection for accessibility
BUG: 11012903
Change-Id: Ie926b131f3781a413f551943cc6ac19c42ca6c67
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9f4f20b..3e2ffce 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -41,6 +41,8 @@
<!-- Accessibility string used as a label for a particular wallpaper in the Wallpaper Picker list.
e.g. "Wallpaper 3 of 10" -->
<string name="wallpaper_accessibility_name">Wallpaper %1$d of %2$d</string>
+ <!-- Accessibility string used to announce that an item has been selected. -->
+ <string name="announce_selection">Selected <xliff:g id="label" example="Wallpaper 3 of 10">%1$s</xliff:g></string>
<!-- Label on button to delete wallpaper(s) -->
<string name="wallpaper_delete">Delete</string>
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java
index 9d3164b..3992170 100644
--- a/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -52,6 +52,7 @@
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
+import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
@@ -254,6 +255,10 @@
}
mSelectedThumb = v;
v.setSelected(true);
+ // TODO: Remove this once the accessibility framework and
+ // services have better support for selection state.
+ v.announceForAccessibility(
+ getString(R.string.announce_selection, v.getContentDescription()));
}
info.onClick(WallpaperPickerActivity.this);
}