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

Commit a05e8a58 authored by Romain Guy's avatar Romain Guy
Browse files

Prevent ProgressBar from updating itself when hidden.

Bug #2470737
parent 2299a553
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -696,8 +696,7 @@ public class ProgressBar extends View {
     * <p>Start the indeterminate progress animation.</p>
     */
    void startAnimation() {
        int visibility = getVisibility();
        if (visibility != VISIBLE) {
        if (getVisibility() != VISIBLE) {
            return;
        }

@@ -771,13 +770,27 @@ public class ProgressBar extends View {
                // let's be nice with the UI thread
                if (v == GONE || v == INVISIBLE) {
                    stopAnimation();
                } else if (v == VISIBLE) {
                } else {
                    startAnimation();
                }
            }
        }
    }

    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);

        if (mIndeterminate) {
            // let's be nice with the UI thread
            if (visibility == GONE || visibility == INVISIBLE) {
                stopAnimation();
            } else {
                startAnimation();
            }
        }
    }

    @Override
    public void invalidateDrawable(Drawable dr) {
        if (!mInDrawing) {