use of com.android.launcher3.icons.FastBitmapDrawable in project android_packages_apps_Launcher3 by crdroidandroid.
the class ItemInfoWithIcon method newIcon.
/**
* Returns a FastBitmapDrawable with the icon and context theme applied
*/
public FastBitmapDrawable newIcon(Context context, boolean applyTheme) {
FastBitmapDrawable drawable = applyTheme ? bitmap.newThemedIcon(context) : bitmap.newIcon(context);
drawable.setIsDisabled(isDisabled());
return drawable;
}
use of com.android.launcher3.icons.FastBitmapDrawable in project android_packages_apps_Launcher3 by crdroidandroid.
the class BubbleTextView method applyIconAndLabel.
@UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER;
FastBitmapDrawable iconDrawable = info.newIcon(getContext(), useTheme);
mDotParams.color = IconPalette.getMutedColor(iconDrawable.getIconColor(), 0.54f);
setIcon(iconDrawable);
applyLabel(info);
}
use of com.android.launcher3.icons.FastBitmapDrawable in project android_packages_apps_Launcher3 by AOSPA.
the class Workspace method createWidgetDrawable.
private Drawable createWidgetDrawable(ItemInfo widgetInfo, View layout) {
int[] unScaledSize = estimateItemSize(widgetInfo);
int visibility = layout.getVisibility();
layout.setVisibility(VISIBLE);
int width = MeasureSpec.makeMeasureSpec(unScaledSize[0], MeasureSpec.EXACTLY);
int height = MeasureSpec.makeMeasureSpec(unScaledSize[1], MeasureSpec.EXACTLY);
layout.measure(width, height);
layout.layout(0, 0, unScaledSize[0], unScaledSize[1]);
Bitmap b = BitmapRenderer.createHardwareBitmap(unScaledSize[0], unScaledSize[1], layout::draw);
layout.setVisibility(visibility);
return new FastBitmapDrawable(b);
}
use of com.android.launcher3.icons.FastBitmapDrawable in project android_packages_apps_Launcher3 by AOSPA.
the class BubbleTextView method applyIconAndLabel.
@UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER || mDisplay == DISPLAY_TASKBAR;
FastBitmapDrawable iconDrawable = info.newIcon(getContext(), useTheme);
mDotParams.color = IconPalette.getMutedColor(iconDrawable.getIconColor(), 0.54f);
setIcon(iconDrawable);
applyLabel(info);
}
use of com.android.launcher3.icons.FastBitmapDrawable in project android_packages_apps_Launcher3 by AOSPA.
the class PendingAppWidgetHostView method reapplyItemInfo.
@Override
public void reapplyItemInfo(ItemInfoWithIcon info) {
if (mCenterDrawable != null) {
mCenterDrawable.setCallback(null);
mCenterDrawable = null;
}
if (info.bitmap.icon != null) {
Drawable widgetCategoryIcon = getWidgetCategoryIcon();
// 3) App icon in the center with a setup icon on the top left corner.
if (mDisabledForSafeMode) {
if (widgetCategoryIcon == null) {
FastBitmapDrawable disabledIcon = info.newIcon(getContext());
disabledIcon.setIsDisabled(true);
mCenterDrawable = disabledIcon;
} else {
widgetCategoryIcon.setColorFilter(FastBitmapDrawable.getDisabledFColorFilter(/* disabledAlpha= */
1f));
mCenterDrawable = widgetCategoryIcon;
}
mSettingIconDrawable = null;
} else if (isReadyForClickSetup()) {
mCenterDrawable = widgetCategoryIcon == null ? info.newIcon(getContext()) : widgetCategoryIcon;
mSettingIconDrawable = getResources().getDrawable(R.drawable.ic_setting).mutate();
updateSettingColor(info.bitmap.color);
} else {
mCenterDrawable = widgetCategoryIcon == null ? newPendingIcon(getContext(), info) : widgetCategoryIcon;
mSettingIconDrawable = null;
applyState();
}
mCenterDrawable.setCallback(this);
mDrawableSizeChanged = true;
}
invalidate();
}
Aggregations