Merge "Fix TV volume dialog" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
16798ed432
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2021 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"
|
||||||
|
android:paddingMode="stack">
|
||||||
|
<item android:id="@android:id/background"
|
||||||
|
android:gravity="center_vertical|fill_horizontal">
|
||||||
|
<layer-list>
|
||||||
|
<item android:id="@+id/volume_seekbar_background_solid">
|
||||||
|
<shape>
|
||||||
|
<size android:height="@dimen/volume_dialog_slider_width" />
|
||||||
|
<solid android:color="@color/tv_volume_dialog_seek_bar_background"/>
|
||||||
|
<corners android:radius="@dimen/volume_dialog_slider_corner_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
<item android:id="@android:id/progress"
|
||||||
|
android:gravity="center_vertical|fill_horizontal">
|
||||||
|
<com.android.systemui.util.RoundedCornerProgressDrawable
|
||||||
|
android:drawable="@drawable/volume_row_seekbar_progress"
|
||||||
|
/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (C) 2021 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Progress drawable for volume row SeekBars. This is the accent-colored round rect that moves up
|
||||||
|
and down as the progress value changes. -->
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:autoMirrored="true">
|
||||||
|
<item android:id="@+id/volume_seekbar_progress_solid">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<size android:height="@dimen/volume_dialog_slider_width"/>
|
||||||
|
<solid android:color="@color/tv_volume_dialog_seek_bar_fill" />
|
||||||
|
<corners android:radius="@dimen/volume_dialog_slider_width" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
<layer-list>
|
<layer-list>
|
||||||
<item android:id="@+id/volume_seekbar_background_solid">
|
<item android:id="@+id/volume_seekbar_background_solid">
|
||||||
<shape>
|
<shape>
|
||||||
<size android:height="@dimen/volume_dialog_panel_width" />
|
<size android:height="@dimen/volume_dialog_slider_width" />
|
||||||
<solid android:color="?android:attr/colorBackgroundFloating" />
|
<solid android:color="?android:attr/colorBackgroundFloating" />
|
||||||
<corners android:radius="@dimen/volume_dialog_panel_width_half" />
|
<corners android:radius="@dimen/volume_dialog_slider_corner_radius" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:tag="row"
|
android:tag="row"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/volume_dialog_row_height"
|
android:layout_height="@dimen/volume_dialog_panel_height"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
@@ -54,18 +54,18 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/volume_row_slider_frame"
|
android:id="@+id/volume_row_slider_frame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/volume_dialog_row_height">
|
android:layout_height="@dimen/volume_dialog_panel_height">
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/volume_row_slider"
|
android:id="@+id/volume_row_slider"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:layout_width="@dimen/volume_dialog_row_height"
|
android:layout_width="@dimen/volume_dialog_panel_height"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layoutDirection="ltr"
|
android:layoutDirection="ltr"
|
||||||
android:maxHeight="@dimen/tv_volume_seek_bar_width"
|
android:maxHeight="@dimen/volume_dialog_slider_width"
|
||||||
android:minHeight="@dimen/tv_volume_seek_bar_width"
|
android:minHeight="@dimen/volume_dialog_slider_width"
|
||||||
|
android:progressDrawable="@drawable/volume_row_seekbar"
|
||||||
android:thumb="@drawable/tv_volume_row_seek_thumb"
|
android:thumb="@drawable/tv_volume_row_seek_thumb"
|
||||||
android:progressDrawable="@drawable/tv_volume_row_seek_bar"
|
|
||||||
android:splitTrack="false"
|
android:splitTrack="false"
|
||||||
android:rotation="270" />
|
android:rotation="270" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
android:layout_width="@dimen/volume_row_slider_height"
|
android:layout_width="@dimen/volume_row_slider_height"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:thumb="@android:color/transparent"
|
||||||
android:rotation="270" />
|
android:rotation="270" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,17 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Height of volume bar -->
|
<!-- Height of volume bar -->
|
||||||
<dimen name="volume_dialog_row_height">190dp</dimen>
|
<dimen name="volume_dialog_panel_height">190dp</dimen>
|
||||||
<dimen name="volume_dialog_row_width">48dp</dimen>
|
<dimen name="volume_dialog_panel_width">48dp</dimen>
|
||||||
|
<dimen name="volume_dialog_panel_width_half">24dp</dimen>
|
||||||
<dimen name="volume_dialog_panel_transparent_padding">24dp</dimen>
|
<dimen name="volume_dialog_panel_transparent_padding">24dp</dimen>
|
||||||
|
<dimen name="volume_dialog_slider_width">4dp</dimen>
|
||||||
|
<dimen name="volume_dialog_slider_corner_radius">@dimen/volume_dialog_slider_width</dimen>
|
||||||
|
|
||||||
<dimen name="tv_volume_dialog_bubble_size">36dp</dimen>
|
<dimen name="tv_volume_dialog_bubble_size">36dp</dimen>
|
||||||
<dimen name="tv_volume_dialog_corner_radius">36dp</dimen>
|
<dimen name="tv_volume_dialog_corner_radius">36dp</dimen>
|
||||||
<dimen name="tv_volume_dialog_row_padding">6dp</dimen>
|
<dimen name="tv_volume_dialog_row_padding">6dp</dimen>
|
||||||
<dimen name="tv_volume_number_text_size">16sp</dimen>
|
<dimen name="tv_volume_number_text_size">16sp</dimen>
|
||||||
<dimen name="tv_volume_seek_bar_width">4dp</dimen>
|
|
||||||
<dimen name="tv_volume_seek_bar_thumb_diameter">24dp</dimen>
|
<dimen name="tv_volume_seek_bar_thumb_diameter">24dp</dimen>
|
||||||
<dimen name="tv_volume_seek_bar_thumb_focus_ring_width">8dp</dimen>
|
<dimen name="tv_volume_seek_bar_thumb_focus_ring_width">8dp</dimen>
|
||||||
<dimen name="tv_volume_icons_size">20dp</dimen>
|
<dimen name="tv_volume_icons_size">20dp</dimen>
|
||||||
|
|||||||
@@ -462,6 +462,10 @@
|
|||||||
|
|
||||||
<dimen name="volume_dialog_slider_height">116dp</dimen>
|
<dimen name="volume_dialog_slider_height">116dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="volume_dialog_slider_width">@dimen/volume_dialog_panel_width</dimen>
|
||||||
|
|
||||||
|
<dimen name="volume_dialog_slider_corner_radius">@dimen/volume_dialog_panel_width_half</dimen>
|
||||||
|
|
||||||
<dimen name="volume_dialog_ringer_size">64dp</dimen>
|
<dimen name="volume_dialog_ringer_size">64dp</dimen>
|
||||||
|
|
||||||
<dimen name="volume_dialog_ringer_icon_padding">20dp</dimen>
|
<dimen name="volume_dialog_ringer_icon_padding">20dp</dimen>
|
||||||
|
|||||||
@@ -546,9 +546,10 @@ public class VolumeDialogImpl implements VolumeDialog,
|
|||||||
row.sliderBgSolid = seekbarBgDrawable.findDrawableByLayerId(
|
row.sliderBgSolid = seekbarBgDrawable.findDrawableByLayerId(
|
||||||
R.id.volume_seekbar_background_solid);
|
R.id.volume_seekbar_background_solid);
|
||||||
|
|
||||||
row.sliderBgIcon = (AlphaTintDrawableWrapper)
|
final Drawable sliderBgIcon = seekbarBgDrawable.findDrawableByLayerId(
|
||||||
((RotateDrawable) seekbarBgDrawable.findDrawableByLayerId(
|
R.id.volume_seekbar_background_icon);
|
||||||
R.id.volume_seekbar_background_icon)).getDrawable();
|
row.sliderBgIcon = sliderBgIcon != null ? (AlphaTintDrawableWrapper)
|
||||||
|
((RotateDrawable) sliderBgIcon).getDrawable() : null;
|
||||||
|
|
||||||
final LayerDrawable seekbarProgressDrawable = (LayerDrawable)
|
final LayerDrawable seekbarProgressDrawable = (LayerDrawable)
|
||||||
((RoundedCornerProgressDrawable) seekbarDrawable.findDrawableByLayerId(
|
((RoundedCornerProgressDrawable) seekbarDrawable.findDrawableByLayerId(
|
||||||
@@ -556,13 +557,12 @@ public class VolumeDialogImpl implements VolumeDialog,
|
|||||||
|
|
||||||
row.sliderProgressSolid = seekbarProgressDrawable.findDrawableByLayerId(
|
row.sliderProgressSolid = seekbarProgressDrawable.findDrawableByLayerId(
|
||||||
R.id.volume_seekbar_progress_solid);
|
R.id.volume_seekbar_progress_solid);
|
||||||
|
final Drawable sliderProgressIcon = seekbarProgressDrawable.findDrawableByLayerId(
|
||||||
row.sliderProgressIcon = (AlphaTintDrawableWrapper)
|
R.id.volume_seekbar_progress_icon);
|
||||||
((RotateDrawable) seekbarProgressDrawable.findDrawableByLayerId(
|
row.sliderProgressIcon = sliderProgressIcon != null ? (AlphaTintDrawableWrapper)
|
||||||
R.id.volume_seekbar_progress_icon)).getDrawable();
|
((RotateDrawable) sliderProgressIcon).getDrawable() : null;
|
||||||
|
|
||||||
row.slider.setProgressDrawable(seekbarDrawable);
|
row.slider.setProgressDrawable(seekbarDrawable);
|
||||||
row.slider.setThumb(null);
|
|
||||||
|
|
||||||
row.icon = row.view.findViewById(R.id.volume_row_icon);
|
row.icon = row.view.findViewById(R.id.volume_row_icon);
|
||||||
|
|
||||||
@@ -1484,10 +1484,14 @@ public class VolumeDialogImpl implements VolumeDialog,
|
|||||||
mContext, android.R.attr.colorBackgroundFloating);
|
mContext, android.R.attr.colorBackgroundFloating);
|
||||||
|
|
||||||
row.sliderProgressSolid.setTintList(colorTint);
|
row.sliderProgressSolid.setTintList(colorTint);
|
||||||
row.sliderBgIcon.setTintList(colorTint);
|
if (row.sliderBgIcon != null) {
|
||||||
|
row.sliderBgIcon.setTintList(colorTint);
|
||||||
|
}
|
||||||
|
|
||||||
row.sliderBgSolid.setTintList(bgTint);
|
row.sliderBgSolid.setTintList(bgTint);
|
||||||
row.sliderProgressIcon.setTintList(bgTint);
|
if (row.sliderProgressIcon != null) {
|
||||||
|
row.sliderProgressIcon.setTintList(bgTint);
|
||||||
|
}
|
||||||
|
|
||||||
if (row.icon != null) {
|
if (row.icon != null) {
|
||||||
row.icon.setImageTintList(colorTint);
|
row.icon.setImageTintList(colorTint);
|
||||||
@@ -1878,8 +1882,12 @@ public class VolumeDialogImpl implements VolumeDialog,
|
|||||||
icon.setImageResource(iconRes);
|
icon.setImageResource(iconRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
sliderProgressIcon.setDrawable(view.getResources().getDrawable(iconRes, theme));
|
if (sliderProgressIcon != null) {
|
||||||
sliderBgIcon.setDrawable(view.getResources().getDrawable(iconRes, theme));
|
sliderProgressIcon.setDrawable(view.getResources().getDrawable(iconRes, theme));
|
||||||
|
}
|
||||||
|
if (sliderBgIcon != null) {
|
||||||
|
sliderBgIcon.setDrawable(view.getResources().getDrawable(iconRes, theme));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user