summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2013-11-14 23:30:23 (GMT)
committerDanesh M <daneshm90@gmail.com>2013-11-14 23:30:23 (GMT)
commitd13e36ca1288bd46b5871901dc9f2d1a00b6b282 (patch)
tree10252f264e144dae4831cfaa542b084677b3c66b
parent93ad9c167553299bb90b84a1a973831c46440477 (diff)
downloadandroid_packages_apps_Trebuchet-d13e36ca1288bd46b5871901dc9f2d1a00b6b282.zip
android_packages_apps_Trebuchet-d13e36ca1288bd46b5871901dc9f2d1a00b6b282.tar.gz
android_packages_apps_Trebuchet-d13e36ca1288bd46b5871901dc9f2d1a00b6b282.tar.bz2
Trebuchet : Ensure defaultWorkspace cleanup
The cell placements check are done prior to adding the items, so in the case that adding the items failed, the cell is still marked occupied. This patchset addresses that by unsetting those flags. Change-Id: I4e49a3134e46559199c3e4e1fddfc5c02d946ef7
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherProvider.java38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/com/cyanogenmod/trebuchet/LauncherProvider.java b/src/com/cyanogenmod/trebuchet/LauncherProvider.java
index d7b17d2..b1474c8 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherProvider.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherProvider.java
@@ -654,20 +654,11 @@ public class LauncherProvider extends ContentProvider {
ItemInfo info = new ItemInfo();
info.container = container;
- info.cellX = values.getAsInteger(LauncherSettings.Favorites.CELLX);
- info.cellY = values.getAsInteger(LauncherSettings.Favorites.CELLY);
- info.screen = values.getAsInteger(LauncherSettings.Favorites.SCREEN);
-
- if (values.containsKey(LauncherSettings.Favorites.SPANX)) {
- info.spanX = values.getAsInteger(LauncherSettings.Favorites.SPANX);
- } else {
- info.spanX = 1;
- }
- if (values.containsKey(LauncherSettings.Favorites.SPANY)) {
- info.spanY = values.getAsInteger(LauncherSettings.Favorites.SPANY);
- } else {
- info.spanY = 1;
- }
+ info.spanX = a.getInt(R.styleable.Favorite_spanX, 1);
+ info.spanY = a.getInt(R.styleable.Favorite_spanY, 1);
+ info.cellX = a.getInt(R.styleable.Favorite_x, 0);
+ info.cellY = a.getInt(R.styleable.Favorite_y, 0);
+ info.screen = a.getInt(R.styleable.Favorite_screen, 0);
if (!app.getModel().checkItemPlacement(occupied, info)) {
continue;
@@ -747,7 +738,24 @@ public class LauncherProvider extends ContentProvider {
added = false;
}
}
- if (added) i++;
+ if (added) {
+ i++;
+ } else {
+ int containerIndex = -1;
+ if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ containerIndex = info.screen + Launcher.MAX_WORKSPACE_SCREEN_COUNT;
+ } else if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ containerIndex = info.screen;
+ }
+
+ if (containerIndex != -1) {
+ for (int gridX = info.cellX; gridX < (info.cellX+info.spanX); gridX++) {
+ for (int gridY = info.cellY; gridY < (info.cellY+info.spanY); gridY++) {
+ occupied[containerIndex][gridX][gridY] = null;
+ }
+ }
+ }
+ }
a.recycle();
}
} catch (XmlPullParserException e) {