Rename bubble bar flyout fields
Long term we'd like to use bubbles for any app, so this change
uses more general names instead of the chat-specific naming
Flag: com.android.wm.shell.enable_bubble_bar
Bug: 277815200
Test: built and tested on a device
Change-Id: Idec2aa7d9a8df5df0df49231e8871298084f8aa1
diff --git a/quickstep/res/layout/bubblebar_flyout.xml b/quickstep/res/layout/bubblebar_flyout.xml
index fc1e914..e3338bf 100644
--- a/quickstep/res/layout/bubblebar_flyout.xml
+++ b/quickstep/res/layout/bubblebar_flyout.xml
@@ -19,7 +19,7 @@
xmlns:tools="http://schemas.android.com/tools">
<ImageView
- android:id="@+id/bubble_flyout_avatar"
+ android:id="@+id/bubble_flyout_icon"
android:layout_width="50dp"
android:layout_height="36dp"
android:paddingEnd="@dimen/bubblebar_flyout_avatar_message_space"
@@ -30,14 +30,14 @@
tools:src="#ff0000"/>
<TextView
- android:id="@+id/bubble_flyout_name"
+ android:id="@+id/bubble_flyout_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@*android:string/config_bodyFontFamilyMedium"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintStart_toEndOf="@id/bubble_flyout_avatar"
+ app:layout_constraintStart_toEndOf="@id/bubble_flyout_icon"
tools:text="Sender"/>
<TextView
@@ -47,8 +47,8 @@
android:fontFamily="@*android:string/config_bodyFontFamily"
android:maxLines="2"
android:ellipsize="end"
- app:layout_constraintTop_toBottomOf="@id/bubble_flyout_name"
- app:layout_constraintStart_toEndOf="@id/bubble_flyout_avatar"
+ app:layout_constraintTop_toBottomOf="@id/bubble_flyout_title"
+ app:layout_constraintStart_toEndOf="@id/bubble_flyout_icon"
tools:text="This is a message"/>
</merge>
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutMessage.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutMessage.kt
index 7298297..14b456c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutMessage.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutMessage.kt
@@ -18,9 +18,4 @@
import android.graphics.drawable.Drawable
-data class BubbleBarFlyoutMessage(
- val senderAvatar: Drawable?,
- val senderName: CharSequence,
- val message: CharSequence,
- val isGroupChat: Boolean,
-)
+data class BubbleBarFlyoutMessage(val icon: Drawable?, val title: String, val message: String)
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
index 8d84ddf..2022a42 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
@@ -44,11 +44,11 @@
const val MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA = 0.75f
}
- private val sender: TextView by
- lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_name) }
+ private val title: TextView by
+ lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_title) }
- private val avatar: ImageView by
- lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_avatar) }
+ private val icon: ImageView by
+ lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_icon) }
private val message: TextView by
lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_text) }
@@ -171,8 +171,8 @@
/** Sets the data for the flyout and starts playing the expand animation. */
fun showFromCollapsed(flyoutMessage: BubbleBarFlyoutMessage, expandAnimation: () -> Unit) {
- avatar.alpha = 0f
- sender.alpha = 0f
+ icon.alpha = 0f
+ title.alpha = 0f
message.alpha = 0f
setData(flyoutMessage)
val txToCollapsedPosition =
@@ -202,18 +202,18 @@
private fun setData(flyoutMessage: BubbleBarFlyoutMessage) {
// the avatar is only displayed in group chat messages
- if (flyoutMessage.senderAvatar != null && flyoutMessage.isGroupChat) {
- avatar.visibility = VISIBLE
- avatar.setImageDrawable(flyoutMessage.senderAvatar)
+ if (flyoutMessage.icon != null) {
+ icon.visibility = VISIBLE
+ icon.setImageDrawable(flyoutMessage.icon)
} else {
- avatar.visibility = GONE
+ icon.visibility = GONE
}
val minTextViewWidth: Int
val maxTextViewWidth: Int
- if (avatar.visibility == VISIBLE) {
- minTextViewWidth = minFlyoutWidth - avatar.width - flyoutPadding * 2
- maxTextViewWidth = maxFlyoutWidth - avatar.width - flyoutPadding * 2
+ if (icon.visibility == VISIBLE) {
+ minTextViewWidth = minFlyoutWidth - icon.width - flyoutPadding * 2
+ maxTextViewWidth = maxFlyoutWidth - icon.width - flyoutPadding * 2
} else {
// when there's no avatar, the width of the text view is constant, so we're setting the
// min and max to the same value
@@ -221,13 +221,13 @@
maxTextViewWidth = minTextViewWidth
}
- if (flyoutMessage.senderName.isEmpty()) {
- sender.visibility = GONE
+ if (flyoutMessage.title.isEmpty()) {
+ title.visibility = GONE
} else {
- sender.minWidth = minTextViewWidth
- sender.maxWidth = maxTextViewWidth
- sender.text = flyoutMessage.senderName
- sender.visibility = VISIBLE
+ title.minWidth = minTextViewWidth
+ title.maxWidth = maxTextViewWidth
+ title.text = flyoutMessage.title
+ title.visibility = VISIBLE
}
message.minWidth = minTextViewWidth
@@ -240,17 +240,17 @@
expansionProgress = fraction
updateTranslationForAnimation(message)
- updateTranslationForAnimation(sender)
- updateTranslationForAnimation(avatar)
+ updateTranslationForAnimation(title)
+ updateTranslationForAnimation(icon)
// start fading in the content only after we're past the threshold
val alpha =
((expansionProgress - MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA) /
(1f - MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA))
.coerceIn(0f, 1f)
- sender.alpha = alpha
+ title.alpha = alpha
message.alpha = alpha
- avatar.alpha = alpha
+ icon.alpha = alpha
translationZ =
collapsedElevation + (flyoutElevation - collapsedElevation) * expansionProgress
@@ -368,7 +368,7 @@
)
)
backgroundColor = ta.getColor(0, defaultBackgroundColor)
- sender.setTextColor(ta.getColor(1, defaultTextColor))
+ title.setTextColor(ta.getColor(1, defaultTextColor))
message.setTextColor(ta.getColor(2, defaultTextColor))
ta.recycle()
backgroundPaint.color = backgroundColor
diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutViewScreenshotTest.kt
index 6aba6a3..11c7fe9 100644
--- a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutViewScreenshotTest.kt
+++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutViewScreenshotTest.kt
@@ -63,12 +63,7 @@
val flyout =
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = false))
flyout.showFromCollapsed(
- BubbleBarFlyoutMessage(
- senderAvatar = null,
- senderName = "sender",
- message = "message",
- isGroupChat = false,
- )
+ BubbleBarFlyoutMessage(icon = null, title = "sender", message = "message")
) {}
flyout.updateExpansionProgress(1f)
flyout
@@ -82,12 +77,7 @@
val flyout =
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = true))
flyout.showFromCollapsed(
- BubbleBarFlyoutMessage(
- senderAvatar = null,
- senderName = "sender",
- message = "message",
- isGroupChat = false,
- )
+ BubbleBarFlyoutMessage(icon = null, title = "sender", message = "message")
) {}
flyout.updateExpansionProgress(1f)
flyout
@@ -102,10 +92,9 @@
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = true))
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = null,
- senderName = "sender",
+ icon = null,
+ title = "sender",
message = "really, really, really, really, really long message. like really.",
- isGroupChat = false,
)
) {}
flyout.updateExpansionProgress(1f)
@@ -121,10 +110,9 @@
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = false))
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "message",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(1f)
@@ -140,10 +128,9 @@
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = true))
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "message",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(1f)
@@ -159,10 +146,9 @@
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = true))
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "really, really, really, really, really long message. like really.",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(1f)
@@ -178,10 +164,9 @@
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = true))
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "collapsed on left",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(0f)
@@ -197,10 +182,9 @@
BubbleBarFlyoutView(context, FakeBubbleBarFlyoutPositioner(isOnLeft = false))
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "collapsed on right",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(0f)
@@ -222,10 +206,9 @@
)
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "expanded 90% on left",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(0.9f)
@@ -247,10 +230,9 @@
)
flyout.showFromCollapsed(
BubbleBarFlyoutMessage(
- senderAvatar = ColorDrawable(Color.RED),
- senderName = "sender",
+ icon = ColorDrawable(Color.RED),
+ title = "sender",
message = "expanded 80% on right",
- isGroupChat = true,
)
) {}
flyout.updateExpansionProgress(0.8f)
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
index d857ae5..fdafce0 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
@@ -39,8 +39,7 @@
private lateinit var flyoutController: BubbleBarFlyoutController
private lateinit var flyoutContainer: FrameLayout
private val context = ApplicationProvider.getApplicationContext<Context>()
- private val flyoutMessage =
- BubbleBarFlyoutMessage(senderAvatar = null, "sender name", "message", isGroupChat = false)
+ private val flyoutMessage = BubbleBarFlyoutMessage(icon = null, "sender name", "message")
private var onLeft = true
@Before
@@ -87,7 +86,7 @@
flyoutController.setUpFlyout(flyoutMessage)
assertThat(flyoutContainer.childCount).isEqualTo(1)
val flyout = flyoutContainer.getChildAt(0)
- val sender = flyout.findViewById<TextView>(R.id.bubble_flyout_name)
+ val sender = flyout.findViewById<TextView>(R.id.bubble_flyout_title)
assertThat(sender.text).isEqualTo("sender name")
val message = flyout.findViewById<TextView>(R.id.bubble_flyout_text)
assertThat(message.text).isEqualTo("message")