summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/trebuchet/Folder.java
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-04-13 21:57:41 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-04-17 01:47:56 +0200
commit25350504863f87d88d3e86c58714275c963b8469 (patch)
tree89d5148cad8926b619670844bd6e919e6c761fad /src/com/cyanogenmod/trebuchet/Folder.java
parentda04260b2994b38ebe58d794dae300470c14621f (diff)
downloadpackages_apps_trebuchet-25350504863f87d88d3e86c58714275c963b8469.zip
packages_apps_trebuchet-25350504863f87d88d3e86c58714275c963b8469.tar.gz
packages_apps_trebuchet-25350504863f87d88d3e86c58714275c963b8469.tar.bz2
Trebuchet: Hotseat fixes
This change fixes some of the bugs of HotSeat on landscape mode: * Fixed distance algorithm for XY spatial (not only for X axis) * Fixed cellX and cellY database handling when items are added in landscape mode * Fixed cellX and cellY transtions when add new items * Restore the current hotseat page on rotation Patchset 2: Fixed create new folder in vertical hotseat Patchset 3: Fixed broken mTransposeLayoutWithOrientation != true (large screen devices) Fixed delete existing folder in vertical hotseat Patchset 4: Fixed destroy animation when a folder is destroyed in vertical hotseat Rebased Change-Id: I8b0faa5b6fde42d80e0d98226fca07eead04223c JIRA: CYAN-315 Issue: https://jira.cyanogenmod.org/browse/CYAN-315 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Folder.java')
-rw-r--r--src/com/cyanogenmod/trebuchet/Folder.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Folder.java b/src/com/cyanogenmod/trebuchet/Folder.java
index 181341b..cdb4dd3 100644
--- a/src/com/cyanogenmod/trebuchet/Folder.java
+++ b/src/com/cyanogenmod/trebuchet/Folder.java
@@ -953,16 +953,28 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Runnable onCompleteRunnable = new Runnable() {
@Override
public void run() {
- CellLayout cellLayout = mLauncher.getCellLayout(mInfo.container, mInfo.screen);
+ final int screen = mInfo.screen;
+ if (mInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ mInfo.screen = mLauncher.getHotseat().getScreenFromOrder(mInfo.screen);
+ }
+
+ final CellLayout cellLayout = mLauncher.getCellLayout(mInfo.container, mInfo.screen);
- View child = null;
+ View child = null;
// Move the item from the folder to the workspace, in the position of the folder
if (getItemCount() == 1) {
ShortcutInfo finalItem = mInfo.contents.get(0);
child = mLauncher.createShortcut(R.layout.application, cellLayout,
finalItem);
+ int x = mInfo.cellX, y = mInfo.cellY;
+ if (mInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
+ mLauncher.getHotseat().hasVerticalHotseat()) {
+ // Note: We need the correct position in order to save to db
+ y = mLauncher.getHotseat().getCellYFromOrder(x);
+ x = mLauncher.getHotseat().getCellXFromOrder(x);
+ }
LauncherModel.addOrMoveItemInDatabase(mLauncher, finalItem, mInfo.container,
- mInfo.screen, mInfo.cellX, mInfo.cellY);
+ screen, x, y);
}
if (getItemCount() <= 1) {
// Remove the folder
@@ -976,7 +988,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
// We add the child after removing the folder to prevent both from existing at
// the same time in the CellLayout.
if (child != null) {
- mLauncher.getWorkspace().addInScreen(child, mInfo.container, mInfo.screen,
+ mLauncher.getWorkspace().addInScreen(child, mInfo.container, screen,
mInfo.cellX, mInfo.cellY, mInfo.spanX, mInfo.spanY);
}
}