Update volume control ui for tv

As part of this we introduce a new theme "volume_dialog_theme", which
in the general case is the same as the previously used "qs_theme". Just
for TVs we override the accentColor.

Before: https://hsv.googleplex.com/5706562045739008
After: https://hsv.googleplex.com/5373850558660608

Bug: 162302410
Test: flash on atv device && press +/- on remote
Change-Id: I1151746cf417effbb300c0c11a26b8f75e9d8fb2
This commit is contained in:
Galia Peycheva
2020-07-31 12:41:39 +02:00
parent eb1ec3af91
commit 296a49c944
12 changed files with 73 additions and 13 deletions

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/tv_volume_dialog_background" />
<corners android:radius="@dimen/tv_volume_dialog_corner_radius"/>
</shape>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/tv_volume_dialog_circle" />
</shape>

View File

@@ -20,7 +20,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:theme="@style/qs_theme">
android:theme="@style/volume_dialog_theme">
<FrameLayout
android:id="@+id/volume_dialog"
@@ -46,7 +46,7 @@
android:translationZ="@dimen/volume_dialog_elevation"
android:clipChildren="false"
android:clipToPadding="false"
android:background="@drawable/rounded_bg_full">
android:background="@drawable/tv_volume_dialog_background">
<LinearLayout
android:id="@+id/volume_dialog_rows"
@@ -54,9 +54,7 @@
android:layout_height="wrap_content"
android:minWidth="@dimen/volume_dialog_panel_width"
android:gravity="center"
android:orientation="horizontal"
android:paddingRight="@dimen/volume_dialog_stream_padding"
android:paddingLeft="@dimen/volume_dialog_stream_padding">
android:orientation="horizontal">
<!-- volume rows added and removed here! :-) -->
</LinearLayout>
@@ -98,4 +96,4 @@
</FrameLayout>
</FrameLayout>
</FrameLayout>

View File

@@ -21,11 +21,12 @@
android:background="@android:color/transparent"
android:clipChildren="false"
android:clipToPadding="false"
android:theme="@style/qs_theme">
android:theme="@style/volume_dialog_theme">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/tv_volume_dialog_row_padding"
android:background="@android:color/transparent"
android:gravity="center"
android:layout_gravity="center"
@@ -35,7 +36,7 @@
style="@style/VolumeButtons"
android:layout_width="@dimen/tv_volume_dialog_bubble_size"
android:layout_height="@dimen/tv_volume_dialog_bubble_size"
android:background="@drawable/ripple_drawable_20dp"
android:background="@drawable/tv_volume_dialog_circle"
android:tint="@color/accent_tint_color_selector"
android:soundEffectsEnabled="false" />
<TextView
@@ -68,6 +69,8 @@
android:layout_height="@dimen/tv_volume_dialog_bubble_size"
android:maxLength="2"
android:gravity="center"
android:background="@drawable/tv_volume_dialog_circle"
android:textSize="@dimen/tv_volume_number_text_size"
android:textColor="@color/accent_tint_color_selector"/>
</LinearLayout>

View File

@@ -22,7 +22,7 @@
android:gravity="right"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:theme="@style/qs_theme">
android:theme="@style/volume_dialog_theme">
<FrameLayout
android:id="@+id/volume_dialog"

View File

@@ -22,7 +22,7 @@
android:gravity="right"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:theme="@style/qs_theme">
android:theme="@style/volume_dialog_theme">
<!-- right-aligned to be physically near volume button -->
<LinearLayout

View File

@@ -20,7 +20,7 @@
android:layout_width="@dimen/volume_dialog_panel_width"
android:clipChildren="false"
android:clipToPadding="false"
android:theme="@style/qs_theme">
android:theme="@style/volume_dialog_theme">
<LinearLayout
android:layout_height="wrap_content"

View File

@@ -18,4 +18,7 @@
<!-- Width of volume bar -->
<dimen name="volume_dialog_row_width">252dp</dimen>
<dimen name="tv_volume_dialog_bubble_size">36dp</dimen>
<dimen name="tv_volume_dialog_corner_radius">40dp</dimen>
<dimen name="tv_volume_dialog_row_padding">5dp</dimen>
<dimen name="tv_volume_number_text_size">16dp</dimen>
</resources>

View File

@@ -22,4 +22,8 @@
<item name="android:windowEnterAnimation">@null</item>
<item name="android:windowExitAnimation">@null</item>
</style>
<style name="volume_dialog_theme" parent="qs_theme">
<item name="android:colorAccent">@color/tv_volume_dialog_accent</item>
</style>
</resources>

View File

@@ -27,4 +27,7 @@
<color name="tv_audio_recording_indicator_pulse">#4DFFFFFF</color>
<color name="red">#FFCC0000</color>
<color name="tv_volume_dialog_background">#E61F232B</color>
<color name="tv_volume_dialog_circle">#08FFFFFF</color>
<color name="tv_volume_dialog_accent">#FFDADCE0</color>
</resources>

View File

@@ -387,6 +387,9 @@
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back</item>
</style>
<!-- Overridden by values-television/styles.xml with tv-specific settings -->
<style name="volume_dialog_theme" parent="qs_theme"/>
<style name="systemui_theme_remote_input" parent="@android:style/Theme.DeviceDefault.Light">
<item name="android:colorAccent">@color/remote_input_accent</item>
</style>

View File

@@ -166,7 +166,7 @@ public class VolumeDialogImpl implements VolumeDialog,
public VolumeDialogImpl(Context context) {
mContext =
new ContextThemeWrapper(context, R.style.qs_theme);
new ContextThemeWrapper(context, R.style.volume_dialog_theme);
mController = Dependency.get(VolumeDialogController.class);
mKeyguard = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
@@ -1352,7 +1352,7 @@ public class VolumeDialogImpl implements VolumeDialog,
private final class CustomDialog extends Dialog implements DialogInterface {
public CustomDialog(Context context) {
super(context, R.style.qs_theme);
super(context, R.style.volume_dialog_theme);
}
@Override