diff options
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Workspace.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index cfe791280..363e47427 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -2394,8 +2394,17 @@ public class Workspace extends SmoothPagedView } } - LauncherModel.moveItemInDatabase(mLauncher, info, container, screen, lp.cellX, - lp.cellY); + // No_id check required as the AllApps button doesn't have an item info id + if (info.id != ItemInfo.NO_ID) { + LauncherModel.moveItemInDatabase(mLauncher, info, container, screen, lp.cellX, + lp.cellY); + } else if (info instanceof AllAppsButtonInfo) { + if (!LauncherApplication.isScreenLandscape(getContext())) { + PreferencesProvider.Interface.Dock.setDefaultHotseatIcon(getContext(), lp.cellX); + } else { + PreferencesProvider.Interface.Dock.setDefaultHotseatIcon(getContext(), lp.cellY); + } + } } else { // If we can't find a drop location, we return the item to its original position CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams(); @@ -2845,6 +2854,10 @@ public class Workspace extends SmoothPagedView return d.dragSource != this && isDragWidget(d); } + private boolean isDragAllAppsButton(DragObject d) { + return (d.dragInfo instanceof AllAppsButtonInfo); + } + public void onDragOver(DragObject d) { // Skip drag over events while we are dragging over side pages if (mInScrollArea || mIsSwitchingState || mState == State.SMALL) return; @@ -2888,7 +2901,7 @@ public class Workspace extends SmoothPagedView // Test to see if we are over the hotseat otherwise just use the current page if (mLauncher.getHotseat() != null && !isDragWidget(d)) { mLauncher.getHotseat().getHitRect(r); - if (r.contains(d.x, d.y)) { + if (r.contains(d.x, d.y) || isDragAllAppsButton(d)) { layout = mLauncher.getHotseat().getLayout(); } } @@ -3494,8 +3507,8 @@ public class Workspace extends SmoothPagedView for (int i = 0; i < count; i++) { View v = cl.getShortcutsAndWidgets().getChildAt(i); ItemInfo info = (ItemInfo) v.getTag(); - // Null check required as the AllApps button doesn't have an item info - if (info != null) { + // No_id check required as the AllApps button doesn't have an item info id + if (info.id != ItemInfo.NO_ID) { LauncherModel.modifyItemInDatabase(mLauncher, info, container, screen, info.cellX, info.cellY, info.spanX, info.spanY); } |