Merge changes I127f0891,I7827c622

* changes:
  Remove change of tint on volume dialog hide on TV
  Adjust volume ui on TV
This commit is contained in:
Galia Peycheva
2020-09-24 11:38:40 +00:00
committed by Android (Google) Code Review
8 changed files with 94 additions and 7 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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);