Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 953ba5c7 authored by Yinglei Wang's avatar Yinglei Wang Committed by Automerger Merge Worker
Browse files

Merge "Add accessibility manager enabled check in progressbar" into rvc-qpr-dev am: 7419f4d0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12539313

Change-Id: Ifac7d07800c10f830d193395a885e6689b7b1eb1
parents bb076de2 7419f4d0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ 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;
@@ -310,9 +311,6 @@ 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));
@@ -1616,7 +1614,8 @@ public class ProgressBar extends View {
    }

    void onProgressRefresh(float scale, boolean fromUser, int progress) {
        if (mCustomStateDescription == null) {
        if (AccessibilityManager.getInstance(mContext).isEnabled()
                && mCustomStateDescription == null) {
            super.setStateDescription(formatStateDescription(mProgress));
        }
    }
@@ -2340,6 +2339,7 @@ public class ProgressBar extends View {
                    AccessibilityNodeInfo.RangeInfo.RANGE_TYPE_INT, getMin(), getMax(),
                    getProgress());
            info.setRangeInfo(rangeInfo);
            info.setStateDescription(formatStateDescription(mProgress));
        }
    }