summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYinglei Wang <yingleiw@google.com>2020-01-23 03:12:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-23 03:12:13 +0000
commit51683fa8fa11f04aeff22d62881e04c30c9d0fbe (patch)
tree3e19b029facc017521746a0cfb03f8f6c8f65b66
parent2a8fae982844d3983f589f3cd5a92c69345be448 (diff)
parent20852a15efcc8e04166da65e4be544fc920869eb (diff)
Merge "Set stateDescription during ProgressBar initialization"
-rw-r--r--core/java/android/widget/ProgressBar.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 733a7753568a..970d70cf1fb4 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -52,7 +52,6 @@ import android.view.View;
import android.view.ViewDebug;
import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
@@ -307,6 +306,9 @@ public class ProgressBar extends View {
setMax(a.getInt(R.styleable.ProgressBar_max, mMax));
setProgress(a.getInt(R.styleable.ProgressBar_progress, mProgress));
+ // onProgressRefresh() is only called when the progress changes. So we should set
+ // stateDescription during initialization here.
+ super.setStateDescription(formatStateDescription(mProgress));
setSecondaryProgress(a.getInt(
R.styleable.ProgressBar_secondaryProgress, mSecondaryProgress));
@@ -1599,8 +1601,7 @@ public class ProgressBar extends View {
}
void onProgressRefresh(float scale, boolean fromUser, int progress) {
- if (AccessibilityManager.getInstance(mContext).isEnabled()
- && mCustomStateDescription == null) {
+ if (mCustomStateDescription == null) {
super.setStateDescription(formatStateDescription(mProgress));
}
}