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

Commit c164c02c authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Do not animate icons in tiles that shouldn't" into tm-qpr-dev

parents 71bf4aaf d2ee8bbf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public class QSIconViewImpl extends QSIconView {
            iv.setTag(R.id.qs_icon_tag, icon);
            iv.setTag(R.id.qs_slash_tag, state.slash);
            iv.setPadding(0, padding, 0, padding);
            if (d instanceof Animatable2) {
            if (shouldAnimate && d instanceof Animatable2) {
                Animatable2 a = (Animatable2) d;
                a.start();
                if (state.isTransient) {
+15 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.service.quicksettings.Tile;
import android.testing.AndroidTestingRunner;
@@ -136,6 +137,20 @@ public class QSIconViewImplTest extends SysuiTestCase {
        assertEquals(mIconView.getColor(s1), mIconView.getColor(s2));
    }

    @Test
    public void testIconNotAnimatedWhenAllowAnimationsFalse() {
        ImageView iv = new ImageView(mContext);
        AnimatedVectorDrawable d = mock(AnimatedVectorDrawable.class);
        State s = new State();
        s.icon = mock(Icon.class);
        when(s.icon.getDrawable(any())).thenReturn(d);
        when(s.icon.getInvisibleDrawable(any())).thenReturn(d);

        mIconView.updateIcon(iv, s, false);

        verify(d, never()).start();
    }

    private static Drawable.ConstantState fakeConstantState(Drawable otherDrawable) {
        return new Drawable.ConstantState() {
            @Override