use of com.android.launcher3.icons.pack.IconResolver in project android_packages_apps_404Launcher by P-404.
the class ThirdPartyDrawableFactory method newIcon.
@Override
public FastBitmapDrawable newIcon(Context context, ItemInfoWithIcon info) {
if (info != null && info.getTargetComponent() != null && info.itemType == ITEM_TYPE_APPLICATION) {
ComponentKey key = new ComponentKey(info.getTargetComponent(), info.user);
IconResolver resolver = mManager.resolve(key);
mCalendars.setIsDynamic(key, (resolver != null && resolver.isCalendar()) || info.getTargetComponent().getPackageName().equals(DynamicCalendar.CALENDAR));
if (Utilities.ATLEAST_OREO) {
if (resolver != null) {
if (resolver.isClock()) {
Drawable drawable = resolver.getIcon(0, () -> null);
if (drawable != null) {
FastBitmapDrawable fb = mCustomClockDrawer.drawIcon(info, drawable, resolver.clockData());
fb.setIsDisabled(info.isDisabled());
return fb;
}
}
} else if (info.getTargetComponent().equals(DynamicClock.DESK_CLOCK)) {
return mDynamicClockDrawer.drawIcon(info);
}
}
}
return super.newIcon(context, info);
}
use of com.android.launcher3.icons.pack.IconResolver in project android_packages_apps_404Launcher by P-404.
the class ThirdPartyIconUtils method getByKey.
static Drawable getByKey(Context context, ComponentKey key, int iconDpi, IconResolver.DefaultDrawableProvider fallback) {
IconResolver resolver = IconPackManager.get(context).resolve(key);
Drawable icon = resolver == null ? null : resolver.getIcon(iconDpi, fallback);
if (Utilities.ATLEAST_OREO) {
// Icon pack clocks go first.
if (icon != null && resolver.isClock()) {
return CustomClock.getClock(context, icon, resolver.clockData());
}
// Google Clock goes second, but only if the icon pack does not override it.
if (icon == null && key.componentName.equals(DynamicClock.DESK_CLOCK)) {
return DynamicClock.getClock(context, iconDpi);
}
}
// Google Calendar is checked last. Only applied if the icon pack does not override it.
if (icon == null && key.componentName.getPackageName().equals(DynamicCalendar.CALENDAR)) {
return DynamicCalendar.load(context, key.componentName, iconDpi);
}
return icon;
}
Aggregations