diff options
8 files changed, 94 insertions, 7 deletions
diff --git a/packages/SystemUI/res/drawable/tv_volume_row_seek_bar.xml b/packages/SystemUI/res/drawable/tv_volume_row_seek_bar.xml new file mode 100644 index 000000000000..fe76b639f15a --- /dev/null +++ b/packages/SystemUI/res/drawable/tv_volume_row_seek_bar.xml @@ -0,0 +1,32 @@ +<?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. +--> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@android:id/background"> + <shape android:shape="rectangle"> + <solid android:color="@color/tv_volume_dialog_seek_bar_background" /> + <corners android:radius="@dimen/tv_volume_seek_bar_width" /> + </shape> + </item> + <item android:id="@android:id/progress"> + <clip> + <shape android:shape="rectangle"> + <solid android:color="@color/tv_volume_dialog_seek_bar_fill" /> + <corners android:radius="@dimen/tv_volume_seek_bar_width" /> + </shape> + </clip> + </item> +</layer-list> diff --git a/packages/SystemUI/res/drawable/tv_volume_row_seek_thumb.xml b/packages/SystemUI/res/drawable/tv_volume_row_seek_thumb.xml new file mode 100644 index 000000000000..588782ddf316 --- /dev/null +++ b/packages/SystemUI/res/drawable/tv_volume_row_seek_thumb.xml @@ -0,0 +1,26 @@ +<?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_accent" /> + <size android:width="@dimen/tv_volume_seek_bar_thumb_diameter" + android:height="@dimen/tv_volume_seek_bar_thumb_diameter" /> + <stroke android:width="@dimen/tv_volume_seek_bar_thumb_focus_ring_width" + android:color="@color/tv_volume_dialog_seek_thumb_focus_ring"/> + <item name="android:shadowColor">@color/tv_volume_dialog_seek_thumb_shadow</item> + <item name="android:shadowRadius">@dimen/tv_volume_seek_bar_thumb_shadow_radius</item> + <item name="android:shadowDy">@dimen/tv_volume_seek_bar_thumb_shadow_dy</item> +</shape> diff --git a/packages/SystemUI/res/layout-land-television/volume_dialog_row.xml b/packages/SystemUI/res/layout-land-television/volume_dialog_row.xml index d28d5664d725..4f6cb0140d09 100644 --- a/packages/SystemUI/res/layout-land-television/volume_dialog_row.xml +++ b/packages/SystemUI/res/layout-land-television/volume_dialog_row.xml @@ -40,7 +40,7 @@ android:fontFeatureSettings="tnum" android:background="@drawable/tv_volume_dialog_circle" android:textSize="@dimen/tv_volume_number_text_size" - android:textColor="@color/accent_tint_color_selector"/> + android:textColor="@color/tv_volume_dialog_accent"/> <TextView android:id="@+id/volume_row_header" android:layout_width="wrap_content" @@ -61,6 +61,12 @@ android:layout_width="@dimen/volume_dialog_row_height" android:layout_height="match_parent" android:layout_gravity="center" + android:layoutDirection="ltr" + android:maxHeight="@dimen/tv_volume_seek_bar_width" + android:minHeight="@dimen/tv_volume_seek_bar_width" + android:thumb="@drawable/tv_volume_row_seek_thumb" + android:progressDrawable="@drawable/tv_volume_row_seek_bar" + android:splitTrack="false" android:rotation="270" /> </FrameLayout> <com.android.keyguard.AlphaOptimizedImageButton diff --git a/packages/SystemUI/res/values-land-television/dimens.xml b/packages/SystemUI/res/values-land-television/dimens.xml index 8237919990de..9502e09e22be 100644 --- a/packages/SystemUI/res/values-land-television/dimens.xml +++ b/packages/SystemUI/res/values-land-television/dimens.xml @@ -16,10 +16,17 @@ <resources> <!-- Height of volume bar --> - <dimen name="volume_dialog_row_height">200dp</dimen> - <dimen name="volume_dialog_panel_transparent_padding">17dp</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> + <dimen name="volume_dialog_row_height">224dp</dimen> + <dimen name="volume_dialog_row_width">58dp</dimen> + <dimen name="volume_dialog_panel_transparent_padding">20dp</dimen> + <dimen name="tv_volume_dialog_bubble_size">42dp</dimen> + <dimen name="tv_volume_dialog_corner_radius">42dp</dimen> + <dimen name="tv_volume_dialog_row_padding">8dp</dimen> + <dimen name="tv_volume_number_text_size">19sp</dimen> + <dimen name="tv_volume_seek_bar_width">5dp</dimen> + <dimen name="tv_volume_seek_bar_thumb_diameter">30dp</dimen> + <dimen name="tv_volume_seek_bar_thumb_focus_ring_width">11dp</dimen> + <dimen name="tv_volume_icons_size">24dp</dimen> + <dimen name="tv_volume_seek_bar_thumb_shadow_radius">4.0</dimen> + <dimen name="tv_volume_seek_bar_thumb_shadow_dy">4.0</dimen> </resources> diff --git a/packages/SystemUI/res/values-television/config.xml b/packages/SystemUI/res/values-television/config.xml index 981a95312736..29c3ad4bb77b 100644 --- a/packages/SystemUI/res/values-television/config.xml +++ b/packages/SystemUI/res/values-television/config.xml @@ -45,4 +45,7 @@ <!-- Show a separate icon for low and high volume on the volume dialog --> <bool name="config_showLowMediaVolumeIcon">true</bool> + + <!-- Change the volume row tint when it is inactive, i.e. when it is being dismissed --> + <bool name="config_changeVolumeRowTintWhenInactive">false</bool> </resources> diff --git a/packages/SystemUI/res/values/colors_tv.xml b/packages/SystemUI/res/values/colors_tv.xml index 1177bb5757c2..23ca24a6c9a1 100644 --- a/packages/SystemUI/res/values/colors_tv.xml +++ b/packages/SystemUI/res/values/colors_tv.xml @@ -28,5 +28,9 @@ <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_seek_thumb_focus_ring">#1AFFFFFF</color> + <color name="tv_volume_dialog_seek_thumb_shadow">#40000000</color> + <color name="tv_volume_dialog_seek_bar_background">#193C4043</color> + <color name="tv_volume_dialog_seek_bar_fill">#FFF8F9FA</color> <color name="tv_volume_dialog_accent">#FFDADCE0</color> </resources> diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index ab09a967bc26..446ed3eee3d2 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -562,4 +562,7 @@ <!-- Show a separate icon for low and high volume on the volume dialog --> <bool name="config_showLowMediaVolumeIcon">false</bool> + + <!-- Change the volume row tint when it is inactive, i.e. when it is being dismissed --> + <bool name="config_changeVolumeRowTintWhenInactive">true</bool> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 78f83d3c09b4..43754a2e94ae 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -155,6 +155,7 @@ public class VolumeDialogImpl implements VolumeDialog, private boolean mShowA11yStream; private final boolean mShowLowMediaVolumeIcon; + private final boolean mChangeVolumeRowTintWhenInactive; private int mActiveStream; private int mPrevActiveStream; @@ -183,6 +184,8 @@ public class VolumeDialogImpl implements VolumeDialog, Prefs.getBoolean(context, Prefs.Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP, false); mShowLowMediaVolumeIcon = mContext.getResources().getBoolean(R.bool.config_showLowMediaVolumeIcon); + mChangeVolumeRowTintWhenInactive = + mContext.getResources().getBoolean(R.bool.config_changeVolumeRowTintWhenInactive); } @Override @@ -1154,6 +1157,9 @@ public class VolumeDialogImpl implements VolumeDialog, row.slider.requestFocus(); } boolean useActiveColoring = isActive && row.slider.isEnabled(); + if (!useActiveColoring && !mChangeVolumeRowTintWhenInactive) { + return; + } final ColorStateList tint = useActiveColoring ? Utils.getColorAccent(mContext) : Utils.getColorAttr(mContext, android.R.attr.colorForeground); |