Loading packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java +13 −5 Original line number Original line Diff line number Diff line Loading @@ -202,13 +202,21 @@ public class PhysicsAnimationLayout extends FrameLayout { // add a multiple property end listener to the layout that will call the end action // add a multiple property end listener to the layout that will call the end action // provided to startAll() once all animations on the animated properties complete. // provided to startAll() once all animations on the animated properties complete. return (endActions) -> { return (endActions) -> { if (endActions != null) { final Runnable runAllEndActions = () -> { mLayout.setEndActionForMultipleProperties( () -> { for (Runnable action : endActions) { for (Runnable action : endActions) { action.run(); action.run(); } } }, }; // If there aren't any children to animate, just run the end actions. if (mLayout.getChildCount() == 0) { runAllEndActions.run(); return; } if (endActions != null) { mLayout.setEndActionForMultipleProperties( runAllEndActions, allAnimatedProperties.toArray( allAnimatedProperties.toArray( new DynamicAnimation.ViewProperty[0])); new DynamicAnimation.ViewProperty[0])); } } Loading packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.never; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.os.SystemClock; import android.os.SystemClock; import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner; Loading Loading @@ -449,6 +450,18 @@ public class PhysicsAnimationLayoutTest extends PhysicsAnimationLayoutTestCase { Mockito.verify(allEnd, times(1)).run(); Mockito.verify(allEnd, times(1)).run(); } } @Test public void testAnimationsForChildrenFromIndex_noChildren() { mLayout.setController(mTestableController); final Runnable after = Mockito.mock(Runnable.class); mTestableController .animationsForChildrenFromIndex(0, (index, animation) -> { }) .startAll(after); verify(after, Mockito.times(1)).run(); } /** /** * Animation controller with configuration methods whose return values can be set by individual * Animation controller with configuration methods whose return values can be set by individual * tests. * tests. Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayout.java +13 −5 Original line number Original line Diff line number Diff line Loading @@ -202,13 +202,21 @@ public class PhysicsAnimationLayout extends FrameLayout { // add a multiple property end listener to the layout that will call the end action // add a multiple property end listener to the layout that will call the end action // provided to startAll() once all animations on the animated properties complete. // provided to startAll() once all animations on the animated properties complete. return (endActions) -> { return (endActions) -> { if (endActions != null) { final Runnable runAllEndActions = () -> { mLayout.setEndActionForMultipleProperties( () -> { for (Runnable action : endActions) { for (Runnable action : endActions) { action.run(); action.run(); } } }, }; // If there aren't any children to animate, just run the end actions. if (mLayout.getChildCount() == 0) { runAllEndActions.run(); return; } if (endActions != null) { mLayout.setEndActionForMultipleProperties( runAllEndActions, allAnimatedProperties.toArray( allAnimatedProperties.toArray( new DynamicAnimation.ViewProperty[0])); new DynamicAnimation.ViewProperty[0])); } } Loading
packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.never; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.os.SystemClock; import android.os.SystemClock; import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner; Loading Loading @@ -449,6 +450,18 @@ public class PhysicsAnimationLayoutTest extends PhysicsAnimationLayoutTestCase { Mockito.verify(allEnd, times(1)).run(); Mockito.verify(allEnd, times(1)).run(); } } @Test public void testAnimationsForChildrenFromIndex_noChildren() { mLayout.setController(mTestableController); final Runnable after = Mockito.mock(Runnable.class); mTestableController .animationsForChildrenFromIndex(0, (index, animation) -> { }) .startAll(after); verify(after, Mockito.times(1)).run(); } /** /** * Animation controller with configuration methods whose return values can be set by individual * Animation controller with configuration methods whose return values can be set by individual * tests. * tests. Loading