summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/trebuchet/Hotseat.java
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-02-26 21:53:56 +0000
committernebkat <nebkat@teamhacksung.org>2012-12-24 10:09:02 +0000
commitc6f8c8c92e73efb0aa675a89ca4eded9ebd77615 (patch)
tree0c43ecb0d6d61a200404de1d541b03b81e607d0d /src/com/cyanogenmod/trebuchet/Hotseat.java
parent8ef4f37b141f5e48bb5a63fc401d6ea9fbd9a8b1 (diff)
downloadpackages_apps_trebuchet-c6f8c8c92e73efb0aa675a89ca4eded9ebd77615.zip
packages_apps_trebuchet-c6f8c8c92e73efb0aa675a89ca4eded9ebd77615.tar.gz
packages_apps_trebuchet-c6f8c8c92e73efb0aa675a89ca4eded9ebd77615.tar.bz2
Hotseat: Multiple Pages
Conflicts: res/layout-land/hotseat.xml res/layout-port/hotseat.xml res/values/strings.xml res/xml/default_workspace.xml res/xml/preferences.xml src/com/beansoft/launcher/preference/PreferencesProvider.java src/com/cyanogenmod/trebuchet/Hotseat.java src/com/cyanogenmod/trebuchet/PagedView.java src/com/cyanogenmod/trebuchet/Workspace.java Change-Id: I958b105451160841d5d7d345164dcb2dec4f9404
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Hotseat.java')
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java63
1 files changed, 52 insertions, 11 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index cc287bd..23435d3 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -24,11 +24,10 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
-import android.widget.FrameLayout;
-import com.cyanogenmod.trebuchet.R;
+import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
-public class Hotseat extends FrameLayout {
+public class Hotseat extends PagedView {
private Launcher mLauncher;
private CellLayout mContent;
@@ -53,6 +52,17 @@ public class Hotseat extends FrameLayout {
public Hotseat(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ mFadeInAdjacentScreens = false;
+ mHandleScrollIndicator = true;
+
+ int hotseatPages = PreferencesProvider.Interface.Dock.getNumberPages();
+
+ LayoutInflater inflater =
+ (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ for (int i = 0; i < hotseatPages; i++) {
+ inflater.inflate(R.layout.hotseat_page, this);
+ }
+
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Hotseat, defStyle, 0);
Resources r = context.getResources();
@@ -63,6 +73,9 @@ public class Hotseat extends FrameLayout {
r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
mIsLandscape = context.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE;
+
+ // No data needed
+ setDataIsReady();
}
public void setup(Launcher launcher) {
@@ -71,7 +84,16 @@ public class Hotseat extends FrameLayout {
}
CellLayout getLayout() {
- return mContent;
+ return (CellLayout) getPageAt(mCurrentPage);
+ }
+
+ public boolean hasPage(View view) {
+ for (int i = 0; i < getChildCount(); i++) {
+ if (view == getChildAt(i)) {
+ return true;
+ }
+ }
+ return false;
}
private boolean hasVerticalHotseat() {
@@ -80,14 +102,14 @@ public class Hotseat extends FrameLayout {
/* Get the orientation invariant order of the item in the hotseat for persistence. */
int getOrderInHotseat(int x, int y) {
- return hasVerticalHotseat() ? (mContent.getCountY() - y - 1) : x;
+ return hasVerticalHotseat() ? (mCellCountY - y - 1) : x;
}
/* Get the orientation specific coordinates given an invariant order in the hotseat. */
int getCellXFromOrder(int rank) {
return hasVerticalHotseat() ? 0 : rank;
}
int getCellYFromOrder(int rank) {
- return hasVerticalHotseat() ? (mContent.getCountY() - (rank + 1)) : 0;
+ return hasVerticalHotseat() ? (mCellCountY - (rank + 1)) : 0;
}
@Override
@@ -95,14 +117,33 @@ public class Hotseat extends FrameLayout {
super.onFinishInflate();
if (mCellCountX < 0) mCellCountX = DEFAULT_CELL_COUNT_X;
if (mCellCountY < 0) mCellCountY = DEFAULT_CELL_COUNT_Y;
- mContent = (CellLayout) findViewById(R.id.layout);
- mContent.setGridSize(mCellCountX, mCellCountY);
- mContent.setIsHotseat(true);
-
+ for (int i = 0; i < getChildCount(); i++) {
+ CellLayout cl = (CellLayout) getPageAt(i);
+ cl.setGridSize(mCellCountX, mCellCountY);
+ cl.setIsHotseat(true);
+ }
resetLayout();
}
void resetLayout() {
- mContent.removeAllViewsInLayout();
+ for (int i = 0; i < getChildCount(); i++) {
+ CellLayout cl = (CellLayout) getPageAt(i);
+ cl.removeAllViewsInLayout();
+ }
+ }
+
+ @Override
+ public void syncPages() {
+ }
+
+ @Override
+ public void syncPageItems(int page, boolean immediate) {
+ }
+
+ @Override
+ protected void loadAssociatedPages(int page) {
+ }
+ @Override
+ protected void loadAssociatedPages(int page, boolean immediateAndOnly) {
}
}