mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Set additional bubble translation during stash
Fixes bubbles stash translation not getting cleared up after stash animation finishes. Bubbles are clipped using an outline animator during the stash animation. They need separate translation applied to keep them within the bounds of the bubble bar that is also shrinking and moving. Set the translation for the bubbles in the stash controller so we can reset the translation after the animation has finished. Bug: 365829293 Flag: com.android.wm.shell.enable_bubble_bar Test: TransientBubbleStashControllerTest Test: have bubbles in bubble bar, trigger a new auto expanding bubble, check translation for bubbles Change-Id: Ic194afdb4d650fcd525355d8bae08dd651d1ea05
This commit is contained in:
@@ -32,6 +32,7 @@ import com.android.launcher3.taskbar.TaskbarInsetsController
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarView
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleStashedHandleViewController
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleView
|
||||
import com.android.launcher3.util.MultiValueAlpha
|
||||
import com.android.wm.shell.shared.animation.PhysicsAnimator
|
||||
import com.android.wm.shell.shared.animation.PhysicsAnimatorTestUtils
|
||||
@@ -55,8 +56,8 @@ class TransientBubbleStashControllerTest {
|
||||
|
||||
companion object {
|
||||
const val TASKBAR_BOTTOM_SPACE = 5
|
||||
const val BUBBLE_BAR_WIDTH = 200f
|
||||
const val BUBBLE_BAR_HEIGHT = 100f
|
||||
const val BUBBLE_BAR_WIDTH = 200
|
||||
const val BUBBLE_BAR_HEIGHT = 100
|
||||
const val HOTSEAT_TRANSLATION_Y = -45f
|
||||
const val TASK_BAR_TRANSLATION_Y = -TASKBAR_BOTTOM_SPACE
|
||||
const val HANDLE_VIEW_WIDTH = 150
|
||||
@@ -77,10 +78,12 @@ class TransientBubbleStashControllerTest {
|
||||
private val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
private lateinit var bubbleBarView: BubbleBarView
|
||||
private lateinit var stashedHandleView: StashedHandleView
|
||||
private lateinit var bubbleView: BubbleView
|
||||
private lateinit var barTranslationY: AnimatedFloat
|
||||
private lateinit var barScaleX: AnimatedFloat
|
||||
private lateinit var barScaleY: AnimatedFloat
|
||||
private lateinit var barAlpha: MultiValueAlpha
|
||||
private lateinit var bubbleOffsetY: AnimatedFloat
|
||||
private lateinit var bubbleAlpha: AnimatedFloat
|
||||
private lateinit var backgroundAlpha: AnimatedFloat
|
||||
private lateinit var stashedHandleAlpha: MultiValueAlpha
|
||||
@@ -105,7 +108,7 @@ class TransientBubbleStashControllerTest {
|
||||
taskbarInsetsController,
|
||||
bubbleBarViewController,
|
||||
bubbleStashedHandleViewController,
|
||||
ImmediateAction()
|
||||
ImmediateAction(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -161,11 +164,13 @@ class TransientBubbleStashControllerTest {
|
||||
mTransientBubbleStashController.isStashed = false
|
||||
whenever(bubbleBarViewController.isHiddenForNoBubbles).thenReturn(false)
|
||||
|
||||
val bubbleInitialTranslation = bubbleView.translationY
|
||||
|
||||
// When stash
|
||||
getInstrumentation().runOnMainSync {
|
||||
mTransientBubbleStashController.updateStashedAndExpandedState(
|
||||
stash = true,
|
||||
expand = false
|
||||
expand = false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -184,6 +189,9 @@ class TransientBubbleStashControllerTest {
|
||||
// Handle view is visible
|
||||
assertThat(stashedHandleView.translationY).isEqualTo(0)
|
||||
assertThat(stashedHandleView.alpha).isEqualTo(1)
|
||||
// Bubble view is reset
|
||||
assertThat(bubbleView.translationY).isEqualTo(bubbleInitialTranslation)
|
||||
assertThat(bubbleView.alpha).isEqualTo(1f)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -274,7 +282,7 @@ class TransientBubbleStashControllerTest {
|
||||
val height = mTransientBubbleStashController.getTouchableHeight()
|
||||
|
||||
// Then bubble bar height is returned
|
||||
assertThat(height).isEqualTo(BUBBLE_BAR_HEIGHT.toInt())
|
||||
assertThat(height).isEqualTo(BUBBLE_BAR_HEIGHT)
|
||||
}
|
||||
|
||||
private fun advanceTimeBy(advanceMs: Long) {
|
||||
@@ -285,20 +293,26 @@ class TransientBubbleStashControllerTest {
|
||||
private fun setUpBubbleBarView() {
|
||||
getInstrumentation().runOnMainSync {
|
||||
bubbleBarView = BubbleBarView(context)
|
||||
bubbleBarView.layoutParams = FrameLayout.LayoutParams(0, 0)
|
||||
bubbleBarView.layoutParams =
|
||||
FrameLayout.LayoutParams(BUBBLE_BAR_WIDTH, BUBBLE_BAR_HEIGHT)
|
||||
bubbleView = BubbleView(context)
|
||||
bubbleBarView.addBubble(bubbleView)
|
||||
bubbleBarView.layout(0, 0, BUBBLE_BAR_WIDTH, BUBBLE_BAR_HEIGHT)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpStashedHandleView() {
|
||||
getInstrumentation().runOnMainSync {
|
||||
stashedHandleView = StashedHandleView(context)
|
||||
stashedHandleView.layoutParams = FrameLayout.LayoutParams(0, 0)
|
||||
stashedHandleView.layoutParams =
|
||||
FrameLayout.LayoutParams(HANDLE_VIEW_WIDTH, HANDLE_VIEW_HEIGHT)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpBubbleBarController() {
|
||||
barTranslationY =
|
||||
AnimatedFloat(Runnable { bubbleBarView.translationY = barTranslationY.value })
|
||||
bubbleOffsetY = AnimatedFloat { value -> bubbleBarView.setBubbleOffsetY(value) }
|
||||
barScaleX = AnimatedFloat { value -> bubbleBarView.scaleX = value }
|
||||
barScaleY = AnimatedFloat { value -> bubbleBarView.scaleY = value }
|
||||
barAlpha = MultiValueAlpha(bubbleBarView, 1 /* num alpha channels */)
|
||||
@@ -307,13 +321,16 @@ class TransientBubbleStashControllerTest {
|
||||
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(true)
|
||||
whenever(bubbleBarViewController.bubbleBarTranslationY).thenReturn(barTranslationY)
|
||||
whenever(bubbleBarViewController.bubbleOffsetY).thenReturn(bubbleOffsetY)
|
||||
whenever(bubbleBarViewController.bubbleBarBackgroundScaleX).thenReturn(barScaleX)
|
||||
whenever(bubbleBarViewController.bubbleBarBackgroundScaleY).thenReturn(barScaleY)
|
||||
whenever(bubbleBarViewController.bubbleBarAlpha).thenReturn(barAlpha)
|
||||
whenever(bubbleBarViewController.bubbleBarBubbleAlpha).thenReturn(bubbleAlpha)
|
||||
whenever(bubbleBarViewController.bubbleBarBackgroundAlpha).thenReturn(backgroundAlpha)
|
||||
whenever(bubbleBarViewController.bubbleBarCollapsedWidth).thenReturn(BUBBLE_BAR_WIDTH)
|
||||
whenever(bubbleBarViewController.bubbleBarCollapsedHeight).thenReturn(BUBBLE_BAR_HEIGHT)
|
||||
whenever(bubbleBarViewController.bubbleBarCollapsedWidth)
|
||||
.thenReturn(BUBBLE_BAR_WIDTH.toFloat())
|
||||
whenever(bubbleBarViewController.bubbleBarCollapsedHeight)
|
||||
.thenReturn(BUBBLE_BAR_HEIGHT.toFloat())
|
||||
whenever(bubbleBarViewController.createRevealAnimatorForStashChange(any()))
|
||||
.thenReturn(AnimatorSet())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user