OSDN Git Service

QS: Add content description to page indicator
authorJason Monk <jmonk@google.com>
Wed, 13 Apr 2016 17:01:14 +0000 (13:01 -0400)
committerJason Monk <jmonk@google.com>
Wed, 13 Apr 2016 17:01:14 +0000 (13:01 -0400)
Change-Id: I4e9bdfe803d681484eb4c8915c44e37be40d8aa2
Fixes: 27325720

packages/SystemUI/res/layout/qs_paged_tile_layout.xml
packages/SystemUI/res/values/strings.xml
packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java

index 9dd3ad2..55d7fab 100644 (file)
@@ -33,7 +33,9 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_gravity="center"
-            android:gravity="center" />
+            android:gravity="center"
+            android:importantForAccessibility="yes"
+            android:focusable="true" />
 
         <TextView
             android:id="@android:id/edit"
index dc9ffa9..a4d7a18 100644 (file)
     <!-- accessibility label for button to expand quick settings [CHAR LIMIT=NONE] -->
     <string name="accessibility_quick_settings_expand">Expand quick settings.</string>
 
+    <!-- accessibility label for paging indicator in quick settings [CHAR LIMITi=NONE] -->
+    <string name="accessibility_quick_settings_page">Page <xliff:g name="current_page" example="1">%1$d</xliff:g> of <xliff:g name="num_pages" example="2">%2$d</xliff:g></string>
+
 </resources>
index 5cb46ac..e050b0d 100644 (file)
@@ -60,6 +60,8 @@ public class PageIndicator extends ViewGroup {
 
     public void setLocation(float location) {
         int index = (int) location;
+        setContentDescription(getContext().getString(R.string.accessibility_quick_settings_page,
+                (index + 1), getChildCount()));
         int position = index << 1 | ((location != index) ? 1 : 0);
         if (DEBUG) Log.d(TAG, "setLocation " + location + " " + index + " " + position);