summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/trebuchet/Hotseat.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Hotseat.java')
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index f2e6d96..9795c71 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;