From 4dcacd3719d0ecfe15e6ef94dd105d70d8d007a9 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Fri, 5 Jan 2018 11:36:51 -0800 Subject: [PATCH] Single color scrim Removed gradient and kept brightest color. Test: atest ./tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java Test: visual Bug: 64122537 Change-Id: I75cba32172a5869f3d8a57ab9955bffcba60db76 --- .../internal/colorextraction/types/Tonal.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/core/java/com/android/internal/colorextraction/types/Tonal.java b/core/java/com/android/internal/colorextraction/types/Tonal.java index 71baaf177eac8..9b7383fcbe8ac 100644 --- a/core/java/com/android/internal/colorextraction/types/Tonal.java +++ b/core/java/com/android/internal/colorextraction/types/Tonal.java @@ -53,10 +53,8 @@ public class Tonal implements ExtractionType { public static final int THRESHOLD_COLOR_LIGHT = 0xffe0e0e0; public static final int MAIN_COLOR_LIGHT = 0xffe0e0e0; - public static final int SECONDARY_COLOR_LIGHT = 0xff9e9e9e; public static final int THRESHOLD_COLOR_DARK = 0xff212121; public static final int MAIN_COLOR_DARK = 0xff000000; - public static final int SECONDARY_COLOR_DARK = 0xff000000; private final TonalPalette mGreyPalette; private final ArrayList mTonalPalettes; @@ -211,10 +209,8 @@ public class Tonal implements ExtractionType { } // Normal colors: - // best fit + a 2 colors offset outColorsNormal.setMainColor(mainColor); - int secondaryIndex = primaryIndex + (primaryIndex >= 2 ? -2 : 2); - outColorsNormal.setSecondaryColor(getColorInt(secondaryIndex, h, s, l)); + outColorsNormal.setSecondaryColor(mainColor); // Dark colors: // Stops at 4th color, only lighter if dark text is supported @@ -225,9 +221,9 @@ public class Tonal implements ExtractionType { } else { primaryIndex = Math.min(fitIndex, 3); } - secondaryIndex = primaryIndex + (primaryIndex >= 2 ? -2 : 2); - outColorsDark.setMainColor(getColorInt(primaryIndex, h, s, l)); - outColorsDark.setSecondaryColor(getColorInt(secondaryIndex, h, s, l)); + mainColor = getColorInt(primaryIndex, h, s, l); + outColorsDark.setMainColor(mainColor); + outColorsDark.setSecondaryColor(mainColor); // Extra Dark: // Stay close to dark colors until dark text is supported @@ -238,9 +234,9 @@ public class Tonal implements ExtractionType { } else { primaryIndex = 2; } - secondaryIndex = primaryIndex + (primaryIndex >= 2 ? -2 : 2); - outColorsExtraDark.setMainColor(getColorInt(primaryIndex, h, s, l)); - outColorsExtraDark.setSecondaryColor(getColorInt(secondaryIndex, h, s, l)); + mainColor = getColorInt(primaryIndex, h, s, l); + outColorsExtraDark.setMainColor(mainColor); + outColorsExtraDark.setSecondaryColor(mainColor); outColorsNormal.setSupportsDarkText(supportsDarkText); outColorsDark.setSupportsDarkText(supportsDarkText); @@ -273,11 +269,10 @@ public class Tonal implements ExtractionType { boolean light = inWallpaperColors != null && (inWallpaperColors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT) != 0; - int innerColor = light ? MAIN_COLOR_LIGHT : MAIN_COLOR_DARK; - int outerColor = light ? SECONDARY_COLOR_LIGHT : SECONDARY_COLOR_DARK; + final int color = light ? MAIN_COLOR_LIGHT : MAIN_COLOR_DARK; - outGradientColors.setMainColor(innerColor); - outGradientColors.setSecondaryColor(outerColor); + outGradientColors.setMainColor(color); + outGradientColors.setSecondaryColor(color); outGradientColors.setSupportsDarkText(light); }