summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-06-22 01:27:05 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-06-22 01:31:20 +0200
commit421c4c63539523d913de6e0f4980325f27af3072 (patch)
tree151ae95984a584822f9b00a18e9edb7d5d40c227
parent06e5c49c814ecd654e4a81fbff70ec8c0dcd024a (diff)
downloadandroid_packages_apps_Trebuchet-421c4c63539523d913de6e0f4980325f27af3072.zip
android_packages_apps_Trebuchet-421c4c63539523d913de6e0f4980325f27af3072.tar.gz
android_packages_apps_Trebuchet-421c4c63539523d913de6e0f4980325f27af3072.tar.bz2
Trebuchet: Fix Landscape/TransposeLayoutWithOrientation move to default page
Change-Id: I0945923dde54b1c2f744b59645eeb7a6e795c4a1 JIRA: CYAN-1246 Issue: https://jira.cyanogenmod.org/browse/CYAN-1246 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index 5dcbcb1..d5fd0ec 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -30,6 +30,7 @@ import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
public class Hotseat extends PagedView {
private int mCellCount;
+ private int mHotseatPages;
private int mDefaultPage;
private boolean mTransposeLayoutWithOrientation;
@@ -58,10 +59,10 @@ public class Hotseat extends PagedView {
mFadeInAdjacentScreens = false;
mHandleScrollIndicator = true;
- int hotseatPages = PreferencesProvider.Interface.Dock.getNumberPages();
+ mHotseatPages = PreferencesProvider.Interface.Dock.getNumberPages();
int defaultPage = PreferencesProvider.Interface.Dock.getDefaultPage(DEFAULT_PAGE);
- if (defaultPage >= hotseatPages) {
- defaultPage = hotseatPages / 2;
+ if (defaultPage >= mHotseatPages) {
+ defaultPage = mHotseatPages / 2;
}
mCurrentPage = mDefaultPage = defaultPage;
@@ -91,7 +92,7 @@ public class Hotseat extends PagedView {
LayoutInflater inflater =
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- for (int i = 0; i < hotseatPages; i++) {
+ for (int i = 0; i < mHotseatPages; i++) {
CellLayout cl = (CellLayout) inflater.inflate(R.layout.hotseat_page, null);
cl.setChildrenScale(childrenScale);
cl.setGridSize((!hasVerticalHotseat() ? mCellCount : 1), (hasVerticalHotseat() ? mCellCount : 1));
@@ -263,12 +264,13 @@ public class Hotseat extends PagedView {
}
void moveToDefaultScreen(boolean animate) {
+ int page = hasVerticalHotseat() ? (mHotseatPages - mDefaultPage - 1) : mDefaultPage;
if (animate) {
- snapToPage(mDefaultPage);
+ snapToPage(page);
} else {
- setCurrentPage(mDefaultPage);
+ setCurrentPage(page);
}
- getChildAt(mDefaultPage).requestFocus();
+ getChildAt(page).requestFocus();
}
@Override