mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +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:
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.util.LongSparseArray;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.android.launcher3.AllAppsList;
|
||||
import com.android.launcher3.AppInfo;
|
||||
import com.android.launcher3.FolderInfo;
|
||||
@@ -27,7 +27,6 @@ import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.LauncherModel;
|
||||
import com.android.launcher3.LauncherModel.CallbackTask;
|
||||
import com.android.launcher3.LauncherModel.Callbacks;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
@@ -58,16 +57,12 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
||||
if (mItemList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Context context = app.getContext();
|
||||
|
||||
final ArrayList<ItemInfo> addedItemsFinal = new ArrayList<>();
|
||||
final IntArray addedWorkspaceScreensFinal = new IntArray();
|
||||
|
||||
// Get the list of workspace screens. We need to append to this list and
|
||||
// can not use sBgWorkspaceScreens because loadWorkspace() may not have been
|
||||
// called.
|
||||
IntArray workspaceScreens = LauncherModel.loadWorkspaceScreensDb(context);
|
||||
synchronized(dataModel) {
|
||||
IntArray workspaceScreens = dataModel.workspaceScreens.clone();
|
||||
|
||||
List<ItemInfo> filteredItems = new ArrayList<>();
|
||||
for (Pair<ItemInfo, Object> entry : mItemList) {
|
||||
@@ -116,9 +111,6 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
||||
}
|
||||
}
|
||||
|
||||
// Update the workspace screens
|
||||
updateScreens(context, workspaceScreens);
|
||||
|
||||
if (!addedItemsFinal.isEmpty()) {
|
||||
scheduleCallbackTask(new CallbackTask() {
|
||||
@Override
|
||||
@@ -143,10 +135,6 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateScreens(Context context, IntArray workspaceScreens) {
|
||||
LauncherModel.updateWorkspaceScreenOrder(context, workspaceScreens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the shortcuts already exists on the workspace. This must be called after
|
||||
* the workspace has been loaded. We identify a shortcut by its intent.
|
||||
|
||||
Reference in New Issue
Block a user