Search in sources :

Example 31 with ItemInfoWithIcon

use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Launcher3 by ArrowOS.

the class PopupContainerWithArrow method updateNotificationHeader.

private void updateNotificationHeader() {
    ItemInfoWithIcon itemInfo = (ItemInfoWithIcon) mOriginalIcon.getTag();
    DotInfo dotInfo = mActivityContext.getDotInfoForItem(itemInfo);
    if (mNotificationContainer != null && dotInfo != null) {
        mNotificationContainer.updateHeader(dotInfo.getNotificationCount());
    }
}
Also used : DotInfo(com.android.launcher3.dot.DotInfo) ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon)

Example 32 with ItemInfoWithIcon

use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Launcher3 by ArrowOS.

the class BubbleTextView method applyProgressLevel.

/**
 * Applies the given progress level to the this icon's progress bar.
 */
@Nullable
public PreloadIconDrawable applyProgressLevel() {
    if (!(getTag() instanceof ItemInfoWithIcon)) {
        return null;
    }
    ItemInfoWithIcon info = (ItemInfoWithIcon) getTag();
    int progressLevel = info.getProgressLevel();
    if (progressLevel >= 100) {
        setContentDescription(info.contentDescription != null ? info.contentDescription : "");
    } else if (progressLevel > 0) {
        setDownloadStateContentDescription(info, progressLevel);
    } else {
        setContentDescription(getContext().getString(R.string.app_waiting_download_title, info.title));
    }
    if (mIcon != null) {
        PreloadIconDrawable preloadIconDrawable;
        if (mIcon instanceof PreloadIconDrawable) {
            preloadIconDrawable = (PreloadIconDrawable) mIcon;
            preloadIconDrawable.setLevel(progressLevel);
            preloadIconDrawable.setIsDisabled(!info.isAppStartable());
        } else {
            preloadIconDrawable = makePreloadIcon();
            setIcon(preloadIconDrawable);
        }
        return preloadIconDrawable;
    }
    return null;
}
Also used : ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) PreloadIconDrawable(com.android.launcher3.graphics.PreloadIconDrawable) Nullable(androidx.annotation.Nullable)

Example 33 with ItemInfoWithIcon

use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Launcher3 by ArrowOS.

the class BubbleTextView method applyIconAndLabel.

@UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
    if (mThemeAllAppsIcons) {
        boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER || mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_TASKBAR;
        FastBitmapDrawable iconDrawable = info.newIcon(getContext(), useTheme);
        mDotParams.color = IconPalette.getMutedColor(iconDrawable.getIconColor(), 0.54f);
        setIcon(iconDrawable);
        applyLabel(info);
    } else {
        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);
    }
}
Also used : FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) UiThread(androidx.annotation.UiThread)

Example 34 with ItemInfoWithIcon

use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Launcher3 by ArrowOS.

the class BubbleTextView method verifyHighRes.

/**
 * Verifies that the current icon is high-res otherwise posts a request to load the icon.
 */
public void verifyHighRes() {
    if (mIconLoadRequest != null) {
        mIconLoadRequest.cancel();
        mIconLoadRequest = null;
    }
    if (getTag() instanceof ItemInfoWithIcon) {
        ItemInfoWithIcon info = (ItemInfoWithIcon) getTag();
        if (info.usingLowResIcon()) {
            mIconLoadRequest = LauncherAppState.getInstance(getContext()).getIconCache().updateIconInBackground(BubbleTextView.this, info);
        }
    }
}
Also used : ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon)

Example 35 with ItemInfoWithIcon

use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Launcher3 by ProtonAOSP.

the class PopupContainerWithArrow method updateNotificationHeader.

private void updateNotificationHeader() {
    ItemInfoWithIcon itemInfo = (ItemInfoWithIcon) mOriginalIcon.getTag();
    DotInfo dotInfo = mActivityContext.getDotInfoForItem(itemInfo);
    if (mNotificationContainer != null && dotInfo != null) {
        mNotificationContainer.updateHeader(dotInfo.getNotificationCount());
    }
}
Also used : DotInfo(com.android.launcher3.dot.DotInfo) ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon)

Aggregations

ItemInfoWithIcon (com.android.launcher3.model.data.ItemInfoWithIcon)67 FastBitmapDrawable (com.android.launcher3.icons.FastBitmapDrawable)22 Intent (android.content.Intent)17 Paint (android.graphics.Paint)17 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)16 ComponentName (android.content.ComponentName)13 ShortcutInfo (android.content.pm.ShortcutInfo)13 PreloadIconDrawable (com.android.launcher3.graphics.PreloadIconDrawable)12 Drawable (android.graphics.drawable.Drawable)11 Nullable (androidx.annotation.Nullable)11 UiThread (androidx.annotation.UiThread)10 AppInfo (com.android.launcher3.model.data.AppInfo)10 Bitmap (android.graphics.Bitmap)8 TextPaint (android.text.TextPaint)8 TargetApi (android.annotation.TargetApi)7 Point (android.graphics.Point)7 InsetDrawable (android.graphics.drawable.InsetDrawable)7 DotInfo (com.android.launcher3.dot.DotInfo)7 AppWidgetHostView (android.appwidget.AppWidgetHostView)6 Context (android.content.Context)6