Loading src/com/android/customization/model/color/ColorProvider.kt +25 −10 Original line number Diff line number Diff line Loading @@ -306,24 +306,36 @@ class ColorProvider(private val context: Context, stubPackageName: String) : ) } /** * Returns the light theme contrast-adjusted preview of a preset ColorScheme, based on this * order: top left, top right, bottom left, bottom right */ private fun getDarkPresetColorPreview(colorScheme: ColorScheme): IntArray { val colors = when (colorScheme.style) { Style.FRUIT_SALAD -> intArrayOf(colorScheme.accent3.s100, colorScheme.accent1.s200) else -> intArrayOf(colorScheme.accent1.s200, colorScheme.accent1.s200) } return intArrayOf(colors[0], colors[1], colors[0], colors[1]) } /** * Returns the preview of a preset ColorScheme based on this order: top left, top right, bottom * left, bottom right */ private fun getFixedPresetColorPreview(colorScheme: ColorScheme): IntArray { private fun getFixedPresetColorPreview(colorScheme: ColorScheme, seed: Int): IntArray { val colors = when (colorScheme.style) { Style.FRUIT_SALAD -> intArrayOf(colorScheme.accent3.s100, colorScheme.accent1.s200) Style.TONAL_SPOT -> intArrayOf(colorScheme.accentColor, colorScheme.accentColor) Style.RAINBOW -> intArrayOf(colorScheme.accent1.s200, colorScheme.accent1.s200) else -> intArrayOf(colorScheme.accent1.s100, colorScheme.accent1.s100) else -> intArrayOf(seed, seed) } return intArrayOf(colors[0], colors[1], colors[0], colors[1]) } /** * Returns the light theme contrast-adjusted preview of a preset ColorScheme, specifically for * Revamped UI, based on this order: top left, top right, bottom left, bottom right * Returns the light theme contrast-adjusted preview of a preset ColorScheme, based on this * order: top left, top right, bottom left, bottom right */ private fun getLightPresetColorPreview(colorScheme: ColorScheme): IntArray { val colors = Loading @@ -333,13 +345,11 @@ class ColorProvider(private val context: Context, stubPackageName: String) : colorScheme.accent3.getAtTone(450f), colorScheme.accent1.getAtTone(550f), ) Style.TONAL_SPOT -> intArrayOf(colorScheme.accentColor, colorScheme.accentColor) Style.RAINBOW -> else -> intArrayOf( colorScheme.accent1.getAtTone(450f), colorScheme.accent1.getAtTone(450f), ) else -> intArrayOf(colorScheme.accent1.s100, colorScheme.accent1.s100) } return intArrayOf(colors[0], colors[1], colors[0], colors[1]) } Loading Loading @@ -447,10 +457,15 @@ class ColorProvider(private val context: Context, stubPackageName: String) : lightColors = getLightMonochromePreview(lightColorScheme) } else -> { darkColors = getFixedPresetColorPreview(darkColorScheme) darkColors = if (isNewPickerUi) { getFixedPresetColorPreview(darkColorScheme, colorFromStub) } else { getDarkPresetColorPreview(darkColorScheme) } lightColors = if (isNewPickerUi) { getFixedPresetColorPreview(lightColorScheme) getFixedPresetColorPreview(lightColorScheme, colorFromStub) } else { getLightPresetColorPreview(lightColorScheme) } Loading Loading
src/com/android/customization/model/color/ColorProvider.kt +25 −10 Original line number Diff line number Diff line Loading @@ -306,24 +306,36 @@ class ColorProvider(private val context: Context, stubPackageName: String) : ) } /** * Returns the light theme contrast-adjusted preview of a preset ColorScheme, based on this * order: top left, top right, bottom left, bottom right */ private fun getDarkPresetColorPreview(colorScheme: ColorScheme): IntArray { val colors = when (colorScheme.style) { Style.FRUIT_SALAD -> intArrayOf(colorScheme.accent3.s100, colorScheme.accent1.s200) else -> intArrayOf(colorScheme.accent1.s200, colorScheme.accent1.s200) } return intArrayOf(colors[0], colors[1], colors[0], colors[1]) } /** * Returns the preview of a preset ColorScheme based on this order: top left, top right, bottom * left, bottom right */ private fun getFixedPresetColorPreview(colorScheme: ColorScheme): IntArray { private fun getFixedPresetColorPreview(colorScheme: ColorScheme, seed: Int): IntArray { val colors = when (colorScheme.style) { Style.FRUIT_SALAD -> intArrayOf(colorScheme.accent3.s100, colorScheme.accent1.s200) Style.TONAL_SPOT -> intArrayOf(colorScheme.accentColor, colorScheme.accentColor) Style.RAINBOW -> intArrayOf(colorScheme.accent1.s200, colorScheme.accent1.s200) else -> intArrayOf(colorScheme.accent1.s100, colorScheme.accent1.s100) else -> intArrayOf(seed, seed) } return intArrayOf(colors[0], colors[1], colors[0], colors[1]) } /** * Returns the light theme contrast-adjusted preview of a preset ColorScheme, specifically for * Revamped UI, based on this order: top left, top right, bottom left, bottom right * Returns the light theme contrast-adjusted preview of a preset ColorScheme, based on this * order: top left, top right, bottom left, bottom right */ private fun getLightPresetColorPreview(colorScheme: ColorScheme): IntArray { val colors = Loading @@ -333,13 +345,11 @@ class ColorProvider(private val context: Context, stubPackageName: String) : colorScheme.accent3.getAtTone(450f), colorScheme.accent1.getAtTone(550f), ) Style.TONAL_SPOT -> intArrayOf(colorScheme.accentColor, colorScheme.accentColor) Style.RAINBOW -> else -> intArrayOf( colorScheme.accent1.getAtTone(450f), colorScheme.accent1.getAtTone(450f), ) else -> intArrayOf(colorScheme.accent1.s100, colorScheme.accent1.s100) } return intArrayOf(colors[0], colors[1], colors[0], colors[1]) } Loading Loading @@ -447,10 +457,15 @@ class ColorProvider(private val context: Context, stubPackageName: String) : lightColors = getLightMonochromePreview(lightColorScheme) } else -> { darkColors = getFixedPresetColorPreview(darkColorScheme) darkColors = if (isNewPickerUi) { getFixedPresetColorPreview(darkColorScheme, colorFromStub) } else { getDarkPresetColorPreview(darkColorScheme) } lightColors = if (isNewPickerUi) { getFixedPresetColorPreview(lightColorScheme) getFixedPresetColorPreview(lightColorScheme, colorFromStub) } else { getLightPresetColorPreview(lightColorScheme) } Loading