OSDN Git Service

ProgressBar is important for accessibility by default.
authorSvetoslav <svetoslavganov@google.com>
Mon, 13 Jan 2014 23:25:58 +0000 (15:25 -0800)
committerSvetoslav <svetoslavganov@google.com>
Mon, 13 Jan 2014 23:26:02 +0000 (15:26 -0800)
If a view does not have callbacks, or content description, or does not draw
content, and it is marked as important for accessibility auto, then the system
decides it is not important and does not report it. Apparently progress bar
draws content that means something and it should be important for accessibility
by default.

Change-Id: Icd3837fb8b9e208c98b90707f3b195622d71949e

core/java/android/widget/ProgressBar.java

index 1fbcbcf..af9e2f0 100644 (file)
@@ -304,6 +304,11 @@ public class ProgressBar extends View {
         mMirrorForRtl = a.getBoolean(R.styleable.ProgressBar_mirrorForRtl, mMirrorForRtl);
 
         a.recycle();
+
+        // If not explicitly specified this view is important for accessibility.
+        if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
+            setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
+        }
     }
 
     /**