Merge "Fix not animating icons" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
887d4bb67f
@@ -140,9 +140,10 @@ public class QSIconViewImpl extends QSIconView {
|
|||||||
iv.setTag(R.id.qs_icon_tag, icon);
|
iv.setTag(R.id.qs_icon_tag, icon);
|
||||||
iv.setTag(R.id.qs_slash_tag, state.slash);
|
iv.setTag(R.id.qs_slash_tag, state.slash);
|
||||||
iv.setPadding(0, padding, 0, padding);
|
iv.setPadding(0, padding, 0, padding);
|
||||||
if (shouldAnimate && d instanceof Animatable2) {
|
if (d instanceof Animatable2) {
|
||||||
Animatable2 a = (Animatable2) d;
|
Animatable2 a = (Animatable2) d;
|
||||||
a.start();
|
a.start();
|
||||||
|
if (shouldAnimate) {
|
||||||
if (state.isTransient) {
|
if (state.isTransient) {
|
||||||
a.registerAnimationCallback(new AnimationCallback() {
|
a.registerAnimationCallback(new AnimationCallback() {
|
||||||
@Override
|
@Override
|
||||||
@@ -151,6 +152,10 @@ public class QSIconViewImpl extends QSIconView {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Sends animator to end of animation. Needs to be called after calling start.
|
||||||
|
a.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import com.android.systemui.plugins.qs.QSTile.State;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.InOrder;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
@UiThreadTest
|
@UiThreadTest
|
||||||
@@ -138,7 +140,7 @@ public class QSIconViewImplTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIconNotAnimatedWhenAllowAnimationsFalse() {
|
public void testIconStartedAndStoppedWhenAllowAnimationsFalse() {
|
||||||
ImageView iv = new ImageView(mContext);
|
ImageView iv = new ImageView(mContext);
|
||||||
AnimatedVectorDrawable d = mock(AnimatedVectorDrawable.class);
|
AnimatedVectorDrawable d = mock(AnimatedVectorDrawable.class);
|
||||||
State s = new State();
|
State s = new State();
|
||||||
@@ -148,7 +150,9 @@ public class QSIconViewImplTest extends SysuiTestCase {
|
|||||||
|
|
||||||
mIconView.updateIcon(iv, s, false);
|
mIconView.updateIcon(iv, s, false);
|
||||||
|
|
||||||
verify(d, never()).start();
|
InOrder inOrder = Mockito.inOrder(d);
|
||||||
|
inOrder.verify(d).start();
|
||||||
|
inOrder.verify(d).stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Drawable.ConstantState fakeConstantState(Drawable otherDrawable) {
|
private static Drawable.ConstantState fakeConstantState(Drawable otherDrawable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user