Allow updating the flyout message
Add functions to allow updating the contents of the flyout while it is either expanding or fully expanded. Flag: com.android.wm.shell.enable_bubble_bar Bug: 277815200 Test: atest BubbleBarFlyoutControllerTest Change-Id: Iea3fc7df792e02605df6b44c1da39e267f6d9d43
This commit is contained in:
1 parent
aa3f772622
commit
35e6157303
3 files changed
+118
-22
No files matched your search
+57
@@ -115,11 +115,13 @@ class BubbleBarFlyoutControllerTest {
|
||||
fun hideFlyout_removedFromContainer() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
flyoutController.setUpAndShowFlyout(flyoutMessage) {}
|
||||
assertThat(flyoutController.hasFlyout()).isTrue()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
flyoutController.collapseFlyout {}
|
||||
animatorTestRule.advanceTimeBy(300)
|
||||
}
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(0)
|
||||
assertThat(flyoutController.hasFlyout()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -189,6 +191,61 @@ class BubbleBarFlyoutControllerTest {
|
||||
assertThat(flyoutCallbacks.flyoutClicked).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun updateFlyoutWhileExpanding() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
flyoutController.setUpAndShowFlyout(flyoutMessage) {}
|
||||
assertThat(flyoutController.hasFlyout()).isTrue()
|
||||
val flyout = flyoutContainer.findViewById<View>(R.id.bubble_bar_flyout_view)
|
||||
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("message")
|
||||
// advance the animation about halfway
|
||||
animatorTestRule.advanceTimeBy(100)
|
||||
}
|
||||
assertThat(flyoutController.hasFlyout()).isTrue()
|
||||
|
||||
val newFlyoutMessage = flyoutMessage.copy(message = "new message")
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
val flyout = flyoutContainer.findViewById<View>(R.id.bubble_bar_flyout_view)
|
||||
// set negative translation to verify that the top boundary extends as a result of
|
||||
// updating while expanding
|
||||
flyout.translationY = -50f
|
||||
flyoutController.updateFlyoutWhileExpanding(newFlyoutMessage)
|
||||
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("new message")
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun updateFlyoutFullyExpanded() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
flyoutController.setUpAndShowFlyout(flyoutMessage) {}
|
||||
animatorTestRule.advanceTimeBy(300)
|
||||
}
|
||||
assertThat(flyoutController.hasFlyout()).isTrue()
|
||||
|
||||
val newFlyoutMessage = flyoutMessage.copy(message = "new message")
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
val flyout = flyoutContainer.findViewById<View>(R.id.bubble_bar_flyout_view)
|
||||
// set negative translation to verify that the top boundary extends as a result of
|
||||
// updating while fully expanded
|
||||
flyout.translationY = -50f
|
||||
flyoutController.updateFlyoutFullyExpanded(newFlyoutMessage) {}
|
||||
|
||||
// advance the timer so that the fade out animation plays
|
||||
animatorTestRule.advanceTimeBy(250)
|
||||
assertThat(flyout.alpha).isEqualTo(0)
|
||||
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("new message")
|
||||
|
||||
// advance the timer so that the fade in animation plays
|
||||
animatorTestRule.advanceTimeBy(250)
|
||||
assertThat(flyout.alpha).isEqualTo(1)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
class FakeFlyoutCallbacks : FlyoutCallbacks {
|
||||
|
||||
var topBoundaryExtendedSpace = 0
|
||||
|
||||
Reference in new issue
Block a user