mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 09:26:51 +00:00
Merge changes I3cfdb715,Ic194afdb into main
* changes: Fix initial alpha when unstashing bubble bar Set additional bubble translation during stash
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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -181,9 +186,13 @@ class TransientBubbleStashControllerTest {
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0f)
|
||||
assertThat(bubbleBarView.scaleX).isEqualTo(mTransientBubbleStashController.getStashScaleX())
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(mTransientBubbleStashController.getStashScaleY())
|
||||
assertThat(bubbleBarView.background.alpha).isEqualTo(255)
|
||||
// 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 +283,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 +294,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 +322,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