Skip to content

Commit c052d65

Browse files
ArianK16abgcngm
authored andcommitted
VolumeDialog: Move the media output selector next to the expandable indicator
* Keep the non-expanded panel as slim as possible. Change-Id: Ic0d171c1f52ad8f50e14f161431e41d49da6cad6
1 parent 9164325 commit c052d65

File tree

3 files changed

+81
-66
lines changed

3 files changed

+81
-66
lines changed

packages/SystemUI/res/layout-land/volume_dialog.xml

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -87,40 +87,45 @@
8787
android:paddingLeft="@dimen/volume_dialog_stream_padding">
8888
<!-- volume rows added and removed here! :-) -->
8989
</LinearLayout>
90-
<FrameLayout
91-
android:id="@+id/media_output_container"
92-
android:layout_width="match_parent"
93-
android:layout_height="wrap_content"
94-
android:background="?android:attr/panelColorBackground">
95-
<com.android.keyguard.AlphaOptimizedImageButton
96-
android:id="@+id/media_output"
97-
android:src="@drawable/ic_bluetooth_audio"
98-
android:layout_width="@dimen/volume_dialog_tap_target_size"
99-
android:layout_height="@dimen/volume_dialog_tap_target_size"
100-
android:layout_marginRight="8dp"
101-
android:layout_marginLeft="8dp"
102-
android:contentDescription="@string/accessibility_volume_settings"
103-
android:background="@drawable/ripple_drawable_20dp"
104-
android:tint="?android:attr/textColorSecondary"
105-
android:soundEffectsEnabled="false" />
106-
</FrameLayout>
107-
<FrameLayout
108-
android:id="@+id/expandable_indicator_container"
90+
<LinearLayout
10991
android:layout_width="match_parent"
11092
android:layout_height="wrap_content"
111-
android:background="@drawable/rounded_bg_bottom_background">
112-
<com.android.systemui.statusbar.phone.ExpandableIndicator
113-
android:id="@+id/expandable_indicator"
114-
android:layout_width="@dimen/volume_dialog_tap_target_size"
115-
android:layout_height="@dimen/volume_dialog_tap_target_size"
116-
android:layout_marginRight="8dp"
117-
android:layout_marginLeft="8dp"
118-
android:contentDescription="@string/accessibility_volume_expand"
119-
android:background="@drawable/ripple_drawable_20dp"
120-
android:tint="?android:attr/textColorSecondary"
121-
android:soundEffectsEnabled="false"
122-
android:padding="14dp" />
123-
</FrameLayout>
93+
android:orientation="horizontal"
94+
android:background="@drawable/rounded_bg_bottom_background" >
95+
<FrameLayout
96+
android:id="@+id/expandable_indicator_container"
97+
android:layout_width="wrap_content"
98+
android:layout_height="wrap_content"
99+
android:layout_weight="1">
100+
<com.android.systemui.statusbar.phone.ExpandableIndicator
101+
android:id="@+id/expandable_indicator"
102+
android:layout_width="@dimen/volume_dialog_tap_target_size"
103+
android:layout_height="@dimen/volume_dialog_tap_target_size"
104+
android:layout_marginRight="8dp"
105+
android:layout_marginLeft="8dp"
106+
android:contentDescription="@string/accessibility_volume_expand"
107+
android:background="@drawable/ripple_drawable_20dp"
108+
android:tint="?android:attr/textColorSecondary"
109+
android:soundEffectsEnabled="false"
110+
android:padding="14dp" />
111+
</FrameLayout>
112+
<FrameLayout
113+
android:id="@+id/media_output_container"
114+
android:layout_width="wrap_content"
115+
android:layout_height="wrap_content">
116+
<com.android.keyguard.AlphaOptimizedImageButton
117+
android:id="@+id/media_output"
118+
android:src="@drawable/ic_bluetooth_audio"
119+
android:layout_width="@dimen/volume_dialog_tap_target_size"
120+
android:layout_height="@dimen/volume_dialog_tap_target_size"
121+
android:layout_marginRight="8dp"
122+
android:layout_marginLeft="8dp"
123+
android:contentDescription="@string/accessibility_volume_settings"
124+
android:background="@drawable/ripple_drawable_20dp"
125+
android:tint="?android:attr/textColorSecondary"
126+
android:soundEffectsEnabled="false" />
127+
</FrameLayout>
128+
</LinearLayout>
124129
</LinearLayout>
125130

126131
<FrameLayout

