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

Commit 5e4a276e authored by Adnan Begovic's avatar Adnan Begovic
Browse files

Add feature flag for the mono app icon adapted colors.

- if this feature flag is on, then the app icon colors will be adapted (luminance based) to the colors in the palette provided by the user.
- if it's off, then the app icon colors will be the provided palette colors directly.

Bug: 418850749
Flag: com.android.launcher3.show_files_on_home_screen
Test: manually
Change-Id: I87eee9fecf119386992649ffa1ef7512a8233df8
parent 5fea47ac
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.LinearGradient
import android.graphics.Shader.TileMode.CLAMP
import android.util.Log
import androidx.annotation.VisibleForTesting
import com.android.launcher3.Flags
import com.android.launcher3.icons.BitmapInfo
import com.android.launcher3.icons.ClockDrawableWrapper.ClockAnimationInfo
import com.android.launcher3.icons.FastBitmapDrawableDelegate.DelegateFactory
@@ -81,6 +82,11 @@ class ColorAdapter(private val luminanceDelta: Double) {
    private val luminanceComputer = LuminanceComputer.createDefaultLuminanceComputer()

    fun adaptedColorProvider(colorProvider: (Context) -> IntArray): (Context) -> IntArray {
        // if the feature flag is off, then we don't need to adapt the colors at all.
        if (!Flags.forceMonochromeAppIconsAdaptColors()) {
            return colorProvider
        }

        // we need to adapt the color provider here, by adapting the foregrund color at
        // index 0, and the background color at index 1.