mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Bye bye workspace screens table
Removing a separate table for workspace screens. List of screens are automatically parsed using the items in the favorites DB. Order of the screen based on the screen id and rearranging screens is no longer supported. In case the screens need to be rearranged, all the items in the favorites db will need to be updated with new screen ids. This makes backing up the DB (in the same database) easier as only one table needs to be duplicates. Change-Id: I8ba947a898f637d780e2f49925e78604263126e8
This commit is contained in:
@@ -72,6 +72,7 @@ import com.android.launcher3.shortcuts.ShortcutInfoCompat;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.LooperIdleLock;
|
||||
import com.android.launcher3.util.MultiHashMap;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
@@ -293,7 +294,6 @@ public class LoaderTask implements Runnable {
|
||||
final HashMap<String, SessionInfo> installingPkgs =
|
||||
mPackageInstaller.updateAndGetActiveSessionCache();
|
||||
mFirstScreenBroadcast = new FirstScreenBroadcast(installingPkgs);
|
||||
mBgDataModel.workspaceScreens.addAll(LauncherModel.loadWorkspaceScreensDb(context));
|
||||
|
||||
Map<ShortcutKey, ShortcutInfoCompat> shortcutKeyToPinnedShortcuts = new HashMap<>();
|
||||
final LoaderCursor c = new LoaderCursor(contentResolver.query(
|
||||
@@ -780,21 +780,15 @@ public class LoaderTask implements Runnable {
|
||||
new Handler(LauncherModel.getWorkerLooper()));
|
||||
}
|
||||
|
||||
// Remove any empty screens
|
||||
IntArray unusedScreens = mBgDataModel.workspaceScreens.clone();
|
||||
// Initialize the screens array. Using an InstSet ensures that the screen ids
|
||||
// are sorted.
|
||||
IntSet screenSet = new IntSet();
|
||||
for (ItemInfo item: mBgDataModel.itemsIdMap) {
|
||||
int screenId = item.screenId;
|
||||
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
|
||||
unusedScreens.contains(screenId)) {
|
||||
unusedScreens.removeValue(screenId);
|
||||
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
|
||||
screenSet.add(item.screenId);
|
||||
}
|
||||
}
|
||||
|
||||
// If there are any empty screens remove them, and update.
|
||||
if (unusedScreens.size() != 0) {
|
||||
mBgDataModel.workspaceScreens.removeAllValues(unusedScreens);
|
||||
LauncherModel.updateWorkspaceScreenOrder(context, mBgDataModel.workspaceScreens);
|
||||
}
|
||||
mBgDataModel.workspaceScreens.addAll(screenSet.getArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user