diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-06-05 16:02:17 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-05 16:02:17 -0700 |
| commit | 7510230583e5ef5a94392e8ccdb1416b8d9f37cc (patch) | |
| tree | b1fdea31f3da07c320c36097c8c0c6606f5cece4 /core/java/android/view/View.java | |
| parent | f943b834b6670c1b7b4e93ab70a327f8e509561a (diff) | |
| parent | f1abc4253111907ffb8e5ba19dffa8d00d92fc45 (diff) | |
am f1abc425: am cab5b8a9: Merge "Nodes with contentDescription should always be important for accessibility." into jb-dev
* commit 'f1abc4253111907ffb8e5ba19dffa8d00d92fc45':
Nodes with contentDescription should always be important for accessibility.
Diffstat (limited to 'core/java/android/view/View.java')
| -rw-r--r-- | core/java/android/view/View.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 12b373ba8243..f1e1987cbe7e 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3442,7 +3442,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } break; case com.android.internal.R.styleable.View_contentDescription: - mContentDescription = a.getString(attr); + setContentDescription(a.getString(attr)); break; case com.android.internal.R.styleable.View_soundEffectsEnabled: if (!a.getBoolean(attr, true)) { @@ -5042,6 +5042,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @RemotableViewMethod public void setContentDescription(CharSequence contentDescription) { mContentDescription = contentDescription; + final boolean nonEmptyDesc = contentDescription != null && contentDescription.length() > 0; + if (nonEmptyDesc && getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { + setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); + } } /** |
