diff options
author | Andreea <aiov@google.com> | 2019-01-31 16:45:38 -0800 |
---|---|---|
committer | Andreea Iovan <aiov@google.com> | 2019-02-05 00:54:17 +0000 |
commit | 1c9d5c18299452c3f9c47f6d249bd874ac421de2 (patch) | |
tree | 1491f28393158b4933e9be640ebd0d43be6ae6a3 | |
parent | 53a8364c22fb6e081f668a20c453415ba265d78e (diff) | |
download | device_google_atv-1c9d5c18299452c3f9c47f6d249bd874ac421de2.tar.gz device_google_atv-1c9d5c18299452c3f9c47f6d249bd874ac421de2.tar.bz2 device_google_atv-1c9d5c18299452c3f9c47f6d249bd874ac421de2.zip |
Customize volume bar for TV devices.
Move the bar to the bottom screen, with horizontal orientation. Make the width larger.
UI: https://screenshot.googleplex.com/46WJHZk8LVb
https://screenshot.googleplex.com/6voUqmaSU9V
Test: manual test on Atom by removing the device/harman/atom/overlay ref from device.mk,
then make SystemUI
Change-Id: I1cda7adbe5255de45300d9a70559061ef6fc53d4
(cherry picked from commit 264ffbcc6b469e5f1b5157d2ae458af6fa486a6b)
3 files changed, 194 insertions, 0 deletions
diff --git a/overlay/frameworks/base/packages/SystemUI/res/layout/volume_dialog.xml b/overlay/frameworks/base/packages/SystemUI/res/layout/volume_dialog.xml new file mode 100644 index 0000000..eb110b1 --- /dev/null +++ b/overlay/frameworks/base/packages/SystemUI/res/layout/volume_dialog.xml @@ -0,0 +1,104 @@ +<!-- + Copyright (C) 2015 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@android:color/transparent" + android:theme="@style/qs_theme"> + <LinearLayout + android:id="@+id/volume_dialog" + android:minWidth="@dimen/volume_dialog_row_width" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_gravity="center_horizontal|bottom" + android:background="@android:color/transparent" + android:paddingLeft="@dimen/volume_dialog_panel_transparent_padding" + android:paddingRight="@dimen/volume_dialog_panel_transparent_padding" + android:orientation="horizontal" + android:clipToPadding="false" > + + <FrameLayout + android:id="@+id/ringer" + android:layout_width="@dimen/volume_dialog_ringer_size" + android:layout_height="@dimen/volume_dialog_ringer_size" + android:layout_marginBottom="@dimen/volume_dialog_spacer" + android:translationZ="@dimen/volume_dialog_elevation" + android:layout_gravity="right" + android:clipToPadding="false" + android:visibility="gone" + android:background="@drawable/rounded_bg_full"> + <com.android.keyguard.AlphaOptimizedImageButton + android:id="@+id/ringer_icon" + style="@style/VolumeButtons" + android:background="@drawable/rounded_ripple" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:tint="@color/accent_tint_color_selector" + android:layout_gravity="center" + android:visibility="gone" + android:soundEffectsEnabled="false" /> + + <include layout="@layout/volume_dnd_icon" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginRight="@dimen/volume_dialog_stream_padding" + android:visibility="gone" + android:layout_marginTop="6dp"/> + </FrameLayout> + + <LinearLayout + android:id="@+id/main" + android:layout_height="wrap_content" + android:minWidth="@dimen/volume_dialog_row_width" + android:layout_width="wrap_content" + android:orientation="horizontal" + android:translationZ="@dimen/volume_dialog_elevation" + android:clipToPadding="false" + android:alpha="0.5" + android:background="@drawable/rounded_bg_full" > + <LinearLayout + android:id="@+id/volume_dialog_rows" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="vertical" + android:paddingRight="@dimen/volume_dialog_stream_padding" + android:paddingLeft="@dimen/volume_dialog_stream_padding"> + <!-- volume rows added and removed here! :-) --> + </LinearLayout> + <FrameLayout + android:id="@+id/settings_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" + android:background="@drawable/rounded_bg_bottom_background"> + <com.android.keyguard.AlphaOptimizedImageButton + android:id="@+id/settings" + android:src="@drawable/ic_settings_16dp" + android:layout_width="@dimen/volume_dialog_tap_target_size" + android:layout_height="@dimen/volume_dialog_tap_target_size" + android:layout_gravity="center" + android:contentDescription="@string/accessibility_volume_settings" + android:background="@drawable/ripple_drawable_20dp" + android:tint="?android:attr/textColorSecondary" + android:soundEffectsEnabled="false" + android:visibility="gone" /> + </FrameLayout> + </LinearLayout> + + </LinearLayout> +</FrameLayout> diff --git a/overlay/frameworks/base/packages/SystemUI/res/layout/volume_dialog_row.xml b/overlay/frameworks/base/packages/SystemUI/res/layout/volume_dialog_row.xml new file mode 100644 index 0000000..08209ab --- /dev/null +++ b/overlay/frameworks/base/packages/SystemUI/res/layout/volume_dialog_row.xml @@ -0,0 +1,69 @@ +<!-- + Copyright (C) 2015 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:tag="row" + android:layout_width="@dimen/volume_dialog_row_width" + android:layout_height="wrap_content" + android:background="@android:color/transparent" + android:clipChildren="false" + android:clipToPadding="false" + android:theme="@style/qs_theme"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:background="@android:color/transparent" + android:gravity="center" + android:layout_gravity="center" + android:orientation="horizontal" > + <com.android.keyguard.AlphaOptimizedImageButton + android:id="@+id/volume_row_icon" + style="@style/VolumeButtons" + android:layout_width="@dimen/volume_dialog_tap_target_size" + android:layout_height="@dimen/volume_dialog_tap_target_size" + android:background="@drawable/ripple_drawable_20dp" + android:tint="@color/accent_tint_color_selector" + android:soundEffectsEnabled="false" /> + <TextView + android:id="@+id/volume_row_header" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:maxLength="10" + android:maxLines="1" + android:visibility="gone" + android:textColor="?android:attr/colorControlNormal" + android:textAppearance="@style/TextAppearance.Volume.Header" /> + <FrameLayout + android:id="@+id/volume_row_slider_frame" + android:layout_height="match_parent" + android:layoutDirection="ltr" + android:layout_width="@dimen/volume_dialog_row_width"> + <SeekBar + android:id="@+id/volume_row_slider" + android:clickable="false" + android:layout_width="@dimen/volume_dialog_row_width" + android:layout_height="match_parent" + android:layoutDirection="ltr" + android:layout_gravity="center" + android:rotation="0" /> + </FrameLayout> + </LinearLayout> + + <include layout="@layout/volume_dnd_icon"/> + +</FrameLayout> diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml b/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml new file mode 100644 index 0000000..499341c --- /dev/null +++ b/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <!-- Width of volume bar --> + <dimen name="volume_dialog_row_width">252dp</dimen> + <dimen name="volume_dialog_tap_target_size">36dp</dimen> +</resources> |