[Chipbar] Update font weight and spacing after button.
Bug: 267821684
Test: media push to receiver flow w/ app icon (light & dark theme)
Test: media pull to phone flow w/ generic icon (light & dark theme)
Test: active unlock flow (light & dark theme)
Change-Id: I7f11c26e55454aa614747aab65d330b33114269c
diff --git a/packages/SystemUI/res/layout/chipbar.xml b/packages/SystemUI/res/layout/chipbar.xml
index 762dcdc..90e436d 100644
--- a/packages/SystemUI/res/layout/chipbar.xml
+++ b/packages/SystemUI/res/layout/chipbar.xml
@@ -54,7 +54,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:textSize="@dimen/chipbar_text_size"
+ style="@style/Chipbar.Text"
android:textColor="@color/chipbar_text_and_icon_color"
android:alpha="0.0"
/>
@@ -84,9 +84,9 @@
android:id="@+id/end_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="?androidprv:attr/textColorOnAccent"
android:layout_marginStart="@dimen/chipbar_end_item_start_margin"
- android:textSize="@dimen/chipbar_text_size"
+ style="@style/Chipbar.Text"
+ android:textColor="?androidprv:attr/textColorOnAccent"
android:paddingStart="@dimen/chipbar_outer_padding"
android:paddingEnd="@dimen/chipbar_outer_padding"
android:paddingTop="@dimen/chipbar_end_button_vertical_padding"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 714d495..6ff4efb 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1110,6 +1110,7 @@
<!-- Chipbar -->
<!-- (Used for media tap-to-transfer chip for sender device and active unlock) -->
<dimen name="chipbar_outer_padding">16dp</dimen>
+ <dimen name="chipbar_outer_padding_half">8dp</dimen>
<dimen name="chipbar_text_size">16sp</dimen>
<dimen name="chipbar_start_icon_size">24dp</dimen>
<dimen name="chipbar_end_icon_size">20dp</dimen>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 064cea1..02c9bd0 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -70,6 +70,15 @@
<item name="android:fontWeight">700</item>
</style>
+ <style name="Chipbar" />
+
+ <style name="Chipbar.Text" parent="@*android:style/TextAppearance.DeviceDefault.Notification.Title">
+ <!-- Text size should be kept in sync with the notification conversation header size. (The
+ conversation header doesn't have a defined style, so the size must be copied here.)
+ See notification_template_conversation_header.xml. -->
+ <item name="android:textSize">16sp</item>
+ </style>
+
<style name="TextAppearance" />
<style name="TextAppearance.QS">
diff --git a/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt b/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt
index a20a5b2..e819f94 100644
--- a/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinator.kt
@@ -31,6 +31,7 @@
import android.view.accessibility.AccessibilityManager
import android.widget.ImageView
import android.widget.TextView
+import androidx.annotation.DimenRes
import androidx.annotation.IdRes
import androidx.annotation.VisibleForTesting
import com.android.internal.widget.CachingIconView
@@ -180,8 +181,9 @@
// Button
val buttonView = currentView.requireViewById<TextView>(R.id.end_button)
- if (newInfo.endItem is ChipbarEndItem.Button) {
- TextViewBinder.bind(buttonView, newInfo.endItem.text)
+ val hasButton = newInfo.endItem is ChipbarEndItem.Button
+ if (hasButton) {
+ TextViewBinder.bind(buttonView, (newInfo.endItem as ChipbarEndItem.Button).text)
val onClickListener =
View.OnClickListener { clickedView ->
@@ -196,6 +198,12 @@
buttonView.visibility = View.GONE
}
+ currentView
+ .getInnerView()
+ .setEndPadding(
+ if (hasButton) R.dimen.chipbar_outer_padding_half else R.dimen.chipbar_outer_padding
+ )
+
// ---- Overall accessibility ----
val iconDesc = newInfo.startIcon.icon.contentDescription
val loadedIconDesc =
@@ -309,6 +317,15 @@
viewUtil.setRectToViewWindowLocation(view, outRect)
}
+ private fun View.setEndPadding(@DimenRes endPaddingDimen: Int) {
+ this.setPaddingRelative(
+ this.paddingStart,
+ this.paddingTop,
+ context.resources.getDimensionPixelSize(endPaddingDimen),
+ this.paddingBottom,
+ )
+ }
+
private fun Boolean.visibleIfTrue(): Int {
return if (this) {
View.VISIBLE