mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Deleting workspace items from db which have an invalid placement
Change-Id: I1d616e8cd533acd6ecd334d85e6468163f31f6a4
This commit is contained in:
@@ -1758,8 +1758,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
|
||||
// check & update map of what's occupied; used to discard overlapping/invalid items
|
||||
private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item,
|
||||
AtomicBoolean deleteOnInvalidPlacement) {
|
||||
private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item) {
|
||||
LauncherAppState app = LauncherAppState.getInstance();
|
||||
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||
final int countX = (int) grid.numColumns;
|
||||
@@ -1770,7 +1769,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
// Return early if we detect that an item is under the hotseat button
|
||||
if (mCallbacks == null ||
|
||||
mCallbacks.get().isAllAppsButtonRank((int) item.screenId)) {
|
||||
deleteOnInvalidPlacement.set(true);
|
||||
Log.e(TAG, "Error loading shortcut into hotseat " + item
|
||||
+ " into position (" + item.screenId + ":" + item.cellX + ","
|
||||
+ item.cellY + ") occupied by all apps");
|
||||
@@ -1967,7 +1965,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
UserHandleCompat user;
|
||||
|
||||
while (!mStopped && c.moveToNext()) {
|
||||
AtomicBoolean deleteOnInvalidPlacement = new AtomicBoolean(false);
|
||||
try {
|
||||
int itemType = c.getInt(itemTypeIndex);
|
||||
boolean restored = 0 != c.getInt(restoredIndex);
|
||||
@@ -2145,11 +2142,8 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
|
||||
// check & update map of what's occupied
|
||||
deleteOnInvalidPlacement.set(false);
|
||||
if (!checkItemPlacement(occupied, info, deleteOnInvalidPlacement)) {
|
||||
if (deleteOnInvalidPlacement.get()) {
|
||||
itemsToRemove.add(id);
|
||||
}
|
||||
if (!checkItemPlacement(occupied, info)) {
|
||||
itemsToRemove.add(id);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2190,12 +2184,8 @@ public class LauncherModel extends BroadcastReceiver
|
||||
folderInfo.spanY = 1;
|
||||
|
||||
// check & update map of what's occupied
|
||||
deleteOnInvalidPlacement.set(false);
|
||||
if (!checkItemPlacement(occupied, folderInfo,
|
||||
deleteOnInvalidPlacement)) {
|
||||
if (deleteOnInvalidPlacement.get()) {
|
||||
itemsToRemove.add(id);
|
||||
}
|
||||
if (!checkItemPlacement(occupied, folderInfo)) {
|
||||
itemsToRemove.add(id);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2303,12 +2293,8 @@ public class LauncherModel extends BroadcastReceiver
|
||||
|
||||
appWidgetInfo.container = c.getInt(containerIndex);
|
||||
// check & update map of what's occupied
|
||||
deleteOnInvalidPlacement.set(false);
|
||||
if (!checkItemPlacement(occupied, appWidgetInfo,
|
||||
deleteOnInvalidPlacement)) {
|
||||
if (deleteOnInvalidPlacement.get()) {
|
||||
itemsToRemove.add(id);
|
||||
}
|
||||
if (!checkItemPlacement(occupied, appWidgetInfo)) {
|
||||
itemsToRemove.add(id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user