mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
Revert "fetch and update shortcut icons in background thread"
This reverts commit 4ec390e490.
Reason for revert: the code change introduces significant delay when saving deep shortcut icons in cache.
Bug: 142514365
Change-Id: If7a69844aba7f32690ff347f2db11f0a8041b9e4
This commit is contained in:
@@ -15,20 +15,10 @@
|
||||
*/
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.WorkspaceItemInfo;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
|
||||
@@ -71,26 +61,6 @@ public class ShortcutUtil {
|
||||
&& info instanceof WorkspaceItemInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the shortcut icon in background, then update the UI.
|
||||
*/
|
||||
public static void fetchAndUpdateShortcutIconAsync(
|
||||
@NonNull Context context, @NonNull WorkspaceItemInfo info, @NonNull ShortcutInfo si,
|
||||
boolean badged) {
|
||||
if (info.iconBitmap == null) {
|
||||
// use low res icon as placeholder while the actual icon is being fetched.
|
||||
info.iconBitmap = BitmapInfo.LOW_RES_ICON;
|
||||
info.iconColor = Themes.getColorAccent(context);
|
||||
}
|
||||
MODEL_EXECUTOR.execute(() -> {
|
||||
LauncherIcons li = LauncherIcons.obtain(context);
|
||||
BitmapInfo bitmapInfo = li.createShortcutIcon(si, badged, true, null);
|
||||
info.applyFrom(bitmapInfo);
|
||||
li.recycle();
|
||||
LauncherAppState.getInstance(context).getModel().updateAndBindWorkspaceItem(info, si);
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean isActive(ItemInfo info) {
|
||||
boolean isLoading = info instanceof WorkspaceItemInfo
|
||||
&& ((WorkspaceItemInfo) info).hasPromiseIconUi();
|
||||
|
||||
Reference in New Issue
Block a user