mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
[Search] Fix ItemInfo assignment conflict
When a BubbleTextHolder has more than one bubble text view, BubbleTextView#getParent().onItemInfoChanged is problematic as the ItemInfo associated with the last BubbleTextView will be the final ItemInfo set on parent. This is fixed by setting ItemInfo change receiver more explicitly. Bug: 203020679 Test: Manual Change-Id: Ia8aeead1a6151c2aa47148ba4846ae3d3ee39b73
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user