diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-04-13 21:57:41 +0200 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-04-17 01:47:56 +0200 |
commit | 25350504863f87d88d3e86c58714275c963b8469 (patch) | |
tree | 89d5148cad8926b619670844bd6e919e6c761fad /src/com/cyanogenmod/trebuchet/Hotseat.java | |
parent | da04260b2994b38ebe58d794dae300470c14621f (diff) | |
download | packages_apps_trebuchet-25350504863f87d88d3e86c58714275c963b8469.tar.gz packages_apps_trebuchet-25350504863f87d88d3e86c58714275c963b8469.tar.bz2 packages_apps_trebuchet-25350504863f87d88d3e86c58714275c963b8469.zip |
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/Hotseat.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Hotseat.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java index f2e6d960..9795c71a 100644 --- a/src/com/cyanogenmod/trebuchet/Hotseat.java +++ b/src/com/cyanogenmod/trebuchet/Hotseat.java @@ -103,7 +103,7 @@ public class Hotseat extends PagedView { return false; } - private boolean hasVerticalHotseat() { + boolean hasVerticalHotseat() { return (mIsLandscape && mTransposeLayoutWithOrientation); } @@ -118,9 +118,24 @@ public class Hotseat extends PagedView { int getCellYFromOrder(int rank) { return hasVerticalHotseat() ? (mCellCount - rank - 1) : 0; } + int getInverterCellXFromOrder(int rank) { + return hasVerticalHotseat() ? (mCellCount - rank - 1) : 0; + } + int getInverterCellYFromOrder(int rank) { + return hasVerticalHotseat() ? 0 : rank; + } int getScreenFromOrder(int screen) { return hasVerticalHotseat() ? (getChildCount() - screen - 1) : screen; } + int[] getDatabaseCellsFromLayout(int[] lpCells) { + if (!hasVerticalHotseat()) { + return lpCells; + } + // On landscape with vertical hotseat, the items are stored in y axis and from up to down, + // so we need to convert to x axis and left to right prior to save to database. In screen + // the item has the right coordinates + return new int[]{mCellCount - lpCells[1] - 1, lpCells[0]}; + } /* * @@ -200,7 +215,8 @@ public class Hotseat extends PagedView { // Calculate the distance between the center of the CellLayout // and the touch point - float dist = Workspace.squaredDistance(touchXy, cellLayoutCenter); + float dist = Workspace.squaredDistance( + touchXy, cellLayoutCenter, hasVerticalHotseat()); if (dist < smallestDistSoFar) { smallestDistSoFar = dist; |