fix: Show themed icon on customise popup when icon theming is on (#7053)
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
1 parent
bfca14f685
commit
ef452bcdd0
1 file changed
+16
-4
@@ -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<Any?>(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) {
|
||||
|
||||
Reference in new issue
Block a user