Skip to content

Commit

Permalink
fixed 3p themed icons not applying
Browse files Browse the repository at this point in the history
- closes : #4799
- closes : #4752
- closes : #4267
- closes : #4248
- closes : #4179
- closes : #4157
- closes : #3960
- closes : #3943
- closes : #3408
- closes : #2882
  • Loading branch information
MrSluffy committed Jan 1, 2025
1 parent 31dfcc8 commit b684505
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/com/android/launcher3/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ public static <T extends Context & ActivityContext> Pair<AdaptiveIconDrawable, D
badge = icon.getBadge();
}

if (useTheme && mainIcon instanceof BitmapInfo.Extender) {
mainIcon = ((BitmapInfo.Extender) mainIcon).getThemedDrawable(context);
}

if (mainIcon == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public ComponentWithIconCachingLogic(Context context, boolean addToMemCache) {
@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()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public CharSequence getLabel(@NonNull LauncherActivityInfo object) {
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()));
}
}
}
2 changes: 1 addition & 1 deletion src/com/android/launcher3/model/WidgetItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public WidgetItem(LauncherAppWidgetProviderInfo info,
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;

Expand Down
3 changes: 1 addition & 2 deletions src/com/android/launcher3/model/data/ItemInfoWithIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand Down Expand Up @@ -328,7 +327,7 @@ public FastBitmapDrawable newIcon(Context context, boolean applyTheme) {
* 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;
}
Expand Down

0 comments on commit b684505

Please sign in to comment.