Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt +11 −2 Original line number Diff line number Diff line Loading @@ -1472,6 +1472,7 @@ constructor( } // This is a hosting view, let's remeasure our players val prevLocation = this.desiredLocation this.desiredLocation = desiredLocation this.desiredHostState = it currentlyExpanded = it.expansion > 0 Loading Loading @@ -1504,7 +1505,11 @@ constructor( mediaPlayer.closeGuts(!animate) } mediaPlayer.mediaViewController.onLocationPreChange(desiredLocation) mediaPlayer.mediaViewController.onLocationPreChange( mediaPlayer.mediaViewHolder, desiredLocation, prevLocation, ) } } else { controllerById.values.forEach { controller -> Loading @@ -1515,7 +1520,11 @@ constructor( controller.closeGuts(!animate) } controller.onLocationPreChange(desiredLocation) controller.onLocationPreChange( controller.mediaViewHolder, desiredLocation, prevLocation, ) } } mediaCarouselScrollHandler.showsSettingsButton = !it.showsOnlyActiveMedia Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt +41 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Context import android.content.res.Configuration import android.graphics.Color import android.graphics.Paint import android.graphics.Typeface import android.graphics.drawable.Drawable import android.provider.Settings import android.view.View Loading @@ -43,6 +44,10 @@ import com.android.systemui.media.controls.ui.controller.MediaCarouselController import com.android.systemui.media.controls.ui.view.GutsViewHolder import com.android.systemui.media.controls.ui.view.MediaHostState import com.android.systemui.media.controls.ui.view.MediaViewHolder import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.headlineSmallTF import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.labelLargeTF import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.labelMediumTF import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.titleMediumTF import com.android.systemui.media.controls.ui.view.RecommendationViewHolder import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel import com.android.systemui.media.controls.ui.viewmodel.SeekBarViewModel Loading Loading @@ -186,6 +191,9 @@ constructor( var isSeekBarEnabled: Boolean = false /** Whether font family should be updated. */ private var isFontUpdateAllowed: Boolean = true /** Not visible value for previous button when scrubbing */ private var prevNotVisibleValue = ConstraintSet.GONE private var isPrevButtonAvailable = false Loading Loading @@ -1108,11 +1116,43 @@ constructor( return viewState } private fun updateFontPerLocation(viewHolder: MediaViewHolder?, location: Int) { when (location) { MediaHierarchyManager.LOCATION_COMMUNAL_HUB -> viewHolder?.updateFontFamily(headlineSmallTF, titleMediumTF, labelMediumTF) else -> viewHolder?.updateFontFamily(titleMediumTF, labelLargeTF, labelMediumTF) } } private fun MediaViewHolder.updateFontFamily( titleTF: Typeface, artistTF: Typeface, menuTF: Typeface, ) { gutsViewHolder.gutsText.setTypeface(menuTF) gutsViewHolder.dismissText.setTypeface(menuTF) titleText.setTypeface(titleTF) artistText.setTypeface(artistTF) seamlessText.setTypeface(menuTF) } /** * Notify that the location is changing right now and a [setCurrentState] change is imminent. * This updates the width the view will me measured with. */ fun onLocationPreChange(@MediaLocation newLocation: Int) { fun onLocationPreChange( viewHolder: MediaViewHolder?, @MediaLocation newLocation: Int, @MediaLocation prevLocation: Int, ) { isFontUpdateAllowed = isFontUpdateAllowed || MediaHierarchyManager.LOCATION_COMMUNAL_HUB == newLocation || MediaHierarchyManager.LOCATION_COMMUNAL_HUB == prevLocation if (Flags.mediaControlsUiUpdate() && isFontUpdateAllowed) { updateFontPerLocation(viewHolder, newLocation) isFontUpdateAllowed = false } obtainViewStateForLocation(newLocation)?.let { layoutController.setMeasureState(it) } } Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaViewHolder.kt +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.media.controls.ui.view import android.graphics.Typeface import android.view.LayoutInflater import android.view.View import android.view.ViewGroup Loading Loading @@ -139,7 +140,7 @@ class MediaViewHolder constructor(itemView: View) { R.id.action4, R.id.icon, R.id.media_scrubbing_elapsed_time, R.id.media_scrubbing_total_time R.id.media_scrubbing_total_time, ) // Buttons used for notification-based actions Loading Loading @@ -175,5 +176,10 @@ class MediaViewHolder constructor(itemView: View) { R.id.loading_effect_view, R.id.touch_ripple_view, ) val headlineSmallTF: Typeface = Typeface.create("gsf-headline-small", Typeface.NORMAL) val titleMediumTF: Typeface = Typeface.create("gsf-title-medium", Typeface.NORMAL) val labelMediumTF: Typeface = Typeface.create("gsf-label-medium", Typeface.NORMAL) val labelLargeTF: Typeface = Typeface.create("gsf-label-large", Typeface.NORMAL) } } Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt +11 −2 Original line number Diff line number Diff line Loading @@ -1472,6 +1472,7 @@ constructor( } // This is a hosting view, let's remeasure our players val prevLocation = this.desiredLocation this.desiredLocation = desiredLocation this.desiredHostState = it currentlyExpanded = it.expansion > 0 Loading Loading @@ -1504,7 +1505,11 @@ constructor( mediaPlayer.closeGuts(!animate) } mediaPlayer.mediaViewController.onLocationPreChange(desiredLocation) mediaPlayer.mediaViewController.onLocationPreChange( mediaPlayer.mediaViewHolder, desiredLocation, prevLocation, ) } } else { controllerById.values.forEach { controller -> Loading @@ -1515,7 +1520,11 @@ constructor( controller.closeGuts(!animate) } controller.onLocationPreChange(desiredLocation) controller.onLocationPreChange( controller.mediaViewHolder, desiredLocation, prevLocation, ) } } mediaCarouselScrollHandler.showsSettingsButton = !it.showsOnlyActiveMedia Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaViewController.kt +41 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Context import android.content.res.Configuration import android.graphics.Color import android.graphics.Paint import android.graphics.Typeface import android.graphics.drawable.Drawable import android.provider.Settings import android.view.View Loading @@ -43,6 +44,10 @@ import com.android.systemui.media.controls.ui.controller.MediaCarouselController import com.android.systemui.media.controls.ui.view.GutsViewHolder import com.android.systemui.media.controls.ui.view.MediaHostState import com.android.systemui.media.controls.ui.view.MediaViewHolder import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.headlineSmallTF import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.labelLargeTF import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.labelMediumTF import com.android.systemui.media.controls.ui.view.MediaViewHolder.Companion.titleMediumTF import com.android.systemui.media.controls.ui.view.RecommendationViewHolder import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel import com.android.systemui.media.controls.ui.viewmodel.SeekBarViewModel Loading Loading @@ -186,6 +191,9 @@ constructor( var isSeekBarEnabled: Boolean = false /** Whether font family should be updated. */ private var isFontUpdateAllowed: Boolean = true /** Not visible value for previous button when scrubbing */ private var prevNotVisibleValue = ConstraintSet.GONE private var isPrevButtonAvailable = false Loading Loading @@ -1108,11 +1116,43 @@ constructor( return viewState } private fun updateFontPerLocation(viewHolder: MediaViewHolder?, location: Int) { when (location) { MediaHierarchyManager.LOCATION_COMMUNAL_HUB -> viewHolder?.updateFontFamily(headlineSmallTF, titleMediumTF, labelMediumTF) else -> viewHolder?.updateFontFamily(titleMediumTF, labelLargeTF, labelMediumTF) } } private fun MediaViewHolder.updateFontFamily( titleTF: Typeface, artistTF: Typeface, menuTF: Typeface, ) { gutsViewHolder.gutsText.setTypeface(menuTF) gutsViewHolder.dismissText.setTypeface(menuTF) titleText.setTypeface(titleTF) artistText.setTypeface(artistTF) seamlessText.setTypeface(menuTF) } /** * Notify that the location is changing right now and a [setCurrentState] change is imminent. * This updates the width the view will me measured with. */ fun onLocationPreChange(@MediaLocation newLocation: Int) { fun onLocationPreChange( viewHolder: MediaViewHolder?, @MediaLocation newLocation: Int, @MediaLocation prevLocation: Int, ) { isFontUpdateAllowed = isFontUpdateAllowed || MediaHierarchyManager.LOCATION_COMMUNAL_HUB == newLocation || MediaHierarchyManager.LOCATION_COMMUNAL_HUB == prevLocation if (Flags.mediaControlsUiUpdate() && isFontUpdateAllowed) { updateFontPerLocation(viewHolder, newLocation) isFontUpdateAllowed = false } obtainViewStateForLocation(newLocation)?.let { layoutController.setMeasureState(it) } } Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/view/MediaViewHolder.kt +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.media.controls.ui.view import android.graphics.Typeface import android.view.LayoutInflater import android.view.View import android.view.ViewGroup Loading Loading @@ -139,7 +140,7 @@ class MediaViewHolder constructor(itemView: View) { R.id.action4, R.id.icon, R.id.media_scrubbing_elapsed_time, R.id.media_scrubbing_total_time R.id.media_scrubbing_total_time, ) // Buttons used for notification-based actions Loading Loading @@ -175,5 +176,10 @@ class MediaViewHolder constructor(itemView: View) { R.id.loading_effect_view, R.id.touch_ripple_view, ) val headlineSmallTF: Typeface = Typeface.create("gsf-headline-small", Typeface.NORMAL) val titleMediumTF: Typeface = Typeface.create("gsf-title-medium", Typeface.NORMAL) val labelMediumTF: Typeface = Typeface.create("gsf-label-medium", Typeface.NORMAL) val labelLargeTF: Typeface = Typeface.create("gsf-label-large", Typeface.NORMAL) } }