Allow to hide the linear progress bar in playback view
And remove duplicate spinner resources and unused
mPlaybackQueueBackgroundAlpha.
Fixes: 136085615
Test: manual
Change-Id: Ie10ea3ad4137da34c8e780da73e7f45df64cb345
diff --git a/res/drawable/music_buffering.xml b/res/drawable/music_buffering.xml
deleted file mode 100644
index e85241d..0000000
--- a/res/drawable/music_buffering.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2016, 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.
--->
-<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/vector_drawable_progress_bar_medium_thin" >
- <target
- android:name="progressBar"
- android:animation="@anim/progress_indeterminate_material" />
- <target
- android:name="root"
- android:animation="@anim/progress_indeterminate_rotation_material" />
-</animated-vector>
diff --git a/res/drawable/vector_drawable_progress_bar_medium_thin.xml b/res/drawable/vector_drawable_progress_bar_medium_thin.xml
deleted file mode 100644
index 682db26..0000000
--- a/res/drawable/vector_drawable_progress_bar_medium_thin.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2016, 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="48dp"
- android:width="48dp"
- android:viewportHeight="48"
- android:viewportWidth="48" >
- <group
- android:name="root"
- android:translateX="24.0"
- android:translateY="24.0" >
- <path
- android:name="progressBar"
- android:fillColor="#00000000"
- android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
- android:strokeColor="?android:attr/colorControlActivated"
- android:strokeLineCap="square"
- android:strokeLineJoin="miter"
- android:strokeWidth="2"
- android:trimPathEnd="0"
- android:trimPathOffset="0"
- android:trimPathStart="0" />
- </group>
-</vector>
diff --git a/src/com/android/car/media/PlaybackFragment.java b/src/com/android/car/media/PlaybackFragment.java
index 7ecb661..92f50e1 100644
--- a/src/com/android/car/media/PlaybackFragment.java
+++ b/src/com/android/car/media/PlaybackFragment.java
@@ -89,8 +89,9 @@
private boolean mShowIconForActiveQueueItem;
private boolean mShowThumbnailForQueueItem;
+ private boolean mShowLinearProgressBar;
+
private int mFadeDuration;
- private float mPlaybackQueueBackgroundAlpha;
/**
* PlaybackFragment listener
@@ -287,21 +288,30 @@
R.bool.show_icon_for_now_playing_queue_list_item);
mShowThumbnailForQueueItem = getContext().getResources().getBoolean(
R.bool.show_thumbnail_for_queue_list_item);
+ mShowLinearProgressBar = getContext().getResources().getBoolean(
+ R.bool.show_linear_progress_bar);
- boolean useMediaSourceColor = res.getBoolean(
- R.bool.use_media_source_color_for_progress_bar);
- int defaultColor = res.getColor(R.color.progress_bar_highlight, null);
- if (useMediaSourceColor) {
- getPlaybackViewModel().getMediaSourceColors().observe(getViewLifecycleOwner(),
- sourceColors -> {
- int color = sourceColors != null ? sourceColors.getAccentColor(defaultColor)
- : defaultColor;
- mSeekBar.setThumbTintList(ColorStateList.valueOf(color));
- mSeekBar.setProgressTintList(ColorStateList.valueOf(color));
- });
- } else {
- mSeekBar.setThumbTintList(ColorStateList.valueOf(defaultColor));
- mSeekBar.setProgressTintList(ColorStateList.valueOf(defaultColor));
+ if (mSeekBar != null) {
+ if (mShowLinearProgressBar) {
+ boolean useMediaSourceColor = res.getBoolean(
+ R.bool.use_media_source_color_for_progress_bar);
+ int defaultColor = res.getColor(R.color.progress_bar_highlight, null);
+ if (useMediaSourceColor) {
+ getPlaybackViewModel().getMediaSourceColors().observe(getViewLifecycleOwner(),
+ sourceColors -> {
+ int color = sourceColors != null ? sourceColors.getAccentColor(
+ defaultColor)
+ : defaultColor;
+ mSeekBar.setThumbTintList(ColorStateList.valueOf(color));
+ mSeekBar.setProgressTintList(ColorStateList.valueOf(color));
+ });
+ } else {
+ mSeekBar.setThumbTintList(ColorStateList.valueOf(defaultColor));
+ mSeekBar.setProgressTintList(ColorStateList.valueOf(defaultColor));
+ }
+ } else {
+ mSeekBar.setVisibility(View.GONE);
+ }
}
MediaAppSelectorWidget appIcon = view.findViewById(R.id.app_icon_container);
@@ -399,8 +409,6 @@
private void initQueue() {
mFadeDuration = getResources().getInteger(
R.integer.fragment_playback_queue_fade_duration_ms);
- mPlaybackQueueBackgroundAlpha = getResources().getFloat(
- R.dimen.playback_queue_background_alpha);
int decorationHeight = getResources().getDimensionPixelSize(
R.dimen.playback_queue_list_padding_top);
@@ -460,7 +468,7 @@
TextView curTime = view.findViewById(R.id.current_time);
TextView innerSeparator = view.findViewById(R.id.inner_separator);
TextView maxTime = view.findViewById(R.id.max_time);
- SeekBar seekbar = view.findViewById(R.id.seek_bar);
+ SeekBar seekbar = mShowLinearProgressBar? mSeekBar : null;
mMetadataController = new MetadataController(getViewLifecycleOwner(),
getPlaybackViewModel(), title, artist, albumTitle, outerSeparator,
@@ -477,14 +485,18 @@
mQueueButton.setSelected(mQueueIsVisible);
if (mQueueIsVisible) {
ViewUtils.hideViewAnimated(mMetadataContainer, mFadeDuration);
- ViewUtils.hideViewAnimated(mSeekBar, mFadeDuration);
ViewUtils.showViewAnimated(mQueue, mFadeDuration);
ViewUtils.showViewAnimated(mBackgroundScrim, mFadeDuration);
+ if (mShowLinearProgressBar) {
+ ViewUtils.hideViewAnimated(mSeekBar, mFadeDuration);
+ }
} else {
ViewUtils.hideViewAnimated(mQueue, mFadeDuration);
ViewUtils.showViewAnimated(mMetadataContainer, mFadeDuration);
- ViewUtils.showViewAnimated(mSeekBar, mFadeDuration);
ViewUtils.hideViewAnimated(mBackgroundScrim, mFadeDuration);
+ if (mShowLinearProgressBar) {
+ ViewUtils.showViewAnimated(mSeekBar, mFadeDuration);
+ }
}
}