From ef452bcdd00b3ea57db6f838482c4563fa572928 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Fri, 24 Jul 2026 00:08:09 +0700 Subject: [PATCH] fix: Show themed icon on customise popup when icon theming is on (#7053) Signed-off-by: Pun Butrach --- .../lawnchair/ui/popup/LawnchairShortcut.kt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lawnchair/src/app/lawnchair/ui/popup/LawnchairShortcut.kt b/lawnchair/src/app/lawnchair/ui/popup/LawnchairShortcut.kt index d0b039676d..dfa719975e 100644 --- a/lawnchair/src/app/lawnchair/ui/popup/LawnchairShortcut.kt +++ b/lawnchair/src/app/lawnchair/ui/popup/LawnchairShortcut.kt @@ -10,6 +10,7 @@ import android.content.pm.ApplicationInfo import android.content.pm.LauncherActivityInfo import android.content.pm.LauncherApps import android.content.pm.SuspendDialogInfo +import android.graphics.drawable.AdaptiveIconDrawable import android.net.Uri import android.os.UserHandle import android.util.Log @@ -27,7 +28,8 @@ import com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION import com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_TASK import com.android.launcher3.R import com.android.launcher3.Utilities -import com.android.launcher3.icons.BitmapInfo +import com.android.launcher3.graphics.ThemeManager +import com.android.launcher3.icons.LauncherIcons import com.android.launcher3.model.data.AppInfo as ModelAppInfo import com.android.launcher3.model.data.ItemInfo import com.android.launcher3.popup.SystemShortcut @@ -125,9 +127,19 @@ class LawnchairShortcut { override fun onClick(v: View) { val outObj = Array(1) { null } var icon = Utilities.loadFullDrawableWithoutTheme(launcher, appInfo, 0, 0, outObj) - if (mItemInfo.screenId != NO_ID && icon is BitmapInfo.Extender) { - // Lawnchair-TODO-BubbleTea: Fix getThemedDrawable - // icon = icon.getThemedDrawable(launcher) + if (mItemInfo.screenId != NO_ID && Utilities.ATLEAST_T) { + val adaptiveIcon = icon as? AdaptiveIconDrawable + ?: LauncherIcons.obtain(launcher).use { it.wrapToAdaptiveIcon(icon) } + if (adaptiveIcon != null) { + val themeController = ThemeManager.INSTANCE.get(launcher).themeController + themeController?.createThemedAdaptiveIcon( + launcher, + adaptiveIcon, + appInfo.bitmap, + )?.let { + icon = it + } + } } val launcherActivityInfo = outObj[0] as LauncherActivityInfo? if (launcherActivityInfo != null) {