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

Commit 779bcfd5 authored by Robert Snoeberger's avatar Robert Snoeberger
Browse files

Skip refresh if number of pages hasn't changed

This gives a smoother animation when a media app is frequently
updating their notification.

Fixes: 157749719
Test: Play audio on SoundCloud with another media control appear in the
QS carousel. Page between players and check the animation of the page
indicator. It should be smooth and not jumpy.

Change-Id: Iabd77736eba0fb8e504297299a018079304c7489
parent 0ec54eaa
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ public class PageIndicator extends ViewGroup {
    }

    public void setNumPages(int numPages) {
        if (numPages == getChildCount()) {
            return;
        }
        TypedArray array = getContext().obtainStyledAttributes(
                new int[]{android.R.attr.colorControlActivated});
        int color = array.getColor(0, 0);
@@ -54,6 +57,9 @@ public class PageIndicator extends ViewGroup {

    /** Oveload of setNumPages that allows the indicator color to be specified.*/
    public void setNumPages(int numPages, int color) {
        if (numPages == getChildCount()) {
            return;
        }
        setVisibility(numPages > 1 ? View.VISIBLE : View.GONE);
        if (mAnimating) {
            Log.w(TAG, "setNumPages during animation");