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

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16059407

Change-Id: I9018f824a80a7b774fa8d57c2090a0a9dee56b0a
This commit is contained in:
Samuel Fufa
2021-10-15 09:26:55 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 7 deletions
+10 -4
View File
@@ -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
@@ -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){};
}