diff options
author | Winson Chung <winsonc@google.com> | 2011-08-08 10:55:42 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-08-08 14:05:51 -0700 |
commit | f30ad5f1bf33baceeca6b770464fb543b58af985 (patch) | |
tree | 741c861273bee250f6773b8b29d77191ac04b1c3 /src/com/android/launcher2/LauncherModel.java | |
parent | c29c8462b1f56558a4e357975fa7463e66bce47e (diff) | |
download | android_packages_apps_Trebuchet-f30ad5f1bf33baceeca6b770464fb543b58af985.tar.gz android_packages_apps_Trebuchet-f30ad5f1bf33baceeca6b770464fb543b58af985.tar.bz2 android_packages_apps_Trebuchet-f30ad5f1bf33baceeca6b770464fb543b58af985.zip |
Making hotseat a fiver.
Change-Id: I18737692a115f8fd77c6feb3062f4bfeca3506ae
Diffstat (limited to 'src/com/android/launcher2/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 157348312..206de1480 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -816,26 +816,37 @@ public class LauncherModel extends BroadcastReceiver { // check & update map of what's occupied; used to discard overlapping/invalid items private boolean checkItemPlacement(ItemInfo occupied[][][], ItemInfo item) { - if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) { + int containerIndex = item.screen; + if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { + // We use the last index to refer to the hotseat + containerIndex = Launcher.SCREEN_COUNT; + // Return early if we detect that an item is under the hotseat button + if (Hotseat.isAllAppsButtonRank(item.screen)) { + return false; + } + } else if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) { + // Skip further checking if it is not the hotseat or workspace container return true; } + for (int x = item.cellX; x < (item.cellX+item.spanX); x++) { for (int y = item.cellY; y < (item.cellY+item.spanY); y++) { - if (occupied[item.screen][x][y] != null) { + if (occupied[containerIndex][x][y] != null) { Log.e(TAG, "Error loading shortcut " + item - + " into cell (" + item.screen + ":" + + " into cell (" + containerIndex + "-" + item.screen + ":" + x + "," + y + ") occupied by " - + occupied[item.screen][x][y]); + + occupied[containerIndex][x][y]); return false; } } } for (int x = item.cellX; x < (item.cellX+item.spanX); x++) { for (int y = item.cellY; y < (item.cellY+item.spanY); y++) { - occupied[item.screen][x][y] = item; + occupied[containerIndex][x][y] = item; } } + return true; } @@ -858,8 +869,9 @@ public class LauncherModel extends BroadcastReceiver { final Cursor c = contentResolver.query( LauncherSettings.Favorites.CONTENT_URI, null, null, null, null); + // +1 for the hotseat (it can be larger than the workspace) final ItemInfo occupied[][][] = - new ItemInfo[Launcher.SCREEN_COUNT][mCellCountX][mCellCountY]; + new ItemInfo[Launcher.SCREEN_COUNT + 1][mCellCountX + 1][mCellCountY + 1]; try { final int idIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites._ID); |