Loading packages/SystemUI/colorextraction/src/com/google/android/colorextraction/ColorExtractor.java +14 −1 Original line number Diff line number Diff line Loading @@ -95,12 +95,25 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener if (inWallpaperColors == null) { return; } mExtractionType.extractInto(inWallpaperColors, outGradientColors); boolean success = mExtractionType.extractInto(inWallpaperColors, outGradientColors); if (success) { // Updating dark text support. We're going to verify if the mean luminosity // is greater then a threshold. float hsl[] = new float[3]; float meanLuminosity = 0; ColorUtils.colorToHSL(outGradientColors.getMainColor(), hsl); meanLuminosity += hsl[2]; ColorUtils.colorToHSL(outGradientColors.getSecondaryColor(), hsl); meanLuminosity += hsl[2]; meanLuminosity /= 2; outGradientColors.setSupportsDarkText(meanLuminosity >= DARK_TEXT_LUMINOSITY); } } private void applyFallback(GradientColors outGradientColors) { outGradientColors.setMainColor(mMainFallbackColor); outGradientColors.setSecondaryColor(mSecondaryFallbackColor); outGradientColors.setSupportsDarkText(false); } public void destroy() { Loading packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/ExtractionType.java +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ public interface ExtractionType { * * @param inWallpaperColors where to read from * @param outGradientColors object that should receive the colors * @return true if successful */ void extractInto(WallpaperColors inWallpaperColors, boolean extractInto(WallpaperColors inWallpaperColors, ColorExtractor.GradientColors outGradientColors); } packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/Tonal.java +266 −255 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
packages/SystemUI/colorextraction/src/com/google/android/colorextraction/ColorExtractor.java +14 −1 Original line number Diff line number Diff line Loading @@ -95,12 +95,25 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener if (inWallpaperColors == null) { return; } mExtractionType.extractInto(inWallpaperColors, outGradientColors); boolean success = mExtractionType.extractInto(inWallpaperColors, outGradientColors); if (success) { // Updating dark text support. We're going to verify if the mean luminosity // is greater then a threshold. float hsl[] = new float[3]; float meanLuminosity = 0; ColorUtils.colorToHSL(outGradientColors.getMainColor(), hsl); meanLuminosity += hsl[2]; ColorUtils.colorToHSL(outGradientColors.getSecondaryColor(), hsl); meanLuminosity += hsl[2]; meanLuminosity /= 2; outGradientColors.setSupportsDarkText(meanLuminosity >= DARK_TEXT_LUMINOSITY); } } private void applyFallback(GradientColors outGradientColors) { outGradientColors.setMainColor(mMainFallbackColor); outGradientColors.setSecondaryColor(mSecondaryFallbackColor); outGradientColors.setSupportsDarkText(false); } public void destroy() { Loading
packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/ExtractionType.java +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ public interface ExtractionType { * * @param inWallpaperColors where to read from * @param outGradientColors object that should receive the colors * @return true if successful */ void extractInto(WallpaperColors inWallpaperColors, boolean extractInto(WallpaperColors inWallpaperColors, ColorExtractor.GradientColors outGradientColors); }
packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/Tonal.java +266 −255 File changed.Preview size limit exceeded, changes collapsed. Show changes