Loading packages/SystemUI/src/com/android/systemui/media/ColorSchemeTransition.kt +15 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.animation.ValueAnimator import android.content.Context import android.content.res.ColorStateList import android.graphics.drawable.GradientDrawable import android.graphics.drawable.RippleDrawable import com.android.internal.R import com.android.internal.annotations.VisibleForTesting import com.android.settingslib.Utils Loading Loading @@ -130,8 +131,19 @@ class ColorSchemeTransition internal constructor( ) { accentPrimary -> val accentColorList = ColorStateList.valueOf(accentPrimary) mediaViewHolder.actionPlayPause.backgroundTintList = accentColorList mediaViewHolder.seamlessButton.backgroundTintList = accentColorList mediaViewHolder.gutsViewHolder.setAccentPrimaryColor(accentPrimary) mediaViewHolder.seamlessButton.backgroundTintList = accentColorList } val accentSecondary = animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::accentSecondaryFromScheme ) { accentSecondary -> val colorList = ColorStateList.valueOf(accentSecondary) (mediaViewHolder.seamlessButton.background as? RippleDrawable)?.let { it.setColor(colorList) it.effectColor = colorList } } val textPrimary = animatingColorTransitionFactory( Loading Loading @@ -203,6 +215,7 @@ class ColorSchemeTransition internal constructor( val colorTransitions = arrayOf( surfaceColor, accentPrimary, accentSecondary, textPrimary, textPrimaryInverse, textSecondary, Loading packages/SystemUI/src/com/android/systemui/media/MediaColorSchemes.kt +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ internal fun surfaceFromScheme(scheme: ColorScheme) = scheme.accent2[9] // A2-80 /** Returns the primary accent color for media controls based on the scheme. */ internal fun accentPrimaryFromScheme(scheme: ColorScheme) = scheme.accent1[2] // A1-100 /** Returns the secondary accent color for media controls based on the scheme. */ internal fun accentSecondaryFromScheme(scheme: ColorScheme) = scheme.accent1[3] // A1-200 /** Returns the primary text color for media controls based on the scheme. */ internal fun textPrimaryFromScheme(scheme: ColorScheme) = scheme.neutral1[1] // N1-50 Loading packages/SystemUI/tests/src/com/android/systemui/media/ColorSchemeTransitionTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ class ColorSchemeTransitionTest : SysuiTestCase() { @Test fun testColorSchemeTransition_update() { colorSchemeTransition.updateColorScheme(colorScheme) verify(mockAnimatingTransition, times(6)).updateColorScheme(colorScheme) verify(mockAnimatingTransition, times(7)).updateColorScheme(colorScheme) verify(mockGenericTransition).updateColorScheme(colorScheme) } } Loading
packages/SystemUI/src/com/android/systemui/media/ColorSchemeTransition.kt +15 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.animation.ValueAnimator import android.content.Context import android.content.res.ColorStateList import android.graphics.drawable.GradientDrawable import android.graphics.drawable.RippleDrawable import com.android.internal.R import com.android.internal.annotations.VisibleForTesting import com.android.settingslib.Utils Loading Loading @@ -130,8 +131,19 @@ class ColorSchemeTransition internal constructor( ) { accentPrimary -> val accentColorList = ColorStateList.valueOf(accentPrimary) mediaViewHolder.actionPlayPause.backgroundTintList = accentColorList mediaViewHolder.seamlessButton.backgroundTintList = accentColorList mediaViewHolder.gutsViewHolder.setAccentPrimaryColor(accentPrimary) mediaViewHolder.seamlessButton.backgroundTintList = accentColorList } val accentSecondary = animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::accentSecondaryFromScheme ) { accentSecondary -> val colorList = ColorStateList.valueOf(accentSecondary) (mediaViewHolder.seamlessButton.background as? RippleDrawable)?.let { it.setColor(colorList) it.effectColor = colorList } } val textPrimary = animatingColorTransitionFactory( Loading Loading @@ -203,6 +215,7 @@ class ColorSchemeTransition internal constructor( val colorTransitions = arrayOf( surfaceColor, accentPrimary, accentSecondary, textPrimary, textPrimaryInverse, textSecondary, Loading
packages/SystemUI/src/com/android/systemui/media/MediaColorSchemes.kt +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ internal fun surfaceFromScheme(scheme: ColorScheme) = scheme.accent2[9] // A2-80 /** Returns the primary accent color for media controls based on the scheme. */ internal fun accentPrimaryFromScheme(scheme: ColorScheme) = scheme.accent1[2] // A1-100 /** Returns the secondary accent color for media controls based on the scheme. */ internal fun accentSecondaryFromScheme(scheme: ColorScheme) = scheme.accent1[3] // A1-200 /** Returns the primary text color for media controls based on the scheme. */ internal fun textPrimaryFromScheme(scheme: ColorScheme) = scheme.neutral1[1] // N1-50 Loading
packages/SystemUI/tests/src/com/android/systemui/media/ColorSchemeTransitionTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ class ColorSchemeTransitionTest : SysuiTestCase() { @Test fun testColorSchemeTransition_update() { colorSchemeTransition.updateColorScheme(colorScheme) verify(mockAnimatingTransition, times(6)).updateColorScheme(colorScheme) verify(mockAnimatingTransition, times(7)).updateColorScheme(colorScheme) verify(mockGenericTransition).updateColorScheme(colorScheme) } }