fixed 3p themed icons not applying

- closes : #4799
- closes : #4752
- closes : #4267
- closes : #4248
- closes : #4179
- closes : #4157
- closes : #3960
- closes : #3943
- closes : #3408
- closes : #2882
This commit is contained in:
MrSluffy
2025-01-01 09:56:15 +08:00
parent 31dfcc8fe6
commit b684505009
6 changed files with 12 additions and 8 deletions

View File

@@ -764,6 +764,10 @@ public final class Utilities {
badge = icon.getBadge();
}
if (useTheme && mainIcon instanceof BitmapInfo.Extender) {
mainIcon = ((BitmapInfo.Extender) mainIcon).getThemedDrawable(context);
}
if (mainIcon == null) {
return null;
}

View File

@@ -44,14 +44,14 @@ public interface ComponentWithLabelAndIcon extends ComponentWithLabel {
@NonNull
@Override
public BitmapInfo loadIcon(@NonNull Context context,
@NonNull ComponentWithLabelAndIcon object) {
@NonNull ComponentWithLabelAndIcon object) {
Drawable d = object.getFullResIcon(LauncherAppState.getInstance(context)
.getIconCache());
.getIconCache());
if (d == null) {
return super.loadIcon(context, object);
}
try (LauncherIcons li = LauncherIcons.obtain(context)) {
return li.createBadgedIconBitmap(d);
return li.createBadgedIconBitmap(d, new BaseIconFactory.IconOptions().setUser(object.getUser()));
}
}
}

View File

@@ -67,7 +67,8 @@ public class LauncherActivityCachingLogic
public BitmapInfo loadIcon(@NonNull Context context, @NonNull LauncherActivityInfo object) {
try (LauncherIcons li = LauncherIcons.obtain(context)) {
return li.createBadgedIconBitmap(LauncherAppState.getInstance(context)
.getIconProvider().getIcon(object, li.mFillResIconDpi));
.getIconProvider().getIcon(object, li.mFillResIconDpi),
new BaseIconFactory.IconOptions().setUser(object.getUser()));
}
}
}

View File

@@ -48,7 +48,7 @@ public class WidgetItem extends ComponentKey {
super(info.provider, info.getProfile());
label = iconCache.getTitleNoCache(info);
description = ATLEAST_S ? info.loadDescription(context) : null;
description = ATLEAST_S && info.loadDescription(context) != null ? info.loadDescription(context) : "";
widgetInfo = info;
activityInfo = null;

View File

@@ -23,7 +23,6 @@ import android.os.Process;
import androidx.annotation.Nullable;
import com.android.launcher3.Flags;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.logging.FileLog;
@@ -328,7 +327,7 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
* Returns a FastBitmapDrawable with the icon and context theme applied
*/
public FastBitmapDrawable newIcon(Context context, @BitmapInfo.DrawableCreationFlags int creationFlags) {
FastBitmapDrawable drawable = bitmap.newIcon(context, creationFlags);
FastBitmapDrawable drawable = (creationFlags & BitmapInfo.FLAG_THEMED) != 0 ? bitmap.newThemedIcon(context) : bitmap.newIcon(context, creationFlags);
drawable.setIsDisabled(isDisabled());
return drawable;
}