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

Commit 88eb7205 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "ColorSchemeTransition now updates the ripple color" into tm-dev am: a776c954

parents ca100c4d a776c954
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -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
@@ -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(
@@ -203,6 +215,7 @@ class ColorSchemeTransition internal constructor(
    val colorTransitions = arrayOf(
        surfaceColor,
        accentPrimary,
        accentSecondary,
        textPrimary,
        textPrimaryInverse,
        textSecondary,
+3 −0
Original line number Diff line number Diff line
@@ -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

+1 −1
Original line number Diff line number Diff line
@@ -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)
    }
}