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

Commit f53278c9 authored by Samuel Fufa's avatar Samuel Fufa Committed by Android (Google) Code Review
Browse files

Merge "[Search] Fix ItemInfo assignment conflict" into sc-v2-dev

parents cd9f5704 0fe464dd
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ import com.android.launcher3.model.data.SearchActionItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.SafeCloseable;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BubbleTextHolder;
import com.android.launcher3.views.IconLabelDotView;

import java.text.NumberFormat;
@@ -163,6 +162,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
    private HandlerRunnable mIconLoadRequest;

    private boolean mEnableIconUpdateAnimation = false;
    private ItemInfoUpdateReceiver mItemInfoUpdateReceiver;

    public BubbleTextView(Context context) {
        this(context, null, 0);
@@ -240,6 +240,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
        mDotParams.scale = 0f;
        mForceHideDot = false;
        setBackground(null);
        mItemInfoUpdateReceiver = null;
    }

    private void cancelDotScaleAnim() {
@@ -337,13 +338,18 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
        setDownloadStateContentDescription(info, info.getProgressLevel());
    }

    private void setItemInfo(ItemInfo itemInfo) {
    private void setItemInfo(ItemInfoWithIcon itemInfo) {
        setTag(itemInfo);
        if (getParent() instanceof BubbleTextHolder) {
            ((BubbleTextHolder) getParent()).onItemInfoChanged(itemInfo);
        if (mItemInfoUpdateReceiver != null) {
            mItemInfoUpdateReceiver.reapplyItemInfo(itemInfo);
        }
    }

    public void setItemInfoUpdateReceiver(
            ItemInfoUpdateReceiver itemInfoUpdateReceiver) {
        mItemInfoUpdateReceiver = itemInfoUpdateReceiver;
    }

    @UiThread
    protected void applyIconAndLabel(ItemInfoWithIcon info) {
        boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER
+5 −3
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@
package com.android.launcher3.views;

import com.android.launcher3.BubbleTextView;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;

/**
 * Views that contain {@link BubbleTextView} should implement this interface.
 */
public interface BubbleTextHolder {
public interface BubbleTextHolder extends IconCache.ItemInfoUpdateReceiver {
    BubbleTextView getBubbleText();

    /**
@@ -29,6 +31,6 @@ public interface BubbleTextHolder {
     *
     * @param itemInfo the new itemInfo
     */
    default void onItemInfoChanged(ItemInfo itemInfo) {
    }
    @Override
    default void reapplyItemInfo(ItemInfoWithIcon itemInfo){};
}