diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 9da2b798b8..521d8f4562 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -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 diff --git a/src/com/android/launcher3/views/BubbleTextHolder.java b/src/com/android/launcher3/views/BubbleTextHolder.java index 78aac06b72..42701c6c3d 100644 --- a/src/com/android/launcher3/views/BubbleTextHolder.java +++ b/src/com/android/launcher3/views/BubbleTextHolder.java @@ -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){}; }