Loading packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -265,6 +265,11 @@ class SystemEventChipAnimationController @Inject constructor( // not animating then [prepareChipAnimation] will take care of it for us // not animating then [prepareChipAnimation] will take care of it for us currentAnimatedView?.let { currentAnimatedView?.let { updateChipBounds(it, newContentArea) updateChipBounds(it, newContentArea) // Since updateCurrentAnimatedView can only be called during an animation, we // have to create a dummy animator here to apply the new chip bounds val animator = ValueAnimator.ofInt(0, 1).setDuration(0) animator.addUpdateListener { updateCurrentAnimatedView() } animator.start() } } } } }) }) Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.statusbar.events import android.content.Context import android.content.Context import android.graphics.Rect import android.graphics.Rect import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.util.Pair import android.util.Pair import android.view.Gravity import android.view.Gravity import android.view.View import android.view.View Loading @@ -37,11 +39,14 @@ import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Before import org.junit.Test import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations import org.mockito.MockitoAnnotations @SmallTest @SmallTest @RunWith(AndroidTestingRunner::class) @TestableLooper.RunWithLooper class SystemEventChipAnimationControllerTest : SysuiTestCase() { class SystemEventChipAnimationControllerTest : SysuiTestCase() { private lateinit var controller: SystemEventChipAnimationController private lateinit var controller: SystemEventChipAnimationController Loading Loading @@ -159,7 +164,7 @@ class SystemEventChipAnimationControllerTest : SysuiTestCase() { assertThat(chipRect).isEqualTo(Rect(890, 25, 990, 75)) assertThat(chipRect).isEqualTo(Rect(890, 25, 990, 75)) } } class TestView(context: Context) : View(context), BackgroundAnimatableView { private class TestView(context: Context) : View(context), BackgroundAnimatableView { override val view: View override val view: View get() = this get() = this Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -265,6 +265,11 @@ class SystemEventChipAnimationController @Inject constructor( // not animating then [prepareChipAnimation] will take care of it for us // not animating then [prepareChipAnimation] will take care of it for us currentAnimatedView?.let { currentAnimatedView?.let { updateChipBounds(it, newContentArea) updateChipBounds(it, newContentArea) // Since updateCurrentAnimatedView can only be called during an animation, we // have to create a dummy animator here to apply the new chip bounds val animator = ValueAnimator.ofInt(0, 1).setDuration(0) animator.addUpdateListener { updateCurrentAnimatedView() } animator.start() } } } } }) }) Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.statusbar.events import android.content.Context import android.content.Context import android.graphics.Rect import android.graphics.Rect import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.util.Pair import android.util.Pair import android.view.Gravity import android.view.Gravity import android.view.View import android.view.View Loading @@ -37,11 +39,14 @@ import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Before import org.junit.Test import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations import org.mockito.MockitoAnnotations @SmallTest @SmallTest @RunWith(AndroidTestingRunner::class) @TestableLooper.RunWithLooper class SystemEventChipAnimationControllerTest : SysuiTestCase() { class SystemEventChipAnimationControllerTest : SysuiTestCase() { private lateinit var controller: SystemEventChipAnimationController private lateinit var controller: SystemEventChipAnimationController Loading Loading @@ -159,7 +164,7 @@ class SystemEventChipAnimationControllerTest : SysuiTestCase() { assertThat(chipRect).isEqualTo(Rect(890, 25, 990, 75)) assertThat(chipRect).isEqualTo(Rect(890, 25, 990, 75)) } } class TestView(context: Context) : View(context), BackgroundAnimatableView { private class TestView(context: Context) : View(context), BackgroundAnimatableView { override val view: View override val view: View get() = this get() = this Loading