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.java37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index 7463d65c2..ce2e0fa1b 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -26,6 +26,8 @@ import android.view.View;
import android.widget.FrameLayout;
import com.cyanogenmod.trebuchet.R;
+import com.cyanogenmod.trebuchet.preference.Preferences;
+import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
public class Hotseat extends FrameLayout {
@SuppressWarnings("unused")
@@ -55,11 +57,26 @@ public class Hotseat extends FrameLayout {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Hotseat, defStyle, 0);
- mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
- mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
- mAllAppsButtonRank = context.getResources().getInteger(R.integer.hotseat_all_apps_index);
+
+ int numberHotseatIcons = PreferencesProvider.Interface.Dock.getNumberHotseatIcons(context);
+ int defaultHotseatIcon = PreferencesProvider.Interface.Dock.getDefaultHotseatIcon(context,
+ context.getResources().getInteger(R.integer.hotseat_all_apps_index));
+ if (defaultHotseatIcon >= numberHotseatIcons) {
+ defaultHotseatIcon = numberHotseatIcons - 1;
+ PreferencesProvider.Interface.Dock.setDefaultHotseatIcon(context, defaultHotseatIcon);
+ }
+
mIsLandscape = context.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE;
+
+ if (mIsLandscape) {
+ mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
+ mCellCountY = numberHotseatIcons;
+ } else {
+ mCellCountX = numberHotseatIcons;
+ mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
+ }
+ mAllAppsButtonRank = defaultHotseatIcon;
}
public void setup(Launcher launcher) {
@@ -129,10 +146,24 @@ public class Hotseat extends FrameLayout {
}
});
+ allAppsButton.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ if (mLauncher != null) {
+ return mLauncher.onLongClick(v);
+ }
+ return false;
+ }
+ });
+
// Note: We do this to ensure that the hotseat is always laid out in the orientation of
// the hotseat in order regardless of which orientation they were added
int x = getCellXFromOrder(mAllAppsButtonRank);
int y = getCellYFromOrder(mAllAppsButtonRank);
+ AllAppsButtonInfo allAppsButtonInfo = new AllAppsButtonInfo();
+ allAppsButtonInfo.cellX = x;
+ allAppsButtonInfo.cellY = y;
+ allAppsButton.setTag(allAppsButtonInfo);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true);