Search in sources :

Example 1 with DrawableFactory

use of com.android.launcher3.graphics.DrawableFactory in project android_packages_apps_404Launcher by P-404.

the class PendingAppWidgetHostView method reapplyItemInfo.

@Override
public void reapplyItemInfo(ItemInfoWithIcon info) {
    DrawableFactory drawableFactory = DrawableFactory.INSTANCE.get(getContext());
    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 = drawableFactory.newIcon(getContext(), info);
                disabledIcon.setIsDisabled(true);
                mCenterDrawable = disabledIcon;
            } else {
                widgetCategoryIcon.setColorFilter(FastBitmapDrawable.getDisabledFColorFilter(/* disabledAlpha= */
                1f));
                mCenterDrawable = widgetCategoryIcon;
            }
            mSettingIconDrawable = null;
        } else if (isReadyForClickSetup()) {
            mCenterDrawable = widgetCategoryIcon == null ? drawableFactory.newIcon(getContext(), info) : widgetCategoryIcon;
            mSettingIconDrawable = getResources().getDrawable(R.drawable.ic_setting).mutate();
            updateSettingColor(info.bitmap.color);
        } else {
            mCenterDrawable = widgetCategoryIcon == null ? drawableFactory.newPendingIcon(getContext(), info) : widgetCategoryIcon;
            mSettingIconDrawable = null;
            applyState();
        }
        mCenterDrawable.setCallback(this);
        mDrawableSizeChanged = true;
    }
    invalidate();
}
Also used : FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) Drawable(android.graphics.drawable.Drawable) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) DrawableFactory(com.android.launcher3.graphics.DrawableFactory)

Example 2 with DrawableFactory

use of com.android.launcher3.graphics.DrawableFactory in project Neo-Launcher by NeoApplications.

the class PendingAppWidgetHostView method reapplyItemInfo.

@Override
public void reapplyItemInfo(ItemInfoWithIcon info) {
    if (mCenterDrawable != null) {
        mCenterDrawable.setCallback(null);
        mCenterDrawable = null;
    }
    if (info.iconBitmap != null) {
        // The view displays three modes,
        // 1) App icon in the center
        // 2) Preload icon in the center
        // 3) Setup icon in the center and app icon in the top right corner.
        DrawableFactory drawableFactory = DrawableFactory.INSTANCE.get(getContext());
        if (mDisabledForSafeMode) {
            FastBitmapDrawable disabledIcon = drawableFactory.newIcon(getContext(), info);
            disabledIcon.setIsDisabled(true);
            mCenterDrawable = disabledIcon;
            mSettingIconDrawable = null;
        } else if (isReadyForClickSetup()) {
            mCenterDrawable = drawableFactory.newIcon(getContext(), info);
            mSettingIconDrawable = getResources().getDrawable(R.drawable.ic_setting).mutate();
            updateSettingColor(info.iconColor);
        } else {
            mCenterDrawable = DrawableFactory.INSTANCE.get(getContext()).newPendingIcon(getContext(), info);
            mSettingIconDrawable = null;
            applyState();
        }
        mCenterDrawable.setCallback(this);
        mDrawableSizeChanged = true;
    }
    invalidate();
}
Also used : FastBitmapDrawable(com.android.launcher3.FastBitmapDrawable) DrawableFactory(com.android.launcher3.graphics.DrawableFactory)

Aggregations

DrawableFactory (com.android.launcher3.graphics.DrawableFactory)2 Drawable (android.graphics.drawable.Drawable)1 FastBitmapDrawable (com.android.launcher3.FastBitmapDrawable)1 FastBitmapDrawable (com.android.launcher3.icons.FastBitmapDrawable)1