Update setting taskbar window height
Updated the logic to set the taskbar window height to accommodate the bubble bar with its maximum flyout height before the bubble bar animation begins. The height is reverted to the default value once the animation is completed. Fixes: 378400160 Flag: com.android.wm.shell.enable_bubble_bar Test: Manual. Set 3-button navigation mode and have the QSB placed above the hotseat. Send a notification that will display a bubble, and observe the bubble bar animation and final placement aligned with the QSB. Next, set gesture navigation mode and repeat the flow above. Observe that the bubble bar is aligned with the hotseat icons. Felix video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/gYMVt0sH4si0KOpaBxIPem Tangor video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/fz95MbjcjW3awStnuOl8BJ Change-Id: I239f935743c3936fed44822c3c62652073ffefe2
This commit is contained in:
@@ -1138,6 +1138,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return getSetupWindowSize();
|
||||
}
|
||||
|
||||
int bubbleBarTop = mControllers.bubbleControllers.map(bubbleControllers ->
|
||||
bubbleControllers.bubbleBarViewController.getBubbleBarWithFlyoutMaximumHeight()
|
||||
).orElse(0);
|
||||
int taskbarWindowSize;
|
||||
boolean shouldTreatAsTransient = DisplayController.isTransientTaskbar(this)
|
||||
|| (enableTaskbarPinning() && !isThreeButtonNav());
|
||||
|
||||
@@ -1154,16 +1158,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
DeviceProfile transientTaskbarDp = mDeviceProfile.toBuilder(this)
|
||||
.setIsTransientTaskbar(true).build();
|
||||
|
||||
return transientTaskbarDp.taskbarHeight
|
||||
taskbarWindowSize = transientTaskbarDp.taskbarHeight
|
||||
+ (2 * transientTaskbarDp.taskbarBottomMargin)
|
||||
+ Math.max(extraHeightForTaskbarTooltips, resources.getDimensionPixelSize(
|
||||
R.dimen.transient_taskbar_shadow_blur));
|
||||
return Math.max(taskbarWindowSize, bubbleBarTop);
|
||||
}
|
||||
|
||||
|
||||
return mDeviceProfile.taskbarHeight
|
||||
taskbarWindowSize = mDeviceProfile.taskbarHeight
|
||||
+ getCornerRadius()
|
||||
+ extraHeightForTaskbarTooltips;
|
||||
return Math.max(taskbarWindowSize, bubbleBarTop);
|
||||
}
|
||||
|
||||
public int getSetupWindowSize() {
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3.taskbar.bubbles
|
||||
|
||||
/** Controls the parent view height. */
|
||||
interface BubbleBarParentViewHeightUpdateNotifier {
|
||||
|
||||
/** Notify parent that top boundary should be updated. */
|
||||
fun updateTopBoundary()
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class BubbleBarViewController {
|
||||
mBubbleBarContainer, createFlyoutPositioner(), createFlyoutCallbacks());
|
||||
mBubbleBarViewAnimator = new BubbleBarViewAnimator(
|
||||
mBarView, mBubbleStashController, mBubbleBarFlyoutController,
|
||||
mBubbleBarController::showExpandedView);
|
||||
createBubbleBarParentViewController(), mBubbleBarController::showExpandedView);
|
||||
mTaskbarViewPropertiesProvider = taskbarViewPropertiesProvider;
|
||||
onBubbleBarConfigurationChanged(/* animate= */ false);
|
||||
mActivity.addOnDeviceProfileChangeListener(
|
||||
@@ -318,17 +318,6 @@ public class BubbleBarViewController {
|
||||
|
||||
private FlyoutCallbacks createFlyoutCallbacks() {
|
||||
return new FlyoutCallbacks() {
|
||||
@Override
|
||||
public void extendTopBoundary(int space) {
|
||||
int defaultSize = mActivity.getDefaultTaskbarWindowSize();
|
||||
mActivity.setTaskbarWindowSize(defaultSize + space);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTopBoundary() {
|
||||
mActivity.setTaskbarWindowSize(mActivity.getDefaultTaskbarWindowSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flyoutClicked() {
|
||||
interruptAnimationForTouch();
|
||||
@@ -337,6 +326,15 @@ public class BubbleBarViewController {
|
||||
};
|
||||
}
|
||||
|
||||
private BubbleBarParentViewHeightUpdateNotifier createBubbleBarParentViewController() {
|
||||
return new BubbleBarParentViewHeightUpdateNotifier() {
|
||||
@Override
|
||||
public void updateTopBoundary() {
|
||||
mActivity.setTaskbarWindowSize(mActivity.getDefaultTaskbarWindowSize());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void onBubbleClicked(BubbleView bubbleView) {
|
||||
if (mBubbleBarPinning.isAnimating()) return;
|
||||
bubbleView.markSeen();
|
||||
@@ -585,6 +583,19 @@ public class BubbleBarViewController {
|
||||
return mHiddenForNoBubbles;
|
||||
}
|
||||
|
||||
/** Returns maximum height of the bubble bar with the flyout view. */
|
||||
public int getBubbleBarWithFlyoutMaximumHeight() {
|
||||
if (!isBubbleBarVisible()) return 0;
|
||||
int bubbleBarTopOnHome = (int) (mBubbleStashController.getBubbleBarVerticalCenterForHome()
|
||||
+ mBarView.getBubbleBarCollapsedHeight() / 2);
|
||||
int result = (int) (bubbleBarTopOnHome + mBarView.getArrowHeight());
|
||||
if (isAnimatingNewBubble()) {
|
||||
// when animating new bubble add the maximum height of the flyout view
|
||||
result += mBubbleBarFlyoutController.getMaximumFlyoutHeight();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the bubble bar should be hidden because there are no bubbles.
|
||||
*/
|
||||
|
||||
+16
-6
@@ -25,6 +25,7 @@ import androidx.dynamicanimation.animation.DynamicAnimation
|
||||
import androidx.dynamicanimation.animation.SpringForce
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarBubble
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarParentViewHeightUpdateNotifier
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarView
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleView
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController
|
||||
@@ -39,6 +40,7 @@ constructor(
|
||||
private val bubbleBarView: BubbleBarView,
|
||||
private val bubbleStashController: BubbleStashController,
|
||||
private val bubbleBarFlyoutController: BubbleBarFlyoutController,
|
||||
private val bubbleBarParentViewHeightUpdateNotifier: BubbleBarParentViewHeightUpdateNotifier,
|
||||
private val onExpanded: Runnable,
|
||||
private val scheduler: Scheduler = HandlerScheduler(bubbleBarView),
|
||||
) {
|
||||
@@ -342,7 +344,7 @@ constructor(
|
||||
scheduler.post(buildHandleToBubbleBarAnimation(initialVelocity = finalVelocity))
|
||||
return@addEndListener
|
||||
}
|
||||
animatingBubble = null
|
||||
clearAnimatingBubble()
|
||||
if (!canceled) bubbleStashController.stashBubbleBarImmediate()
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
bubbleBarView.scaleY = 1f
|
||||
@@ -378,7 +380,7 @@ constructor(
|
||||
moveToState(AnimatingBubble.State.ANIMATING_OUT)
|
||||
bubbleBarFlyoutController.collapseFlyout {
|
||||
onFlyoutRemoved()
|
||||
animatingBubble = null
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
bubbleStashController.showBubbleBarImmediate()
|
||||
bubbleStashController.updateTaskbarTouchRegion()
|
||||
@@ -437,7 +439,7 @@ constructor(
|
||||
moveToState(AnimatingBubble.State.ANIMATING_OUT)
|
||||
bubbleBarFlyoutController.collapseFlyout {
|
||||
onFlyoutRemoved()
|
||||
animatingBubble = null
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
bubbleStashController.showBubbleBarImmediate()
|
||||
bubbleStashController.updateTaskbarTouchRegion()
|
||||
@@ -515,7 +517,7 @@ constructor(
|
||||
val hideAnimation = animatingBubble?.hideAnimation ?: return
|
||||
scheduler.cancel(hideAnimation)
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
animatingBubble = null
|
||||
clearAnimatingBubble()
|
||||
}
|
||||
|
||||
/** Notifies the animator that the taskbar area was touched during an animation. */
|
||||
@@ -523,7 +525,7 @@ constructor(
|
||||
cancelFlyout()
|
||||
val hideAnimation = animatingBubble?.hideAnimation ?: return
|
||||
scheduler.cancel(hideAnimation)
|
||||
animatingBubble = null
|
||||
clearAnimatingBubble()
|
||||
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
bubbleStashController.onNewBubbleAnimationInterrupted(
|
||||
@@ -672,7 +674,7 @@ constructor(
|
||||
private fun cancelHideAnimation() {
|
||||
val hideAnimation = animatingBubble?.hideAnimation ?: return
|
||||
scheduler.cancel(hideAnimation)
|
||||
animatingBubble = null
|
||||
clearAnimatingBubble()
|
||||
bubbleBarView.relativePivotY = 1f
|
||||
bubbleStashController.showBubbleBarImmediate()
|
||||
}
|
||||
@@ -700,6 +702,14 @@ constructor(
|
||||
private fun moveToState(state: AnimatingBubble.State) {
|
||||
val animatingBubble = this.animatingBubble ?: return
|
||||
this.animatingBubble = animatingBubble.copy(state = state)
|
||||
if (state == AnimatingBubble.State.ANIMATING_IN) {
|
||||
bubbleBarParentViewHeightUpdateNotifier.updateTopBoundary()
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearAnimatingBubble() {
|
||||
animatingBubble = null
|
||||
bubbleBarParentViewHeightUpdateNotifier.updateTopBoundary()
|
||||
}
|
||||
|
||||
private fun expandBubbleBar() {
|
||||
|
||||
+6
-13
@@ -35,6 +35,8 @@ constructor(
|
||||
private val flyoutScheduler: FlyoutScheduler = HandlerScheduler(container),
|
||||
) {
|
||||
|
||||
val maximumFlyoutHeight: Int = BubbleBarFlyoutView.getMaximumViewHeight(container.context)
|
||||
|
||||
private companion object {
|
||||
const val EXPAND_ANIMATION_DURATION_MS = 400L
|
||||
const val COLLAPSE_ANIMATION_DURATION_MS = 350L
|
||||
@@ -61,6 +63,8 @@ constructor(
|
||||
return rect
|
||||
}
|
||||
|
||||
fun getFlyoutMaxHeight(): Int = BubbleBarFlyoutView.getMaximumViewHeight(container.context)
|
||||
|
||||
fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) {
|
||||
flyout?.let(container::removeView)
|
||||
val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler)
|
||||
@@ -102,11 +106,10 @@ constructor(
|
||||
}
|
||||
}
|
||||
animator.addListener(
|
||||
onStart = { extendTopBoundary() },
|
||||
onEnd = {
|
||||
endAction()
|
||||
flyout.setOnClickListener { callbacks.flyoutClicked() }
|
||||
},
|
||||
}
|
||||
)
|
||||
animator.start()
|
||||
}
|
||||
@@ -114,14 +117,13 @@ constructor(
|
||||
fun updateFlyoutFullyExpanded(message: BubbleBarFlyoutMessage, onEnd: () -> Unit) {
|
||||
val flyout = flyout ?: return
|
||||
hideFlyout(AnimationType.FADE) {
|
||||
callbacks.resetTopBoundary()
|
||||
flyout.updateData(message) { showFlyout(AnimationType.FADE, onEnd) }
|
||||
}
|
||||
}
|
||||
|
||||
fun updateFlyoutWhileExpanding(message: BubbleBarFlyoutMessage) {
|
||||
val flyout = flyout ?: return
|
||||
flyout.updateData(message) { extendTopBoundary() }
|
||||
flyout.updateData(message) {}
|
||||
}
|
||||
|
||||
fun updateFlyoutWhileCollapsing(message: BubbleBarFlyoutMessage, onEnd: () -> Unit) {
|
||||
@@ -131,14 +133,6 @@ constructor(
|
||||
flyout.updateData(message) { showFlyout(AnimationType.MORPH, onEnd) }
|
||||
}
|
||||
|
||||
private fun extendTopBoundary() {
|
||||
val flyout = flyout ?: return
|
||||
val flyoutTop = flyout.top + flyout.translationY
|
||||
// If the top position of the flyout is negative, then it's bleeding over the
|
||||
// top boundary of its parent view
|
||||
if (flyoutTop < 0) callbacks.extendTopBoundary(space = -flyoutTop.toInt())
|
||||
}
|
||||
|
||||
fun cancelFlyout(endAction: () -> Unit) {
|
||||
hideFlyout(AnimationType.FADE) {
|
||||
cleanupFlyoutView()
|
||||
@@ -184,7 +178,6 @@ constructor(
|
||||
private fun cleanupFlyoutView() {
|
||||
container.removeView(flyout)
|
||||
this@BubbleBarFlyoutController.flyout = null
|
||||
callbacks.resetTopBoundary()
|
||||
}
|
||||
|
||||
fun hasFlyout() = flyout != null
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar.bubbles.flyout
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Outline
|
||||
@@ -44,11 +45,27 @@ class BubbleBarFlyoutView(
|
||||
scheduler: FlyoutScheduler? = null,
|
||||
) : ConstraintLayout(context) {
|
||||
|
||||
private companion object {
|
||||
// the minimum progress of the expansion animation before the content starts fading in.
|
||||
const val MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA = 0.75f
|
||||
companion object {
|
||||
// the rate multiple for the background color animation relative to the morph animation.
|
||||
const val BACKGROUND_COLOR_CHANGE_RATE = 5
|
||||
// the minimum progress of the expansion animation before the content starts fading in.
|
||||
private const val MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA = 0.75f
|
||||
|
||||
private const val TEXT_ROW_HEIGHT_SP = 20
|
||||
private const val MAX_ROWS_COUNT = 3
|
||||
|
||||
/** Returns the maximum possible height of the flyout view. */
|
||||
fun getMaximumViewHeight(context: Context): Int {
|
||||
val verticalPaddings = getFlyoutPadding(context) * 2
|
||||
val textSizeSp = TEXT_ROW_HEIGHT_SP * MAX_ROWS_COUNT
|
||||
val textSizePx = textSizeSp * Resources.getSystem().displayMetrics.scaledDensity
|
||||
val triangleHeight =
|
||||
context.resources.getDimensionPixelSize(R.dimen.bubblebar_flyout_triangle_height)
|
||||
return verticalPaddings + textSizePx.toInt() + triangleHeight
|
||||
}
|
||||
|
||||
private fun getFlyoutPadding(context: Context) =
|
||||
context.resources.getDimensionPixelSize(R.dimen.bubblebar_flyout_padding)
|
||||
}
|
||||
|
||||
private val scheduler: FlyoutScheduler = scheduler ?: HandlerScheduler(this)
|
||||
@@ -61,10 +78,7 @@ class BubbleBarFlyoutView(
|
||||
private val message: TextView by
|
||||
lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_text) }
|
||||
|
||||
private val flyoutPadding by
|
||||
lazy(LazyThreadSafetyMode.NONE) {
|
||||
context.resources.getDimensionPixelSize(R.dimen.bubblebar_flyout_padding)
|
||||
}
|
||||
private val flyoutPadding by lazy(LazyThreadSafetyMode.NONE) { getFlyoutPadding(context) }
|
||||
|
||||
private val triangleHeight by
|
||||
lazy(LazyThreadSafetyMode.NONE) {
|
||||
|
||||
@@ -18,11 +18,6 @@ package com.android.launcher3.taskbar.bubbles.flyout
|
||||
|
||||
/** Callbacks that the flyout uses to notify of events. */
|
||||
interface FlyoutCallbacks {
|
||||
/** Requests to extend the top boundary of the parent to fully include the flyout. */
|
||||
fun extendTopBoundary(space: Int)
|
||||
|
||||
/** Resets the top boundary of the parent. */
|
||||
fun resetTopBoundary()
|
||||
|
||||
/** The flyout was clicked. */
|
||||
fun flyoutClicked()
|
||||
|
||||
+3
-3
@@ -74,6 +74,9 @@ interface BubbleStashController {
|
||||
val isBubblesShowingOnOverview: Boolean
|
||||
get() = launcherState == BubbleLauncherState.OVERVIEW
|
||||
|
||||
/** Bubble bar vertical center for launcher home. */
|
||||
var bubbleBarVerticalCenterForHome: Int
|
||||
|
||||
/** Updated when sysui locked state changes, when locked, bubble bar is not shown. */
|
||||
var isSysuiLocked: Boolean
|
||||
|
||||
@@ -121,9 +124,6 @@ interface BubbleStashController {
|
||||
/** Set a bubble bar location */
|
||||
fun setBubbleBarLocation(bubbleBarLocation: BubbleBarLocation)
|
||||
|
||||
/** Set the bubble bar vertical center for launcher home. */
|
||||
fun setBubbleBarVerticalCenterForHome(verticalCenter: Int)
|
||||
|
||||
/**
|
||||
* Stashes the bubble bar (transform to the handle view), or just shrink width of the expanded
|
||||
* bubble bar based on the controller implementation.
|
||||
|
||||
+2
-6
@@ -47,7 +47,7 @@ class PersistentBubbleStashController(
|
||||
private lateinit var bubbleBarAlphaAnimator: MultiPropertyFactory<View>.MultiProperty
|
||||
private lateinit var bubbleBarScaleAnimator: AnimatedFloat
|
||||
private lateinit var controllersAfterInitAction: ControllersAfterInitAction
|
||||
private var verticalCenterForHome: Int = 0
|
||||
override var bubbleBarVerticalCenterForHome: Int = 0
|
||||
|
||||
override var launcherState: BubbleLauncherState = BubbleLauncherState.IN_APP
|
||||
set(state) {
|
||||
@@ -97,7 +97,7 @@ class PersistentBubbleStashController(
|
||||
override val bubbleBarTranslationYForHotseat: Float
|
||||
get() {
|
||||
val bubbleBarHeight = bubbleBarViewController.bubbleBarCollapsedHeight
|
||||
return -verticalCenterForHome + bubbleBarHeight / 2
|
||||
return -bubbleBarVerticalCenterForHome + bubbleBarHeight / 2
|
||||
}
|
||||
|
||||
override val bubbleBarTranslationY: Float
|
||||
@@ -159,10 +159,6 @@ class PersistentBubbleStashController(
|
||||
animatorSet.setDuration(BAR_STASH_DURATION).start()
|
||||
}
|
||||
|
||||
override fun setBubbleBarVerticalCenterForHome(verticalCenter: Int) {
|
||||
verticalCenterForHome = verticalCenter
|
||||
}
|
||||
|
||||
override fun showBubbleBarImmediate() = showBubbleBarImmediate(bubbleBarTranslationY)
|
||||
|
||||
override fun showBubbleBarImmediate(bubbleBarTranslationY: Float) {
|
||||
|
||||
+2
-6
@@ -78,7 +78,7 @@ class TransientBubbleStashController(
|
||||
context.resources.getDimensionPixelSize(R.dimen.bubblebar_stashed_size) / 2f
|
||||
|
||||
private var animator: AnimatorSet? = null
|
||||
private var verticalCenterForHome: Int = 0
|
||||
override var bubbleBarVerticalCenterForHome: Int = 0
|
||||
|
||||
override var isStashed: Boolean = false
|
||||
@VisibleForTesting set
|
||||
@@ -124,7 +124,7 @@ class TransientBubbleStashController(
|
||||
override val bubbleBarTranslationYForHotseat: Float
|
||||
get() {
|
||||
val bubbleBarHeight = bubbleBarViewController.bubbleBarCollapsedHeight
|
||||
return -verticalCenterForHome + bubbleBarHeight / 2
|
||||
return -bubbleBarVerticalCenterForHome + bubbleBarHeight / 2
|
||||
}
|
||||
|
||||
override val bubbleBarTranslationYForTaskbar: Float =
|
||||
@@ -182,10 +182,6 @@ class TransientBubbleStashController(
|
||||
.start()
|
||||
}
|
||||
|
||||
override fun setBubbleBarVerticalCenterForHome(verticalCenter: Int) {
|
||||
verticalCenterForHome = verticalCenter
|
||||
}
|
||||
|
||||
override fun showBubbleBarImmediate() {
|
||||
showBubbleBarImmediate(bubbleBarTranslationY)
|
||||
}
|
||||
|
||||
+66
-22
@@ -36,6 +36,7 @@ import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarBubble
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarOverflow
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarParentViewHeightUpdateNotifier
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarView
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleView
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController
|
||||
@@ -69,6 +70,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
private val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
private lateinit var animatorScheduler: TestBubbleBarViewAnimatorScheduler
|
||||
private lateinit var bubbleBarParentViewController: TestBubbleBarParentViewHeightUpdateNotifier
|
||||
private lateinit var overflowView: BubbleView
|
||||
private lateinit var bubbleView: BubbleView
|
||||
private lateinit var bubble: BubbleBarBubble
|
||||
@@ -84,6 +86,7 @@ class BubbleBarViewAnimatorTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
animatorScheduler = TestBubbleBarViewAnimatorScheduler()
|
||||
bubbleBarParentViewController = TestBubbleBarParentViewHeightUpdateNotifier()
|
||||
PhysicsAnimatorTestUtils.prepareForTest()
|
||||
setupFlyoutController()
|
||||
}
|
||||
@@ -102,6 +105,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -122,7 +126,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// execute the hide bubble animation
|
||||
@@ -135,6 +139,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -156,6 +161,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -178,7 +184,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
verify(bubbleStashController, atLeastOnce()).updateTaskbarTouchRegion()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// verify the hide bubble animation is pending
|
||||
@@ -188,6 +194,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animatorScheduler.delayedBlock).isNull()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE)
|
||||
@@ -209,6 +216,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -255,6 +263,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -266,7 +275,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// let the animation start and wait for it to complete
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// execute the hide bubble animation
|
||||
@@ -282,7 +291,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
animator.onStashStateChangingWhileAnimating()
|
||||
}
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any())
|
||||
|
||||
@@ -306,6 +315,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -344,6 +354,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -389,6 +400,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -440,6 +452,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -454,7 +467,7 @@ class BubbleBarViewAnimatorTest {
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// verify the hide bubble animation is pending
|
||||
@@ -469,6 +482,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(0)
|
||||
assertThat(handle.translationY)
|
||||
.isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
@@ -495,6 +509,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -510,7 +525,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
@@ -522,6 +537,7 @@ class BubbleBarViewAnimatorTest {
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
@@ -550,6 +566,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -585,6 +602,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -600,7 +618,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
@@ -608,6 +626,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
@@ -629,6 +648,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -678,6 +698,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -689,7 +710,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// wait for the animation to start
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
@@ -704,6 +725,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
// verify that the hide animation was canceled
|
||||
assertThat(animatorScheduler.delayedBlock).isNull()
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
|
||||
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
@@ -724,6 +746,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -745,7 +768,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
barAnimator.assertIsRunning()
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
@@ -754,6 +777,7 @@ class BubbleBarViewAnimatorTest {
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
// the bubble bar translation y should be back to its initial value
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
|
||||
@@ -778,6 +802,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -830,6 +855,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -893,6 +919,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -918,7 +945,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// verify there is a pending hide animation
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
@@ -930,6 +957,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
assertThat(bubbleBarView.isExpanded).isTrue()
|
||||
@@ -951,6 +979,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -983,7 +1012,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("updated message")
|
||||
@@ -998,6 +1027,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1019,6 +1049,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1039,7 +1070,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
@@ -1072,6 +1103,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1093,6 +1125,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1113,7 +1146,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
@@ -1134,6 +1167,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// the flyout should now reverse and expand
|
||||
animatorTestRule.advanceTimeBy(400)
|
||||
}
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("updated message")
|
||||
@@ -1156,6 +1190,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(3)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1177,6 +1212,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1197,7 +1233,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
@@ -1213,7 +1249,6 @@ class BubbleBarViewAnimatorTest {
|
||||
PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) {
|
||||
bubbleBarView.alpha < 0.5
|
||||
}
|
||||
|
||||
// we're about to interrupt the animation which will cancel the current animation and start
|
||||
// a new one. pause the scheduler to delay starting the new animation. this allows us to run
|
||||
// the test deterministically
|
||||
@@ -1226,9 +1261,11 @@ class BubbleBarViewAnimatorTest {
|
||||
animator.animateBubbleInForStashed(updatedBubble, isExpanding = false)
|
||||
}
|
||||
|
||||
// since animation was interrupted there shouldn`t be additional calls to adjust window
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
// verify there's a new job scheduled and start it. this is starting the animation from the
|
||||
// handle back to the bar
|
||||
assertThat(animatorScheduler.pausedBlock).isNotNull()
|
||||
@@ -1237,9 +1274,9 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("updated message")
|
||||
assertThat(handle.alpha).isEqualTo(0)
|
||||
@@ -1255,7 +1292,6 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!)
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
// verify the hide animation was rescheduled and run it
|
||||
@@ -1268,6 +1304,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(3)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1289,6 +1326,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1389,10 +1427,6 @@ class BubbleBarViewAnimatorTest {
|
||||
}
|
||||
val flyoutCallbacks =
|
||||
object : FlyoutCallbacks {
|
||||
override fun extendTopBoundary(space: Int) {}
|
||||
|
||||
override fun resetTopBoundary() {}
|
||||
|
||||
override fun flyoutClicked() {}
|
||||
}
|
||||
val flyoutScheduler = FlyoutScheduler { block -> block.invoke() }
|
||||
@@ -1475,6 +1509,16 @@ class BubbleBarViewAnimatorTest {
|
||||
delayedBlock = null
|
||||
}
|
||||
}
|
||||
|
||||
private class TestBubbleBarParentViewHeightUpdateNotifier :
|
||||
BubbleBarParentViewHeightUpdateNotifier {
|
||||
|
||||
var timesInvoked: Int = 0
|
||||
|
||||
override fun updateTopBoundary() {
|
||||
timesInvoked++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS = -20f
|
||||
|
||||
-53
@@ -127,46 +127,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
assertThat(flyoutController.hasFlyout()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun showFlyout_extendsTopBoundary() {
|
||||
// set negative translation for the flyout so that it will request to extend the top
|
||||
// boundary
|
||||
flyoutTy = -50f
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
setupAndShowFlyout()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
}
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
animatorTestRule.advanceTimeBy(showAnimationDuration)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun showFlyout_withinBoundary() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
setupAndShowFlyout()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
}
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
animatorTestRule.advanceTimeBy(showAnimationDuration)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun collapseFlyout_resetsTopBoundary() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
setupAndShowFlyout()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
flyoutController.collapseFlyout {}
|
||||
animatorTestRule.advanceTimeBy(hideAnimationDuration)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryReset).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cancelFlyout_fadesOutFlyout() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
@@ -178,7 +138,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
animatorTestRule.advanceTimeBy(hideAnimationDuration)
|
||||
assertThat(flyoutView.alpha).isEqualTo(0f)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryReset).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -217,7 +176,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("new message")
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -246,7 +204,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
animatorTestRule.advanceTimeBy(showAnimationDuration)
|
||||
assertThat(flyout.alpha).isEqualTo(1)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -290,18 +247,8 @@ class BubbleBarFlyoutControllerTest {
|
||||
|
||||
class FakeFlyoutCallbacks : FlyoutCallbacks {
|
||||
|
||||
var topBoundaryExtendedSpace = 0
|
||||
var topBoundaryReset = false
|
||||
var flyoutClicked = false
|
||||
|
||||
override fun extendTopBoundary(space: Int) {
|
||||
topBoundaryExtendedSpace = space
|
||||
}
|
||||
|
||||
override fun resetTopBoundary() {
|
||||
topBoundaryReset = true
|
||||
}
|
||||
|
||||
override fun flyoutClicked() {
|
||||
flyoutClicked = true
|
||||
}
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ class PersistentBubbleStashControllerTest {
|
||||
PersistentBubbleStashController(DefaultDimensionsProvider())
|
||||
setUpBubbleBarView()
|
||||
setUpBubbleBarController()
|
||||
persistentTaskBarStashController.setBubbleBarVerticalCenterForHome(HOTSEAT_VERTICAL_CENTER)
|
||||
persistentTaskBarStashController.bubbleBarVerticalCenterForHome = HOTSEAT_VERTICAL_CENTER
|
||||
persistentTaskBarStashController.init(
|
||||
taskbarInsetsController,
|
||||
bubbleBarViewController,
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ class TransientBubbleStashControllerTest {
|
||||
setUpStashedHandleView()
|
||||
setUpBubbleStashedHandleViewController()
|
||||
PhysicsAnimatorTestUtils.prepareForTest()
|
||||
mTransientBubbleStashController.setBubbleBarVerticalCenterForHome(HOTSEAT_VERTICAL_CENTER)
|
||||
mTransientBubbleStashController.bubbleBarVerticalCenterForHome = HOTSEAT_VERTICAL_CENTER
|
||||
mTransientBubbleStashController.init(
|
||||
taskbarInsetsController,
|
||||
bubbleBarViewController,
|
||||
|
||||
Reference in New Issue
Block a user