mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Fix issue of slice icon being rendered on non-UIthread
Bug: 178989579 Test: Manual Change-Id: I23aa5055c8f07ee9877c1f3ce51cb280ac38a2b7
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.search;
|
||||
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.app.search.SearchTarget;
|
||||
@@ -104,7 +105,7 @@ public class SearchResultIconSlice extends LinearLayout implements SearchTargetH
|
||||
PackageItemInfo pkgItem = new PackageItemInfo(parentTarget.getPackageName());
|
||||
pkgItem.user = parentTarget.getUserHandle();
|
||||
appState.getIconCache().getTitleAndIconForApp(pkgItem, false);
|
||||
mIcon.applyFromItemInfoWithIcon(pkgItem);
|
||||
MAIN_EXECUTOR.post(() -> mIcon.applyFromItemInfoWithIcon(pkgItem));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.view.ViewDebug;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.launcher3.Launcher.OnResumeCallback;
|
||||
@@ -271,6 +272,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
mDotScaleAnim.start();
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void applyFromWorkspaceItem(WorkspaceItemInfo info) {
|
||||
applyFromWorkspaceItem(info, false);
|
||||
}
|
||||
@@ -287,6 +289,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) {
|
||||
applyIconAndLabel(info);
|
||||
setTag(info);
|
||||
@@ -295,6 +298,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
setDownloadStateContentDescription(info, info.getProgressLevel());
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void applyFromApplicationInfo(AppInfo info) {
|
||||
applyIconAndLabel(info);
|
||||
|
||||
@@ -314,6 +318,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
/**
|
||||
* Apply label and tag using a generic {@link ItemInfoWithIcon}
|
||||
*/
|
||||
@UiThread
|
||||
public void applyFromItemInfoWithIcon(ItemInfoWithIcon info) {
|
||||
applyIconAndLabel(info);
|
||||
// We don't need to check the info since it's not a WorkspaceItemInfo
|
||||
@@ -328,11 +333,13 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
/**
|
||||
* Apply label and tag using a {@link SearchActionItemInfo}
|
||||
*/
|
||||
@UiThread
|
||||
public void applyFromSearchActionItemInfo(SearchActionItemInfo searchActionItemInfo) {
|
||||
applyIconAndLabel(searchActionItemInfo);
|
||||
setTag(searchActionItemInfo);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
protected void applyIconAndLabel(ItemInfoWithIcon info) {
|
||||
FastBitmapDrawable iconDrawable = newIcon(getContext(), info);
|
||||
mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f);
|
||||
@@ -341,6 +348,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
applyLabel(info);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void applyLabel(ItemInfoWithIcon info) {
|
||||
setText(info.title);
|
||||
if (info.contentDescription != null) {
|
||||
|
||||
Reference in New Issue
Block a user