mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Revert "Update launcher preview icons on themed icon update"
Revert submission 25242534-launcher-preview-update-themed-icon Reason for revert: This change potentially breaks the launcher's database. Reverted changes: /q/submissionid:25242534-launcher-preview-update-themed-icon Change-Id: I90fd55695b24529752a82cb6bf001935204a53f7
This commit is contained in:
committed by
Android (Google) Code Review
parent
d64230f449
commit
dd088daead
@@ -169,9 +169,6 @@ public class GridCustomizationsProvider extends ContentProvider {
|
||||
LauncherPrefs.get(getContext())
|
||||
.put(THEMED_ICONS, values.getAsBoolean(BOOLEAN_VALUE));
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
mActivePreviews.values().forEach(observer ->
|
||||
observer.renderer.refreshIcons()
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -35,12 +35,9 @@ import android.appwidget.AppWidgetHostView;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -79,7 +76,6 @@ import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.celllayout.CellPosMapper;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.icons.IconProvider;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.model.BgDataModel;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
@@ -87,7 +83,6 @@ import com.android.launcher3.model.WidgetItem;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.pm.InstallSessionHelper;
|
||||
@@ -193,8 +188,6 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
||||
private final SparseIntArray mWallpaperColorResources;
|
||||
private final SparseArray<Size> mLauncherWidgetSpanInfo;
|
||||
|
||||
private final Map<BubbleTextView, WorkspaceItemInfo> mIcons = new HashMap<>();
|
||||
|
||||
public LauncherPreviewRenderer(Context context,
|
||||
InvariantDeviceProfile idp,
|
||||
WallpaperColors wallpaperColorsOverride,
|
||||
@@ -373,43 +366,11 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
||||
return CellPosMapper.DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes icon to update based on resource changes.
|
||||
*/
|
||||
public void refreshIcons() {
|
||||
mUiHandler.post(() -> {
|
||||
IconProvider iconProvider = null;
|
||||
int iconDpi = -1;
|
||||
for (Map.Entry<BubbleTextView, WorkspaceItemInfo> entry : mIcons.entrySet()) {
|
||||
BubbleTextView icon = entry.getKey();
|
||||
ItemInfoWithIcon info = entry.getValue();
|
||||
// get monochrome themed icon if it was not initially cached
|
||||
if (info.bitmap.getMono() == null) {
|
||||
if (iconProvider == null || iconDpi == -1) {
|
||||
LauncherAppState appState = LauncherAppState.getInstance(mContext);
|
||||
iconProvider = appState.getIconProvider();
|
||||
iconDpi = appState.getInvariantDeviceProfile().fillResIconDpi;
|
||||
}
|
||||
LauncherActivityInfo activityInfo = mContext.getSystemService(
|
||||
LauncherApps.class)
|
||||
.resolveActivity(info.getIntent(), info.user);
|
||||
Drawable iconDrawable = iconProvider.getIcon(activityInfo, iconDpi);
|
||||
LauncherIcons iconFactory = LauncherIcons.obtain(mContext);
|
||||
info.bitmap = iconFactory.createBadgedIconBitmap(iconDrawable);
|
||||
}
|
||||
// update icon based on whether themed icon is enabled
|
||||
icon.reapplyItemInfo(info);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void inflateAndAddIcon(WorkspaceItemInfo info) {
|
||||
CellLayout screen = mWorkspaceScreens.get(info.screenId);
|
||||
BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
|
||||
R.layout.app_icon, screen, false);
|
||||
icon.applyFromWorkspaceItem(info);
|
||||
mIcons.put(icon, info);
|
||||
addInScreenFromBind(icon, info);
|
||||
}
|
||||
|
||||
@@ -516,8 +477,6 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
||||
currentWorkspaceItems, otherWorkspaceItems);
|
||||
filterCurrentWorkspaceItems(currentScreenIds, dataModel.appWidgets, currentAppWidgets,
|
||||
otherAppWidgets);
|
||||
|
||||
mIcons.clear();
|
||||
for (ItemInfo itemInfo : currentWorkspaceItems) {
|
||||
switch (itemInfo.itemType) {
|
||||
case Favorites.ITEM_TYPE_APPLICATION:
|
||||
|
||||
@@ -201,13 +201,6 @@ public class PreviewSurfaceRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes icon to update based on resource changes.
|
||||
*/
|
||||
public void refreshIcons() {
|
||||
mRenderer.refreshIcons();
|
||||
}
|
||||
|
||||
/***
|
||||
* Generates a new context overriding the theme color and the display size without affecting the
|
||||
* main application context
|
||||
|
||||
Reference in New Issue
Block a user