packages/SystemUI/res/layout/volume_dialog.xml

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -88,40 +88,45 @@
8888
android:paddingLeft="@dimen/volume_dialog_stream_padding">
8989
<!-- volume rows added and removed here! :-) -->
9090
</LinearLayout>
91-
<FrameLayout
92-
android:id="@+id/media_output_container"
93-
android:layout_width="match_parent"
94-
android:layout_height="wrap_content"
95-
android:background="?android:attr/panelColorBackground">
96-
<com.android.keyguard.AlphaOptimizedImageButton
97-
android:id="@+id/media_output"
98-
android:src="@drawable/ic_bluetooth_audio"
99-
android:layout_width="@dimen/volume_dialog_tap_target_size"
100-
android:layout_height="@dimen/volume_dialog_tap_target_size"
101-
android:layout_marginRight="8dp"
102-
android:layout_marginLeft="8dp"
103-
android:contentDescription="@string/accessibility_volume_settings"
104-
android:background="@drawable/ripple_drawable_20dp"
105-
android:tint="?android:attr/textColorSecondary"
106-
android:soundEffectsEnabled="false" />
107-
</FrameLayout>
108-
<FrameLayout
109-
android:id="@+id/expandable_indicator_container"
91+
<LinearLayout
11092
android:layout_width="match_parent"
11193
android:layout_height="wrap_content"
112-
android:background="@drawable/rounded_bg_bottom_background">
113-
<com.android.systemui.statusbar.phone.ExpandableIndicator
114-
android:id="@+id/expandable_indicator"
115-
android:layout_width="@dimen/volume_dialog_tap_target_size"
116-
android:layout_height="@dimen/volume_dialog_tap_target_size"
117-
android:layout_marginRight="8dp"
118-
android:layout_marginLeft="8dp"
119-
android:contentDescription="@string/accessibility_volume_expand"
120-
android:background="@drawable/ripple_drawable_20dp"
121-
android:tint="?android:attr/textColorSecondary"
122-
android:soundEffectsEnabled="false"
123-
android:padding="14dp" />
124-
</FrameLayout>
94+
android:orientation="horizontal"
95+
android:background="@drawable/rounded_bg_bottom_background" >
96+
<FrameLayout
97+
android:id="@+id/expandable_indicator_container"
98+
android:layout_width="wrap_content"
99+
android:layout_height="wrap_content"
100+
android:layout_weight="1">
101+
<com.android.systemui.statusbar.phone.ExpandableIndicator
102+
android:id="@+id/expandable_indicator"
103+
android:layout_width="@dimen/volume_dialog_tap_target_size"
104+
android:layout_height="@dimen/volume_dialog_tap_target_size"
105+
android:layout_marginRight="8dp"
106+
android:layout_marginLeft="8dp"
107+
android:contentDescription="@string/accessibility_volume_expand"
108+
android:background="@drawable/ripple_drawable_20dp"
109+
android:tint="?android:attr/textColorSecondary"
110+
android:soundEffectsEnabled="false"
111+
android:padding="14dp" />
112+
</FrameLayout>
113+
<FrameLayout
114+
android:id="@+id/media_output_container"
115+
android:layout_width="wrap_content"
116+
android:layout_height="wrap_content">
117+
<com.android.keyguard.AlphaOptimizedImageButton
118+
android:id="@+id/media_output"
119+
android:src="@drawable/ic_bluetooth_audio"
120+
android:layout_width="@dimen/volume_dialog_tap_target_size"
121+
android:layout_height="@dimen/volume_dialog_tap_target_size"
122+
android:layout_marginRight="8dp"
123+
android:layout_marginLeft="8dp"
124+
android:contentDescription="@string/accessibility_volume_settings"
125+
android:background="@drawable/ripple_drawable_20dp"
126+
android:tint="?android:attr/textColorSecondary"
127+
android:soundEffectsEnabled="false" />
128+
</FrameLayout>
129+
</LinearLayout>
125130
</LinearLayout>
126131

127132
<FrameLayout

packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,12 @@ private static boolean isBluetoothA2dpConnected() {
552552
== BluetoothProfile.STATE_CONNECTED;
553553
}
554554

555-
public void initSettingsH() {
555+
public void updateMediaOutputH() {
556556
if (mMediaOutputView != null) {
557557
mMediaOutputView.setVisibility(
558558
mDeviceProvisionedController.isCurrentUserSetup() &&
559559
mActivityManager.getLockTaskModeState() == LOCK_TASK_MODE_NONE &&
560-
isBluetoothA2dpConnected() ? VISIBLE : GONE);
560+
isBluetoothA2dpConnected() && mExpanded ? VISIBLE : GONE);
561561
}
562562
if (mMediaOutputIcon != null) {
563563
mMediaOutputIcon.setOnClickListener(v -> {
@@ -569,7 +569,10 @@ public void initSettingsH() {
569569
true /* dismissShade */);
570570
});
571571
}
572+
}
572573

574+
public void initSettingsH() {
575+
updateMediaOutputH();
573576
if (mAllyStream == -1) {
574577
mAllyStream = mActiveStream;
575578
}
@@ -597,6 +600,8 @@ public void initSettingsH() {
597600
if (mExpanded) mController.setActiveStream(mAllyStream);
598601
mExpandRows.setExpanded(!mExpanded);
599602
mExpanded = !mExpanded;
603+
604+
updateMediaOutputH();
600605
});
601606
}
602607
}

0 commit comments

Comments
 (0)