Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d250655 authored by Caitlin Cassidy's avatar Caitlin Cassidy Committed by Android (Google) Code Review
Browse files

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

parents 99b30edb ba66d500
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@ class MediaCarouselController @Inject constructor(
    private val visualStabilityCallback: OnReorderingAllowedListener
    private var needsReordering: Boolean = false
    private var keysNeedRemoval = mutableSetOf<String>()
    private var bgColor = getBackgroundColor()
    protected var shouldScrollToActivePlayer: Boolean = false
    private var isRtl: Boolean = false
        set(value) {
@@ -488,7 +487,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.copy(backgroundColor = bgColor))
        newRecs.bindRecommendation(data)
        val curVisibleMediaKey = MediaPlayerData.playerKeys()
                .elementAtOrNull(mediaCarouselScrollHandler.visibleMediaIndex)
        MediaPlayerData.addMediaRecommendation(key, data, newRecs, shouldPrioritize, systemClock)
@@ -534,7 +533,6 @@ class MediaCarouselController @Inject constructor(
    }

    private fun recreatePlayers() {
        bgColor = getBackgroundColor()
        pageIndicator.tintList = ColorStateList.valueOf(R.color.material_dynamic_neutral_variant80)

        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() {
        val numPages = mediaContent.getChildCount()
        pageIndicator.setNumPages(numPages)
+7 −2
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import androidx.constraintlayout.widget.ConstraintSet;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.logging.InstanceId;
import com.android.settingslib.Utils;
import com.android.settingslib.widget.AdaptiveIcon;
import com.android.systemui.ActivityIntentHelper;
import com.android.systemui.R;
@@ -953,11 +954,11 @@ public class MediaControlPanel {
        }

        mSmartspaceId = SmallHash.hash(data.getTargetId());
        int backgroundColor = data.getBackgroundColor();
        mPackageName = data.getPackageName();
        mInstanceId = data.getInstanceId();
        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();
        if (mediaRecommendationList == null || mediaRecommendationList.isEmpty()) {
@@ -1057,6 +1058,8 @@ public class MediaControlPanel {
            TextView titleView =
                    mRecommendationViewHolder.getMediaTitles().get(uiComponentIndex);
            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?

            // Set up subtitle
@@ -1067,6 +1070,8 @@ public class MediaControlPanel {
            boolean shouldShowSubtitleText = !TextUtils.isEmpty(title);
            CharSequence subtitleText = shouldShowSubtitleText ? subtitle : "";
            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?

            uiComponentIndex++;
+0 −2
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ internal val EMPTY_SMARTSPACE_MEDIA_DATA = SmartspaceMediaData(
    cardAction = null,
    recommendations = emptyList(),
    dismissIntent = null,
    backgroundColor = 0,
    headphoneConnectionTimeMillis = 0,
    instanceId = InstanceId.fakeInstanceId(-1))

@@ -1228,7 +1227,6 @@ class MediaDataManager(
                cardAction = target.baseAction,
                recommendations = target.iconGrid,
                dismissIntent = dismissIntent,
                backgroundColor = 0,
                headphoneConnectionTimeMillis = target.creationTimeMillis,
                instanceId = logger.getNewInstanceId())
        }
+0 −4
Original line number Diff line number Diff line
@@ -50,10 +50,6 @@ data class SmartspaceMediaData(
     * Intent for the user's initiated dismissal.
     */
    val dismissIntent: Intent?,
    /**
     * View's background color.
     */
    val backgroundColor: Int,
    /**
     * The timestamp in milliseconds that headphone is connected.
     */
+0 −1
Original line number Diff line number Diff line
@@ -510,7 +510,6 @@ class MediaDataManagerTest : SysuiTestCase() {
                cardAction = mediaSmartspaceBaseAction,
                recommendations = listOf(mediaRecommendationItem),
                dismissIntent = DISMISS_INTENT,
                backgroundColor = 0,
                headphoneConnectionTimeMillis = 1234L,
                instanceId = InstanceId.fakeInstanceId(instanceId))),
            eq(false))