Merge "[Media Rec] Update the background to be colorSurface." into tm-dev

This commit is contained in:
Caitlin Cassidy
2022-04-18 13:24:38 +00:00
committed by Android (Google) Code Review
5 changed files with 8 additions and 16 deletions

View File

@@ -127,7 +127,6 @@ class MediaCarouselController @Inject constructor(
private val visualStabilityCallback: OnReorderingAllowedListener private val visualStabilityCallback: OnReorderingAllowedListener
private var needsReordering: Boolean = false private var needsReordering: Boolean = false
private var keysNeedRemoval = mutableSetOf<String>() private var keysNeedRemoval = mutableSetOf<String>()
private var bgColor = getBackgroundColor()
protected var shouldScrollToActivePlayer: Boolean = false protected var shouldScrollToActivePlayer: Boolean = false
private var isRtl: Boolean = false private var isRtl: Boolean = false
set(value) { set(value) {
@@ -488,7 +487,7 @@ class MediaCarouselController @Inject constructor(
val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT) ViewGroup.LayoutParams.WRAP_CONTENT)
newRecs.recommendationViewHolder?.recommendations?.setLayoutParams(lp) newRecs.recommendationViewHolder?.recommendations?.setLayoutParams(lp)
newRecs.bindRecommendation(data.copy(backgroundColor = bgColor)) newRecs.bindRecommendation(data)
val curVisibleMediaKey = MediaPlayerData.playerKeys() val curVisibleMediaKey = MediaPlayerData.playerKeys()
.elementAtOrNull(mediaCarouselScrollHandler.visibleMediaIndex) .elementAtOrNull(mediaCarouselScrollHandler.visibleMediaIndex)
MediaPlayerData.addMediaRecommendation(key, data, newRecs, shouldPrioritize, systemClock) MediaPlayerData.addMediaRecommendation(key, data, newRecs, shouldPrioritize, systemClock)
@@ -534,7 +533,6 @@ class MediaCarouselController @Inject constructor(
} }
private fun recreatePlayers() { private fun recreatePlayers() {
bgColor = getBackgroundColor()
pageIndicator.tintList = ColorStateList.valueOf(R.color.material_dynamic_neutral_variant80) pageIndicator.tintList = ColorStateList.valueOf(R.color.material_dynamic_neutral_variant80)
MediaPlayerData.mediaData().forEach { (key, data, isSsMediaRec) -> MediaPlayerData.mediaData().forEach { (key, data, isSsMediaRec) ->
@@ -554,10 +552,6 @@ class MediaCarouselController @Inject constructor(
} }
} }
private fun getBackgroundColor(): Int {
return context.getColor(R.color.material_dynamic_secondary95)
}
private fun updatePageIndicator() { private fun updatePageIndicator() {
val numPages = mediaContent.getChildCount() val numPages = mediaContent.getChildCount()
pageIndicator.setNumPages(numPages) pageIndicator.setNumPages(numPages)

View File

@@ -60,6 +60,7 @@ import androidx.constraintlayout.widget.ConstraintSet;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceId;
import com.android.settingslib.Utils;
import com.android.settingslib.widget.AdaptiveIcon; import com.android.settingslib.widget.AdaptiveIcon;
import com.android.systemui.ActivityIntentHelper; import com.android.systemui.ActivityIntentHelper;
import com.android.systemui.R; import com.android.systemui.R;
@@ -953,11 +954,11 @@ public class MediaControlPanel {
} }
mSmartspaceId = SmallHash.hash(data.getTargetId()); mSmartspaceId = SmallHash.hash(data.getTargetId());
int backgroundColor = data.getBackgroundColor();
mPackageName = data.getPackageName(); mPackageName = data.getPackageName();
mInstanceId = data.getInstanceId(); mInstanceId = data.getInstanceId();
TransitionLayout recommendationCard = mRecommendationViewHolder.getRecommendations(); TransitionLayout recommendationCard = mRecommendationViewHolder.getRecommendations();
recommendationCard.setBackgroundTintList(ColorStateList.valueOf(backgroundColor)); recommendationCard.setBackgroundTintList(
Utils.getColorAttr(mContext, com.android.internal.R.attr.colorSurface));
List<SmartspaceAction> mediaRecommendationList = data.getRecommendations(); List<SmartspaceAction> mediaRecommendationList = data.getRecommendations();
if (mediaRecommendationList == null || mediaRecommendationList.isEmpty()) { if (mediaRecommendationList == null || mediaRecommendationList.isEmpty()) {
@@ -1057,6 +1058,8 @@ public class MediaControlPanel {
TextView titleView = TextView titleView =
mRecommendationViewHolder.getMediaTitles().get(uiComponentIndex); mRecommendationViewHolder.getMediaTitles().get(uiComponentIndex);
titleView.setText(title); titleView.setText(title);
titleView.setTextColor(Utils.getColorAttrDefaultColor(
mContext, com.android.internal.R.attr.textColorPrimary));
// TODO(b/223603970): If none of them have titles, should we then hide the views? // TODO(b/223603970): If none of them have titles, should we then hide the views?
// Set up subtitle // Set up subtitle
@@ -1067,6 +1070,8 @@ public class MediaControlPanel {
boolean shouldShowSubtitleText = !TextUtils.isEmpty(title); boolean shouldShowSubtitleText = !TextUtils.isEmpty(title);
CharSequence subtitleText = shouldShowSubtitleText ? subtitle : ""; CharSequence subtitleText = shouldShowSubtitleText ? subtitle : "";
subtitleView.setText(subtitleText); subtitleView.setText(subtitleText);
subtitleView.setTextColor(Utils.getColorAttrDefaultColor(
mContext, com.android.internal.R.attr.textColorSecondary));
// TODO(b/223603970): If none of them have subtitles, should we then hide the views? // TODO(b/223603970): If none of them have subtitles, should we then hide the views?
uiComponentIndex++; uiComponentIndex++;

View File

@@ -110,7 +110,6 @@ internal val EMPTY_SMARTSPACE_MEDIA_DATA = SmartspaceMediaData(
cardAction = null, cardAction = null,
recommendations = emptyList(), recommendations = emptyList(),
dismissIntent = null, dismissIntent = null,
backgroundColor = 0,
headphoneConnectionTimeMillis = 0, headphoneConnectionTimeMillis = 0,
instanceId = InstanceId.fakeInstanceId(-1)) instanceId = InstanceId.fakeInstanceId(-1))
@@ -1228,7 +1227,6 @@ class MediaDataManager(
cardAction = target.baseAction, cardAction = target.baseAction,
recommendations = target.iconGrid, recommendations = target.iconGrid,
dismissIntent = dismissIntent, dismissIntent = dismissIntent,
backgroundColor = 0,
headphoneConnectionTimeMillis = target.creationTimeMillis, headphoneConnectionTimeMillis = target.creationTimeMillis,
instanceId = logger.getNewInstanceId()) instanceId = logger.getNewInstanceId())
} }

View File

@@ -50,10 +50,6 @@ data class SmartspaceMediaData(
* Intent for the user's initiated dismissal. * Intent for the user's initiated dismissal.
*/ */
val dismissIntent: Intent?, val dismissIntent: Intent?,
/**
* View's background color.
*/
val backgroundColor: Int,
/** /**
* The timestamp in milliseconds that headphone is connected. * The timestamp in milliseconds that headphone is connected.
*/ */

View File

@@ -510,7 +510,6 @@ class MediaDataManagerTest : SysuiTestCase() {
cardAction = mediaSmartspaceBaseAction, cardAction = mediaSmartspaceBaseAction,
recommendations = listOf(mediaRecommendationItem), recommendations = listOf(mediaRecommendationItem),
dismissIntent = DISMISS_INTENT, dismissIntent = DISMISS_INTENT,
backgroundColor = 0,
headphoneConnectionTimeMillis = 1234L, headphoneConnectionTimeMillis = 1234L,
instanceId = InstanceId.fakeInstanceId(instanceId))), instanceId = InstanceId.fakeInstanceId(instanceId))),
eq(false)) eq(false))