mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Fix bug where folder items preview remain in low res state.
- We update the ranks of all folder items after loading, to ensure there are no gaps caused by removed folder items. This also ensures that we load the high resolution icons for all preview items. - FolderIconPreviewVerifier#setFolderInfo was not always called - Init mGridSize with [1, 1] to prevent divide by zero error in case setFolderInfo is not called Bug: 126268196 Change-Id: I856489968665a39303e2922c78cf90f2b3ee6ebb
This commit is contained in:
@@ -340,8 +340,6 @@ public class LoaderTask implements Runnable {
|
||||
Intent intent;
|
||||
String targetPkg;
|
||||
|
||||
FolderIconPreviewVerifier verifier =
|
||||
new FolderIconPreviewVerifier(mApp.getInvariantDeviceProfile());
|
||||
while (!mStopped && c.moveToNext()) {
|
||||
try {
|
||||
if (c.user == null) {
|
||||
@@ -461,8 +459,7 @@ public class LoaderTask implements Runnable {
|
||||
c.markRestored();
|
||||
}
|
||||
|
||||
boolean useLowResIcon = !c.isOnWorkspaceOrHotseat() &&
|
||||
!verifier.isItemInPreview(c.getInt(rankIndex));
|
||||
boolean useLowResIcon = !c.isOnWorkspaceOrHotseat();
|
||||
|
||||
if (c.restoreFlag != 0) {
|
||||
// Already verified above that user is same as default user
|
||||
@@ -745,24 +742,25 @@ public class LoaderTask implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the folder items, update ranks, and make sure all preview items are high res.
|
||||
FolderIconPreviewVerifier verifier =
|
||||
new FolderIconPreviewVerifier(mApp.getInvariantDeviceProfile());
|
||||
// Sort the folder items and make sure all items in the preview are high resolution.
|
||||
for (FolderInfo folder : mBgDataModel.folders) {
|
||||
Collections.sort(folder.contents, Folder.ITEM_POS_COMPARATOR);
|
||||
verifier.setFolderInfo(folder);
|
||||
int size = folder.contents.size();
|
||||
|
||||
// Update ranks here to ensure there are no gaps caused by removed folder items.
|
||||
// Ranks are the source of truth for folder items, so cellX and cellY can be ignored
|
||||
// for now. Database will be updated once user manually modifies folder.
|
||||
for (int rank = 0; rank < size; ++rank) {
|
||||
ShortcutInfo info = folder.contents.get(rank);
|
||||
info.rank = rank;
|
||||
|
||||
int numItemsInPreview = 0;
|
||||
for (ShortcutInfo info : folder.contents) {
|
||||
if (info.usingLowResIcon()
|
||||
&& info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
|
||||
&& verifier.isItemInPreview(info.rank)) {
|
||||
mIconCache.getTitleAndIcon(info, false);
|
||||
numItemsInPreview++;
|
||||
}
|
||||
|
||||
if (numItemsInPreview >= MAX_NUM_ITEMS_IN_PREVIEW) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user