summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-09-02 16:22:11 -0700
committerWinson Chung <winsonc@google.com>2011-09-02 16:22:51 -0700
commit6ba2a1b6e7595a14ba33e98f728b39d0ecb3ae36 (patch)
tree9e5f0de7bd551077a5f9f5fc845f919213a770b8 /src
parent4512637a8a38610282caafe1335a67073dda8224 (diff)
downloadandroid_packages_apps_Trebuchet-6ba2a1b6e7595a14ba33e98f728b39d0ecb3ae36.tar.gz
android_packages_apps_Trebuchet-6ba2a1b6e7595a14ba33e98f728b39d0ecb3ae36.tar.bz2
android_packages_apps_Trebuchet-6ba2a1b6e7595a14ba33e98f728b39d0ecb3ae36.zip
Fixing incorrect test of occupied state for items in the hotseat. (5208427)
Change-Id: Iee78e6be21389314210ef3c60c557a78b43f8021
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/LauncherModel.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 239970e84..eee1a2674 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -867,17 +867,28 @@ public class LauncherModel extends BroadcastReceiver {
private boolean checkItemPlacement(ItemInfo occupied[][][], ItemInfo item) {
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;
}
+
+ // We use the last index to refer to the hotseat and the screen as the rank, so
+ // test and update the occupied state accordingly
+ if (occupied[Launcher.SCREEN_COUNT][item.screen][0] != null) {
+ Log.e(TAG, "Error loading shortcut into hotseat " + item
+ + " into position (" + item.screen + ":" + item.cellX + "," + item.cellY
+ + ") occupied by " + occupied[Launcher.SCREEN_COUNT][item.screen][0]);
+ return false;
+ } else {
+ occupied[Launcher.SCREEN_COUNT][item.screen][0] = item;
+ return true;
+ }
} else if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
// Skip further checking if it is not the hotseat or workspace container
return true;
}
+ // Check if any workspace icons overlap with each other
for (int x = item.cellX; x < (item.cellX+item.spanX); x++) {
for (int y = item.cellY; y < (item.cellY+item.spanY); y++) {
if (occupied[containerIndex][x][y] != null) {