Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d39148af authored by Mario Bertschler's avatar Mario Bertschler
Browse files

Adding FLAG_ICON_BADGED and check flag in DragView.getBadge.

Bug: 77634973
Change-Id: I0e398bea7aa86246616e37bbd76f0936facb83ba
parent 9bf5113e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -90,6 +90,11 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
     */
    public static final int FLAG_ADAPTIVE_ICON = 1 << 8;

    /**
     * Flag indicating that the icon is badged.
     */
    public static final int FLAG_ICON_BADGED = 1 << 9;

    /**
     * Status associated with the system state of the underlying item. This is calculated every
     * time a new info is created and not persisted on the disk.
+7 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.view.View;

import com.android.launcher3.FastBitmapDrawable;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherAppState;
@@ -69,6 +70,8 @@ import com.android.launcher3.widget.PendingAddShortcutInfo;
import java.util.Arrays;
import java.util.List;

import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;

public class DragView extends View {
    private static final ColorMatrix sTempMatrix1 = new ColorMatrix();
    private static final ColorMatrix sTempMatrix2 = new ColorMatrix();
@@ -364,7 +367,10 @@ public class DragView extends View {
    private Drawable getBadge(ItemInfo info, LauncherAppState appState, Object obj) {
        int iconSize = appState.getInvariantDeviceProfile().iconBitmapSize;
        if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
            if (info.id == ItemInfo.NO_ID || !(obj instanceof ShortcutInfoCompat)) {
            boolean iconBadged = (info instanceof ItemInfoWithIcon)
                    && (((ItemInfoWithIcon) info).runtimeStatusFlags & FLAG_ICON_BADGED) > 0;
            if ((info.id == ItemInfo.NO_ID && !iconBadged)
                    || !(obj instanceof ShortcutInfoCompat)) {
                // The item is not yet added on home screen.
                return new FixedSizeEmptyDrawable(iconSize);
            }