diff --git a/packages/SystemUI/res/layout/media_smartspace_recommendations.xml b/packages/SystemUI/res/layout/media_smartspace_recommendations.xml index 9210d05bf72ef..1c4c89fb254af 100644 --- a/packages/SystemUI/res/layout/media_smartspace_recommendations.xml +++ b/packages/SystemUI/res/layout/media_smartspace_recommendations.xml @@ -19,29 +19,57 @@ + + + + + + - + android:layout_width="@dimen/qs_media_icon_size" + android:layout_height="@dimen/qs_media_icon_size" + android:background="@drawable/qs_media_icon_background" /> - + android:layout_width="@dimen/qs_media_icon_size" + android:layout_height="@dimen/qs_media_icon_size" + android:background="@drawable/qs_media_icon_background" /> - + android:layout_width="@dimen/qs_media_icon_size" + android:layout_height="@dimen/qs_media_icon_size" + android:background="@drawable/qs_media_icon_background" /> - + android:layout_width="@dimen/qs_media_icon_size" + android:layout_height="@dimen/qs_media_icon_size" + android:background="@drawable/qs_media_icon_background" /> - + + + + + + + + + + app:layout_constraintEnd_toStartOf="@id/dismiss" + app:layout_constraintTop_toBottomOf="@id/remove_text"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/remove_text"> 36dp - 80dp - 20dp + 10dp + 18dp + 72dp + 16sp 35dp diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 8601bdcafa382..71b14493069b9 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2837,6 +2837,9 @@ Settings + + Play + Inactive, check app - - - - - - - - - - - - - - - - - - - diff --git a/packages/SystemUI/res/xml/media_recommendation_collapsed.xml b/packages/SystemUI/res/xml/media_recommendation_collapsed.xml new file mode 100644 index 0000000000000..afd800b106c3d --- /dev/null +++ b/packages/SystemUI/res/xml/media_recommendation_collapsed.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/xml/media_recommendation_expanded.xml b/packages/SystemUI/res/xml/media_recommendation_expanded.xml new file mode 100644 index 0000000000000..04a4877f8660a --- /dev/null +++ b/packages/SystemUI/res/xml/media_recommendation_expanded.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt index d87142f195dc0..8d9a4be30ab62 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt @@ -317,7 +317,7 @@ class MediaCarouselController @Inject constructor( val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) newRecs.recommendationViewHolder?.recommendations?.setLayoutParams(lp) - newRecs.bindRecommendation(data, bgColor) + newRecs.bindRecommendation(data, fgColor, bgColor) MediaPlayerData.addMediaPlayer(key, newRecs) updatePlayerToState(newRecs, noAnimation = true) reorderAllPlayers() diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java index 96ae2cd377402..c713b229670de 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java +++ b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java @@ -25,6 +25,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.ColorStateList; +import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; @@ -67,9 +68,9 @@ import dagger.Lazy; public class MediaControlPanel { private static final String TAG = "MediaControlPanel"; private static final float DISABLED_ALPHA = 0.38f; - private static final String EXTRAS_MEDIA_SOURCE_LOGO = "media_source_logo"; private static final String EXTRAS_MEDIA_SOURCE_PACKAGE_NAME = "package_name"; - private static final int MEDIA_RECOMMENDATION_MAX_NUM = 4; + private static final int MEDIA_RECOMMENDATION_ITEMS_PER_ROW = 3; + private static final int MEDIA_RECOMMENDATION_MAX_NUM = 6; private static final Intent SETTINGS_INTENT = new Intent(ACTION_MEDIA_CONTROLS_SETTINGS); @@ -456,11 +457,17 @@ public class MediaControlPanel { } /** Bind this recommendation view based on the data given. */ - public void bindRecommendation(@NonNull SmartspaceTarget target, @NonNull int backgroundColor) { + public void bindRecommendation( + @NonNull SmartspaceTarget target, + @NonNull int primaryColor, + @NonNull int backgroundColor) { if (mRecommendationViewHolder == null) { return; } + mRecommendationViewHolder.getCardIcon().setColorFilter(primaryColor); + mRecommendationViewHolder.getCardText().setTextColor(primaryColor); + mRecommendationViewHolder.getRecommendations() .setBackgroundTintList(ColorStateList.valueOf(backgroundColor)); mBackgroundColor = backgroundColor; @@ -506,6 +513,8 @@ public class MediaControlPanel { // Set up media source app's logo. ImageView mediaSourceLogoImageView = mediaLogoItems.get(i); mediaSourceLogoImageView.setImageDrawable(icon); + // TODO(b/186699032): Tint the app logo using the accent color. + mediaSourceLogoImageView.setColorFilter(backgroundColor, PorterDuff.Mode.XOR); // Set up media item cover. ImageView mediaCoverImageView = mediaCoverItems.get(i); @@ -516,14 +525,17 @@ public class MediaControlPanel { mediaCoverImageView, recommendation, target.getSmartspaceTargetId(), - view -> mMediaDataManagerLazy - .get() - .dismissSmartspaceRecommendation(0L /* delay */)); + null); + if (i < MEDIA_RECOMMENDATION_ITEMS_PER_ROW) { + setVisibleAndAlpha(collapsedSet, mediaCoverItemsResIds.get(i), true); + setVisibleAndAlpha(collapsedSet, mediaLogoItemsResIds.get(i), true); + } else { + setVisibleAndAlpha(collapsedSet, mediaCoverItemsResIds.get(i), false); + setVisibleAndAlpha(collapsedSet, mediaLogoItemsResIds.get(i), false); + } setVisibleAndAlpha(expandedSet, mediaCoverItemsResIds.get(i), true); setVisibleAndAlpha(expandedSet, mediaLogoItemsResIds.get(i), true); - setVisibleAndAlpha(collapsedSet, mediaCoverItemsResIds.get(i), true); - setVisibleAndAlpha(collapsedSet, mediaLogoItemsResIds.get(i), true); } // Set up long press to show guts setting panel. diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt b/packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt index f78556f184922..50d6e12ecbc88 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt @@ -466,8 +466,8 @@ class MediaViewController @Inject constructor( collapsedLayout.load(context, R.xml.media_collapsed) expandedLayout.load(context, R.xml.media_expanded) } else { - collapsedLayout.load(context, R.xml.media_recommendation) - expandedLayout.load(context, R.xml.media_recommendation) + collapsedLayout.load(context, R.xml.media_recommendation_collapsed) + expandedLayout.load(context, R.xml.media_recommendation_expanded) } refreshState() } diff --git a/packages/SystemUI/src/com/android/systemui/media/RecommendationViewHolder.kt b/packages/SystemUI/src/com/android/systemui/media/RecommendationViewHolder.kt index 02150c4a85628..3d0e6533b33b9 100644 --- a/packages/SystemUI/src/com/android/systemui/media/RecommendationViewHolder.kt +++ b/packages/SystemUI/src/com/android/systemui/media/RecommendationViewHolder.kt @@ -20,6 +20,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView +import android.widget.TextView import androidx.annotation.IntegerRes import com.android.systemui.R import com.android.systemui.util.animation.TransitionLayout @@ -30,26 +31,36 @@ class RecommendationViewHolder private constructor(itemView: View) { val recommendations = itemView as TransitionLayout // Recommendation screen + val cardIcon = itemView.requireViewById(R.id.recommendation_card_icon) + val cardText = itemView.requireViewById(R.id.recommendation_card_text) val mediaCoverItems = listOf( itemView.requireViewById(R.id.media_cover1), itemView.requireViewById(R.id.media_cover2), itemView.requireViewById(R.id.media_cover3), - itemView.requireViewById(R.id.media_cover4)) + itemView.requireViewById(R.id.media_cover4), + itemView.requireViewById(R.id.media_cover5), + itemView.requireViewById(R.id.media_cover6)) val mediaLogoItems = listOf( itemView.requireViewById(R.id.media_logo1), itemView.requireViewById(R.id.media_logo2), itemView.requireViewById(R.id.media_logo3), - itemView.requireViewById(R.id.media_logo4)) + itemView.requireViewById(R.id.media_logo4), + itemView.requireViewById(R.id.media_logo5), + itemView.requireViewById(R.id.media_logo6)) val mediaCoverItemsResIds = listOf<@IntegerRes Int>( R.id.media_cover1, R.id.media_cover2, R.id.media_cover3, - R.id.media_cover4) + R.id.media_cover4, + R.id.media_cover5, + R.id.media_cover6) val mediaLogoItemsResIds = listOf<@IntegerRes Int>( R.id.media_logo1, R.id.media_logo2, R.id.media_logo3, - R.id.media_logo4) + R.id.media_logo4, + R.id.media_logo5, + R.id.media_logo6) // Settings/Guts screen val cancel = itemView.requireViewById(R.id.cancel) @@ -91,14 +102,20 @@ class RecommendationViewHolder private constructor(itemView: View) { // Res Ids for the control components on the recommendation view. val controlsIds = setOf( + R.id.recommendation_card_icon, + R.id.recommendation_card_text, R.id.media_cover1, R.id.media_cover2, R.id.media_cover3, R.id.media_cover4, + R.id.media_cover5, + R.id.media_cover6, R.id.media_logo1, R.id.media_logo2, R.id.media_logo3, - R.id.media_logo4 + R.id.media_logo4, + R.id.media_logo5, + R.id.media_logo6 ) // Res Ids for the components on the guts panel.