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

Commit a738183b authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Embedding themeId in the themeController

> Adding freshnessId when parsing theme data from cache

Bug: 381897614
Test: atest ThemeManagerTest
Flag: EXEMPT refactor
Change-Id: I4d9c89d98d46c1781d97d5e0db35aef4d2a73317
parent e3043f9f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ interface ThemedBitmap {

interface IconThemeController {

    val themeID: String

    fun createThemedBitmap(
        icon: AdaptiveIconDrawable,
        info: BitmapInfo,
+7 −4
Original line number Diff line number Diff line
@@ -551,7 +551,8 @@ constructor(
                            data = monoIconData,
                            info = entry.bitmap,
                            factory = factory,
                            sourceHint = SourceHint(cacheKey, logic),
                            sourceHint =
                                SourceHint(cacheKey, logic, c.getString(INDEX_FRESHNESS_ID)),
                        )
                }
            }
@@ -659,9 +660,10 @@ constructor(

        @JvmField
        val COLUMNS_HIGH_RES =
            COLUMNS_LOW_RES.copyOf(COLUMNS_LOW_RES.size + 2).apply {
                this[size - 2] = COLUMN_ICON
                this[size - 1] = COLUMN_MONO_ICON
            COLUMNS_LOW_RES.copyOf(COLUMNS_LOW_RES.size + 3).apply {
                this[size - 3] = COLUMN_ICON
                this[size - 2] = COLUMN_MONO_ICON
                this[size - 1] = COLUMN_FRESHNESS_ID
            }

        @JvmField val INDEX_TITLE = COLUMNS_HIGH_RES.indexOf(COLUMN_LABEL)
@@ -669,6 +671,7 @@ constructor(
        @JvmField val INDEX_FLAGS = COLUMNS_HIGH_RES.indexOf(COLUMN_FLAGS)
        @JvmField val INDEX_ICON = COLUMNS_HIGH_RES.indexOf(COLUMN_ICON)
        @JvmField val INDEX_MONO_ICON = COLUMNS_HIGH_RES.indexOf(COLUMN_MONO_ICON)
        @JvmField val INDEX_FRESHNESS_ID = COLUMNS_HIGH_RES.indexOf(COLUMN_FRESHNESS_ID)

        @JvmStatic
        fun CacheLookupFlag.toLookupColumns() =
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ class MonoIconThemeController(
    private val colorProvider: (Context) -> IntArray = ThemedIconDrawable.Companion::getColors
) : IconThemeController {

    override val themeID = "with-theme"

    override fun createThemedBitmap(
        icon: AdaptiveIconDrawable,
        info: BitmapInfo,