From 826a48e02a0c946a8177a5ed146fef961cd046af Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Mon, 24 May 2021 11:39:51 -0400 Subject: [PATCH] Update landscape volume design to match the new portrait design. This mostly just copies over the XML with minor changes for landscape, and modifies the background drawable code to compensate for the horizontally opening ringer drawer. Bug: 187200513 Test: adjust volume in landscape Change-Id: I933b5a74f4a52d2a195829d54f1983305e4036b5 --- .../res/layout-land/volume_dialog.xml | 117 ++++++++---------- packages/SystemUI/res/values-land/dimens.xml | 1 + .../systemui/volume/VolumeDialogImpl.java | 16 ++- 3 files changed, 66 insertions(+), 68 deletions(-) diff --git a/packages/SystemUI/res/layout-land/volume_dialog.xml b/packages/SystemUI/res/layout-land/volume_dialog.xml index 237dc02e5d8c3..1a4e81279be4b 100644 --- a/packages/SystemUI/res/layout-land/volume_dialog.xml +++ b/packages/SystemUI/res/layout-land/volume_dialog.xml @@ -16,6 +16,7 @@ - + + android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_right" + android:orientation="vertical" + android:clipToPadding="false" + android:clipChildren="false"> + - + android:background="@drawable/volume_background"> - - - - - - - - - - - - + + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginRight="@dimen/volume_dialog_stream_padding" + android:layout_marginTop="6dp"/> + android:clipToPadding="false" > + android:orientation="horizontal" + android:layout_marginTop="@dimen/volume_row_slider_padding_start"> - + + + + - + \ No newline at end of file diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml index c6931e82ba70c..215698dd1884a 100644 --- a/packages/SystemUI/res/values-land/dimens.xml +++ b/packages/SystemUI/res/values-land/dimens.xml @@ -45,6 +45,7 @@ 136dp 12dp + 128dp 25dp diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index b9f896e46913b..98d8b29dc1646 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -1752,7 +1752,21 @@ public class VolumeDialogImpl implements VolumeDialog, } final Rect bounds = mRingerAndRowsContainerBackground.copyBounds(); - bounds.top = (int) (drawerClosedAmount * getRingerDrawerOpenExtraSize()); + + if (!isLandscape()) { + // In portrait, the background should fill the full width, but only go up to the ringer + // icon's top. We'll extend it all the way to the top of the container when the ringer + // drawer opens. + bounds.left = 0; + bounds.top = (int) (drawerClosedAmount * getRingerDrawerOpenExtraSize()); + } else { + // In landscape, the background should be inset by the size of the open drawer, since it + // opens sideways. It should extend to the top of the container since we haven't left + // space for the drawer to open upward. + bounds.left = getRingerDrawerOpenExtraSize(); + bounds.top = 0; + } + mRingerAndRowsContainerBackground.setBounds(bounds); }