Media - Limit size of output switcher and app name
Make sure that there is a gap at least 10dp to the left and right of center
vertical in media view, between app name and output switcher.
Test: manual
Fixes: 159708142
Change-Id: If142bd920b6921c9d82fa2d6dfb2595f123df2ac
diff --git a/packages/SystemUI/res/layout/media_view.xml b/packages/SystemUI/res/layout/media_view.xml
index 07bbb8f..07b30453 100644
--- a/packages/SystemUI/res/layout/media_view.xml
+++ b/packages/SystemUI/res/layout/media_view.xml
@@ -26,6 +26,14 @@
android:gravity="center_horizontal|fill_vertical"
android:background="@drawable/qs_media_background">
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/center_vertical_guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.5"
+ />
+
<!-- As per Material Design on Biderectionality, this is forced to LTR in code -->
<FrameLayout
android:id="@+id/notification_media_progress_time"
@@ -155,15 +163,6 @@
android:src="@drawable/ic_cast_connected"
android:forceHasOverlappingRendering="false" />
- <androidx.constraintlayout.widget.Barrier
- android:id="@+id/media_seamless_barrier"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:barrierDirection="start"
- app:constraint_referenced_ids="media_seamless,media_seamless_fallback"
- app:barrierAllowsGoneWidgets="false"
- />
-
<!-- Seek Bar -->
<!-- As per Material Design on Biderectionality, this is forced to LTR in code -->
<SeekBar
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 29a2ad4..c784fec 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1268,6 +1268,7 @@
<dimen name="qs_media_padding">16dp</dimen>
<dimen name="qs_media_panel_outer_padding">16dp</dimen>
<dimen name="qs_media_album_size">52dp</dimen>
+ <dimen name="qs_center_guideline_padding">10dp</dimen>
<dimen name="qs_seamless_icon_size">20dp</dimen>
<dimen name="qs_seamless_fallback_icon_size">20dp</dimen>
<dimen name="qs_seamless_fallback_top_margin">18dp</dimen>
diff --git a/packages/SystemUI/res/xml/media_collapsed.xml b/packages/SystemUI/res/xml/media_collapsed.xml
index 811e0e3..0926a98 100644
--- a/packages/SystemUI/res/xml/media_collapsed.xml
+++ b/packages/SystemUI/res/xml/media_collapsed.xml
@@ -31,12 +31,12 @@
android:id="@+id/app_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginEnd="10dp"
+ android:layout_marginEnd="@dimen/qs_center_guideline_padding"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/icon"
- app:layout_constraintEnd_toStartOf="@id/media_seamless_barrier"
+ app:layout_constraintEnd_toStartOf="@id/center_vertical_guideline"
app:layout_constraintHorizontal_bias="0"
/>
@@ -47,8 +47,11 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="60dp"
+ app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
+ app:layout_constraintHorizontal_bias="1"
android:layout_marginTop="@dimen/qs_media_panel_outer_padding"
android:layout_marginEnd="@dimen/qs_media_panel_outer_padding"
+ android:layout_marginStart="@dimen/qs_center_guideline_padding"
/>
<Constraint
@@ -57,10 +60,13 @@
android:layout_height="@dimen/qs_seamless_fallback_icon_size"
android:layout_marginTop="@dimen/qs_seamless_fallback_top_margin"
android:layout_marginEnd="@dimen/qs_seamless_fallback_end_margin"
+ android:layout_marginStart="@dimen/qs_center_guideline_padding"
android:alpha="0.5"
android:visibility="gone"
+ app:layout_constraintHorizontal_bias="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
/>
<Constraint
diff --git a/packages/SystemUI/res/xml/media_expanded.xml b/packages/SystemUI/res/xml/media_expanded.xml
index 8432abc..dd15d5d 100644
--- a/packages/SystemUI/res/xml/media_expanded.xml
+++ b/packages/SystemUI/res/xml/media_expanded.xml
@@ -31,12 +31,12 @@
android:id="@+id/app_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginEnd="10dp"
+ android:layout_marginEnd="@dimen/qs_center_guideline_padding"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/icon"
- app:layout_constraintEnd_toStartOf="@id/media_seamless_barrier"
+ app:layout_constraintEnd_toStartOf="@id/center_vertical_guideline"
app:layout_constraintHorizontal_bias="0"
/>
@@ -46,9 +46,12 @@
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
+ app:layout_constraintHorizontal_bias="1"
app:layout_constraintWidth_min="60dp"
android:layout_marginTop="@dimen/qs_media_panel_outer_padding"
android:layout_marginEnd="@dimen/qs_media_panel_outer_padding"
+ android:layout_marginStart="@dimen/qs_center_guideline_padding"
/>
<Constraint
@@ -57,10 +60,13 @@
android:layout_height="@dimen/qs_seamless_fallback_icon_size"
android:layout_marginTop="@dimen/qs_seamless_fallback_top_margin"
android:layout_marginEnd="@dimen/qs_seamless_fallback_end_margin"
+ android:layout_marginStart="@dimen/qs_center_guideline_padding"
android:alpha="0.5"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
+ app:layout_constraintHorizontal_bias="1"
/>
<Constraint