mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 19:38:21 +00:00
Adding support for storing container based item list in the model
These items get updated automatically during various model tasks. Also simplifying the pinned shortcut state, by calculating the list of ppined shortcut on demand, instead of storing a refCount. Bug: 160748731 Change-Id: I3169d293552b05b4f4d6c529397fbc761887a282
This commit is contained in:
@@ -46,12 +46,10 @@ import android.os.UserManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
import android.util.MutableInt;
|
||||
import android.util.TimingLogger;
|
||||
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.android.launcher3.InstallShortcutReceiver;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherModel;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
@@ -94,7 +92,6 @@ import com.android.launcher3.widget.WidgetManagerHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CancellationException;
|
||||
@@ -794,17 +791,8 @@ public class LoaderTask implements Runnable {
|
||||
LauncherSettings.Settings.METHOD_REMOVE_GHOST_WIDGETS);
|
||||
}
|
||||
|
||||
// Unpin shortcuts that don't exist on the workspace.
|
||||
HashSet<ShortcutKey> pendingShortcuts =
|
||||
InstallShortcutReceiver.getPendingShortcuts(context);
|
||||
for (ShortcutKey key : shortcutKeyToPinnedShortcuts.keySet()) {
|
||||
MutableInt numTimesPinned = mBgDataModel.pinnedShortcutCounts.get(key);
|
||||
if ((numTimesPinned == null || numTimesPinned.value == 0)
|
||||
&& !pendingShortcuts.contains(key)) {
|
||||
// Shortcut is pinned but doesn't exist on the workspace; unpin it.
|
||||
mBgDataModel.unpinShortcut(context, key);
|
||||
}
|
||||
}
|
||||
// Update pinned state of model shortcuts
|
||||
mBgDataModel.updateShortcutPinnedState(context);
|
||||
|
||||
// Sort the folder items, update ranks, and make sure all preview items are high res.
|
||||
FolderGridOrganizer verifier =
|
||||
|
||||
Reference in New Issue
Block a user