Merge "Update resume icon and colors" into sc-dev

This commit is contained in:
Beth Thibodeau
2021-05-14 14:56:04 +00:00
committed by Android (Google) Code Review
6 changed files with 54 additions and 26 deletions

View File

@@ -0,0 +1,21 @@
<?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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<item android:color="?androidprv:attr/colorAccentTertiary"/>
</selector>

View File

@@ -75,7 +75,7 @@
android:id="@+id/media_logo1"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
style="@style/MediaPlayer.AppIcon.Recommendation" />
style="@style/MediaPlayer.AppIcon" />
<ImageView
android:id="@+id/media_cover2"
@@ -91,7 +91,7 @@
android:id="@+id/media_logo2"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
style="@style/MediaPlayer.AppIcon.Recommendation" />
style="@style/MediaPlayer.AppIcon" />
<ImageView
android:id="@+id/media_cover3"
@@ -107,7 +107,7 @@
android:id="@+id/media_logo3"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
style="@style/MediaPlayer.AppIcon.Recommendation" />
style="@style/MediaPlayer.AppIcon" />
<ImageView
android:id="@+id/media_cover4"
@@ -123,7 +123,7 @@
android:id="@+id/media_logo4"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
style="@style/MediaPlayer.AppIcon.Recommendation" />
style="@style/MediaPlayer.AppIcon" />
<ImageView
android:id="@+id/media_cover5"
@@ -139,7 +139,7 @@
android:id="@+id/media_logo5"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
style="@style/MediaPlayer.AppIcon.Recommendation" />
style="@style/MediaPlayer.AppIcon" />
<ImageView
android:id="@+id/media_cover6"
@@ -155,7 +155,7 @@
android:id="@+id/media_logo6"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
style="@style/MediaPlayer.AppIcon.Recommendation" />
style="@style/MediaPlayer.AppIcon" />
<!-- Long press menu -->
<TextView

View File

@@ -145,6 +145,7 @@
android:layout_width="@dimen/qs_seamless_icon_size"
android:layout_height="@dimen/qs_seamless_icon_size"
android:layout_gravity="center"
android:tint="?android:attr/textColorPrimary"
android:src="@*android:drawable/ic_media_seamless" />
<TextView
android:id="@+id/media_seamless_text"

View File

@@ -649,19 +649,14 @@
</style>
<style name="MediaPlayer.SolidButton">
<item name="android:backgroundTint">?android:attr/colorAccent</item>
<item name="android:backgroundTint">@color/media_player_solid_button_bg</item>
<item name="android:tint">?android:attr/colorPrimary</item>
<item name="android:textColor">?android:attr/colorPrimary</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="MediaPlayer.AppIcon">
<item name="android:background">@drawable/qs_media_icon_background</item>
<item name="android:backgroundTint">?android:attr/colorPrimary</item>
<item name="android:tint">?android:attr/colorAccent</item>
</style>
<style name="MediaPlayer.AppIcon.Recommendation" parent="MediaPlayer.AppIcon">
<item name="android:tint">@color/transparent</item>
<item name="android:backgroundTint">?android:attr/textColorPrimary</item>
</style>
<style name="MediaPlayer.Album">

View File

@@ -69,6 +69,7 @@
android:layout_marginBottom="@dimen/qs_media_padding"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<!-- Song name -->

View File

@@ -45,6 +45,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.constraintlayout.widget.ConstraintSet;
import com.android.settingslib.Utils;
import com.android.settingslib.widget.AdaptiveIcon;
import com.android.systemui.R;
import com.android.systemui.animation.ActivityLaunchAnimator;
@@ -303,11 +304,23 @@ public class MediaControlPanel {
}
// App icon
ImageView appIcon = mPlayerViewHolder.getAppIcon();
if (data.getAppIcon() != null) {
appIcon.setImageIcon(data.getAppIcon());
ImageView appIconView = mPlayerViewHolder.getAppIcon();
appIconView.clearColorFilter();
if (data.getAppIcon() != null && !data.getResumption()) {
appIconView.setImageIcon(data.getAppIcon());
int color = Utils.getColorAttrDefaultColor(mContext,
com.android.internal.R.attr.colorAccentTertiary);
appIconView.setColorFilter(color);
} else {
appIcon.setImageResource(R.drawable.ic_music_note);
appIconView.setColorFilter(getGrayscaleFilter());
try {
Drawable icon = mContext.getPackageManager().getApplicationIcon(
data.getPackageName());
appIconView.setImageDrawable(icon);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Cannot find icon for package " + data.getPackageName(), e);
appIconView.setImageResource(R.drawable.ic_music_note);
}
}
// Song name
@@ -400,7 +413,7 @@ public class MediaControlPanel {
setVisibleAndAlpha(collapsedSet, ACTION_IDS[i], false /*visible */);
setVisibleAndAlpha(expandedSet, ACTION_IDS[i], false /* visible */);
}
// If no expanded buttons, set the first view as INVISIBLE so z remains constant
// If no actions, set the first view as INVISIBLE so expanded height remains constant
if (actionIcons.size() == 0) {
expandedSet.setVisibility(ACTION_IDS[0], ConstraintSet.INVISIBLE);
}
@@ -514,9 +527,9 @@ public class MediaControlPanel {
// Get the logo from app's package name when applicable.
String packageName = extras.getString(EXTRAS_MEDIA_SOURCE_PACKAGE_NAME);
try {
Drawable drawable = mContext.getPackageManager().getApplicationIcon(
icon = mContext.getPackageManager().getApplicationIcon(
packageName);
icon = convertToGrayscale(drawable);
icon.setColorFilter(getGrayscaleFilter());
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "No media source icon can be fetched via package name", e);
}
@@ -646,13 +659,10 @@ public class MediaControlPanel {
return (state.getState() == PlaybackState.STATE_PLAYING);
}
/** Convert the pass-in source drawable to a grayscale one. */
private Drawable convertToGrayscale(Drawable drawable) {
private ColorMatrixColorFilter getGrayscaleFilter() {
ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
drawable.setColorFilter(filter);
return drawable;
return new ColorMatrixColorFilter(matrix);
}
private void setVisibleAndAlpha(ConstraintSet set, int actionId, boolean visible) {