summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-12-30 23:12:34 +0000
committernebkat <nebkat@teamhacksung.org>2012-12-30 23:14:27 +0000
commit8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550 (patch)
tree92014e3fd024af6c7091bd077b3bcfca8628437d
parent8dd822a77c94a57b670faca72227e46338d3feee (diff)
downloadandroid_packages_apps_Trebuchet-8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550.tar.gz
android_packages_apps_Trebuchet-8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550.tar.bz2
android_packages_apps_Trebuchet-8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550.zip
LauncherModel: Fixes
Change-Id: Ibc2cd7e30309380ac95467467df8d831ca12a183
-rw-r--r--AndroidManifest.xml16
-rw-r--r--res/values-land/dimens.xml5
-rw-r--r--res/values-port/dimens.xml5
-rw-r--r--res/values/dimens.xml9
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/preferences_dock.xml9
-rw-r--r--src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java12
-rw-r--r--src/com/cyanogenmod/trebuchet/CellLayout.java5
-rw-r--r--src/com/cyanogenmod/trebuchet/DragLayer.java22
-rw-r--r--src/com/cyanogenmod/trebuchet/Folder.java5
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java13
-rw-r--r--src/com/cyanogenmod/trebuchet/Launcher.java20
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherModel.java74
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewWidget.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java26
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java3
18 files changed, 143 insertions, 97 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 79b539916..f9271e4e7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -22,7 +22,7 @@
package="com.cyanogenmod.trebuchet"
android:versionName="@string/application_version">
- <original-package android:name="com.android.launcher2" />
+ <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" />
<permission
android:name="com.android.launcher.permission.PRELOAD_WORKSPACE"
@@ -39,19 +39,19 @@
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous"
android:label="@string/permlab_uninstall_shortcut"
- android:description="@string/permdesc_uninstall_shortcut"/>
+ android:description="@string/permdesc_uninstall_shortcut" />
<permission
android:name="com.android.launcher.permission.READ_SETTINGS"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="normal"
android:label="@string/permlab_read_settings"
- android:description="@string/permdesc_read_settings"/>
+ android:description="@string/permdesc_read_settings" />
<permission
android:name="com.android.launcher.permission.WRITE_SETTINGS"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="normal"
android:label="@string/permlab_write_settings"
- android:description="@string/permdesc_write_settings"/>
+ android:description="@string/permdesc_write_settings" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
@@ -80,7 +80,7 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.MONKEY"/>
+ <category android:name="android.intent.category.MONKEY" />
</intent-filter>
</activity>
@@ -117,7 +117,7 @@
</activity>
<activity android:name="com.cyanogenmod.trebuchet.preference.HiddenAppsActivity"
- android:label="@string/hidden_apps_title"/>
+ android:label="@string/hidden_apps_title" />
<!-- Intent received used to install shortcuts from other applications -->
<receiver
@@ -145,7 +145,7 @@
<action android:name="android.intent.action.USER_INITIALIZE" />
</intent-filter>
</receiver>
-
+
<!-- The settings provider contains Home's data, like the workspace favorites -->
<provider
android:name="com.cyanogenmod.trebuchet.LauncherProvider"
@@ -155,6 +155,6 @@
android:readPermission="com.android.launcher.permission.READ_SETTINGS" />
<meta-data android:name="android.nfc.disable_beam_default"
- android:value="true" />
+ android:value="true" />
</application>
</manifest>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 5edd14364..144f6ee09 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -42,6 +42,11 @@
<dimen name="workspace_top_padding">@dimen/workspace_top_padding_land</dimen>
<dimen name="workspace_bottom_padding">@dimen/workspace_bottom_padding_land</dimen>
+ <dimen name="workspace_left_padding_qsb_hidden">@dimen/workspace_left_padding_land_qsb_hidden</dimen>
+ <dimen name="workspace_right_padding_hotseat_hidden">@dimen/workspace_right_padding_land_hotseat_hidden</dimen>
+ <dimen name="workspace_top_padding_qsb_hidden">@dimen/workspace_top_padding_land_qsb_hidden</dimen>
+ <dimen name="workspace_bottom_padding_hotseat_hidden">@dimen/workspace_bottom_padding_land_hotseat_hidden</dimen>
+
<dimen name="app_icon_padding_top">6dp</dimen>
<!-- height of the bottom row of controls -->
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 969d3358a..0b5b12984 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -34,6 +34,11 @@
<dimen name="workspace_top_padding">@dimen/workspace_top_padding_port</dimen>
<dimen name="workspace_bottom_padding">@dimen/workspace_bottom_padding_port</dimen>
+ <dimen name="workspace_left_padding_qsb_hidden">@dimen/workspace_left_padding_port_qsb_hidden</dimen>
+ <dimen name="workspace_right_padding_hotseat_hidden">@dimen/workspace_right_padding_port_hotseat_hidden</dimen>
+ <dimen name="workspace_top_padding_qsb_hidden">@dimen/workspace_top_padding_port_qsb_hidden</dimen>
+ <dimen name="workspace_bottom_padding_hotseat_hidden">@dimen/workspace_bottom_padding_port_hotseat_hidden</dimen>
+
<dimen name="workspace_page_spacing">-1dp</dimen>
<!-- AppsCustomize -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 42743c49d..30b519211 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -150,6 +150,15 @@
<dimen name="workspace_bottom_padding_port">@dimen/button_bar_height</dimen>
<dimen name="workspace_bottom_padding_land">0dp</dimen>
+ <dimen name="workspace_left_padding_port_qsb_hidden">0dp</dimen>
+ <dimen name="workspace_left_padding_land_qsb_hidden">0dp</dimen>
+ <dimen name="workspace_top_padding_port_qsb_hidden">0dp</dimen>
+ <dimen name="workspace_top_padding_land_qsb_hidden">0dp</dimen>
+ <dimen name="workspace_right_padding_port_hotseat_hidden">0dp</dimen>
+ <dimen name="workspace_right_padding_land_hotseat_hidden">0dp</dimen>
+ <dimen name="workspace_bottom_padding_port_hotseat_hidden">0dp</dimen>
+ <dimen name="workspace_bottom_padding_land_hotseat_hidden">0dp</dimen>
+
<!-- Workspace cell size -->
<dimen name="workspace_cell_width_land">106dp</dimen>
<dimen name="workspace_cell_width_port">80dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f1409f107..70f411249 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -382,6 +382,8 @@ s -->
<!-- Dock -->
<string name="preferences_interface_dock_title">Dock</string>
+ <string name="preferences_interface_dock_enabled_title">Show dock</string>
+ <string name="preferences_interface_dock_enabled_summary">Show the dock underneath the homescreen</string>
<string name="preferences_interface_dock_pages_title">Pages</string>
<string name="preferences_interface_dock_pages_summary">Number of pages in the dock</string>
<string name="preferences_interface_dock_default_page_title">Default page</string>
diff --git a/res/xml/preferences_dock.xml b/res/xml/preferences_dock.xml
index 54c7d6c84..c07a1cb39 100644
--- a/res/xml/preferences_dock.xml
+++ b/res/xml/preferences_dock.xml
@@ -18,12 +18,17 @@
xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet"
android:key="ui_dock"
android:title="@string/preferences_interface_dock_title">
+ <!--<CheckBoxPreference android:key="ui_dock_enabled"
+ android:title="@string/preferences_interface_dock_enabled_title"
+ android:summary="@string/preferences_interface_dock_enabled_summary"
+ android:defaultValue="true" />-->
<com.cyanogenmod.trebuchet.preference.NumberPickerPreference android:key="ui_dock_pages"
android:title="@string/preferences_interface_dock_pages_title"
android:summary="@string/preferences_interface_dock_pages_summary"
android:defaultValue="1"
launcher:max="3"
launcher:min="1" />
+ <!-- android:dependency="ui_dock_enabled" /-->
<com.cyanogenmod.trebuchet.preference.NumberPickerPreference android:key="ui_dock_default_page"
android:title="@string/preferences_interface_dock_default_page_title"
android:summary="@string/preferences_interface_dock_default_page_summary"
@@ -31,20 +36,24 @@
launcher:maxExternal="ui_dock_pages"
launcher:max="3"
launcher:min="1" />
+ <!-- android:dependency="ui_dock_enabled" /-->
<com.cyanogenmod.trebuchet.preference.NumberPickerPreference android:key="ui_dock_icons"
android:title="@string/preferences_interface_dock_icons_title"
android:summary="@string/preferences_interface_dock_icons_summary"
android:defaultValue="@integer/hotseat_cell_count"
launcher:max="@integer/hotseat_cell_count"
launcher:min="3" />
+ <!-- android:dependency="ui_dock_enabled" /-->
<com.cyanogenmod.trebuchet.preference.SeekBarDialogPreference android:key="ui_dock_icon_scale"
android:title="@string/preferences_interface_dock_icon_scale_title"
android:summary="@string/preferences_interface_dock_icon_scale_summary"
launcher:min="80"
launcher:max="100"
android:defaultValue="@integer/hotseat_item_scale_percentage" />
+ <!-- android:dependency="ui_dock_enabled" /-->
<CheckBoxPreference android:key="ui_dock_divider"
android:title="@string/preferences_interface_dock_divider_title"
android:summary="@string/preferences_interface_dock_divider_summary"
android:defaultValue="true" />
+ <!-- android:dependency="ui_dock_enabled" /-->
</PreferenceScreen>
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
index d1a200661..84c1e44d1 100644
--- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
+++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
@@ -538,10 +538,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int maxCellCountX = Integer.MAX_VALUE;
int maxCellCountY = Integer.MAX_VALUE;
if (LauncherApplication.isScreenLarge()) {
- maxCellCountX = (isLandscape ? LauncherModel.getCellCountX() :
- LauncherModel.getCellCountY());
- maxCellCountY = (isLandscape ? LauncherModel.getCellCountY() :
- LauncherModel.getCellCountX());
+ maxCellCountX = (isLandscape ? LauncherModel.getWorkspaceCellCountX() :
+ LauncherModel.getWorkspaceCellCountY());
+ maxCellCountY = (isLandscape ? LauncherModel.getWorkspaceCellCountY() :
+ LauncherModel.getWorkspaceCellCountX());
}
if (mMaxAppCellCountX > -1) {
maxCellCountX = Math.min(maxCellCountX, mMaxAppCellCountX);
@@ -653,8 +653,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int[] minSpanXY = Launcher.getMinSpanForWidget(mLauncher, widget);
int minSpanX = Math.min(spanXY[0], minSpanXY[0]);
int minSpanY = Math.min(spanXY[1], minSpanXY[1]);
- if (minSpanX <= LauncherModel.getCellCountX() &&
- minSpanY <= LauncherModel.getCellCountY()) {
+ if (minSpanX <= LauncherModel.getWorkspaceCellCountX() &&
+ minSpanY <= LauncherModel.getWorkspaceCellCountY()) {
mWidgets.add(widget);
} else {
Log.e(TAG, "Widget " + widget.provider + " can not fit on this device (" +
diff --git a/src/com/cyanogenmod/trebuchet/CellLayout.java b/src/com/cyanogenmod/trebuchet/CellLayout.java
index 4029ed119..6e128319f 100644
--- a/src/com/cyanogenmod/trebuchet/CellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/CellLayout.java
@@ -189,8 +189,8 @@ public class CellLayout extends ViewGroup {
mWidthGap = mOriginalWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, 0);
mHeightGap = mOriginalHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, 0);
mMaxGap = a.getDimensionPixelSize(R.styleable.CellLayout_maxGap, 0);
- mCountX = LauncherModel.getCellCountX();
- mCountY = LauncherModel.getCellCountY();
+ mCountX = LauncherModel.getWorkspaceCellCountX();
+ mCountY = LauncherModel.getWorkspaceCellCountY();
mOccupied = new boolean[mCountX][mCountY];
mTmpOccupied = new boolean[mCountX][mCountY];
mPreviousReorderDirection[0] = INVALID_DIRECTION;
@@ -614,7 +614,6 @@ public class CellLayout extends ViewGroup {
boolean markCells) {
final LayoutParams lp = params;
- // Hotseat icons - remove text
if (child instanceof BubbleTextView) {
BubbleTextView bubbleChild = (BubbleTextView) child;
diff --git a/src/com/cyanogenmod/trebuchet/DragLayer.java b/src/com/cyanogenmod/trebuchet/DragLayer.java
index e26a2915a..f7f46acfc 100644
--- a/src/com/cyanogenmod/trebuchet/DragLayer.java
+++ b/src/com/cyanogenmod/trebuchet/DragLayer.java
@@ -702,28 +702,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
}
}
- @Override
- protected int getChildDrawingOrder(int childCount, int i) {
- // TODO: We have turned off this custom drawing order because it now effects touch
- // dispatch order. We need to sort that issue out and then decide how to go about this.
- if (true || LauncherApplication.isScreenLandscape(getContext()) ||
- mWorkspaceIndex == -1 || mQsbIndex == -1 ||
- mLauncher.getWorkspace().isDrawingBackgroundGradient()) {
- return i;
- }
-
- // This ensures that the workspace is drawn above the hotseat and qsb,
- // except when the workspace is drawing a background gradient, in which
- // case we want the workspace to stay behind these elements.
- if (i == mQsbIndex) {
- return mWorkspaceIndex;
- } else if (i == mWorkspaceIndex) {
- return mQsbIndex;
- } else {
- return i;
- }
- }
-
private boolean mInScrollArea;
private Drawable mLeftHoverDrawable;
private Drawable mRightHoverDrawable;
diff --git a/src/com/cyanogenmod/trebuchet/Folder.java b/src/com/cyanogenmod/trebuchet/Folder.java
index d2a9dea1c..00152987b 100644
--- a/src/com/cyanogenmod/trebuchet/Folder.java
+++ b/src/com/cyanogenmod/trebuchet/Folder.java
@@ -44,7 +44,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.FolderInfo.FolderListener;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
@@ -128,8 +127,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mMaxCountY = res.getInteger(R.integer.folder_max_count_y);
mMaxNumItems = res.getInteger(R.integer.folder_max_num_items);
if (mMaxCountX < 0 || mMaxCountY < 0 || mMaxNumItems < 0) {
- mMaxCountX = LauncherModel.getCellCountX();
- mMaxCountY = LauncherModel.getCellCountY();
+ mMaxCountX = LauncherModel.getWorkspaceCellCountX();
+ mMaxCountY = LauncherModel.getWorkspaceCellCountY();
mMaxNumItems = mMaxCountX * mMaxCountY;
}
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index 08ca1ed7c..bf48d0de8 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -69,6 +69,8 @@ public class Hotseat extends PagedView {
mCellCount = a.getInt(R.styleable.Hotseat_cellCount, DEFAULT_CELL_COUNT);
mCellCount = PreferencesProvider.Interface.Dock.getNumberIcons(mCellCount);
+ LauncherModel.updateHotseatLayoutCells(mCellCount);
+
mVertical = hasVerticalHotseat();
diff --git a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
index 10bdb7243..fd11fa000 100644
--- a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
+++ b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
@@ -24,7 +24,6 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.widget.Toast;
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
import java.util.ArrayList;
@@ -92,8 +91,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
}
}
// Queue the item up for adding if launcher has not loaded properly yet
- boolean launcherNotLoaded = LauncherModel.getCellCountX() <= 0 ||
- LauncherModel.getCellCountY() <= 0;
+ boolean launcherNotLoaded = LauncherModel.getWorkspaceCellCountX() <= 0 ||
+ LauncherModel.getWorkspaceCellCountY() <= 0;
PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent);
if (mUseInstallQueue || launcherNotLoaded) {
@@ -167,7 +166,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
String name, Intent intent, final int screen, boolean shortcutExists,
final SharedPreferences sharedPrefs, int[] result) {
int[] tmpCoordinates = new int[2];
- if (findEmptyCell(context, items, tmpCoordinates, screen)) {
+ if (findEmptyCell(items, tmpCoordinates, screen)) {
if (intent != null) {
if (intent.getAction() == null) {
intent.setAction(Intent.ACTION_VIEW);
@@ -225,10 +224,10 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
return false;
}
- private static boolean findEmptyCell(Context context, ArrayList<ItemInfo> items, int[] xy,
+ private static boolean findEmptyCell(ArrayList<ItemInfo> items, int[] xy,
int screen) {
- final int xCount = LauncherModel.getCellCountX();
- final int yCount = LauncherModel.getCellCountY();
+ final int xCount = LauncherModel.getWorkspaceCellCountX();
+ final int yCount = LauncherModel.getWorkspaceCellCountY();
boolean[][] occupied = new boolean[xCount][yCount];
int cellX, cellY, spanX, spanY;
diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java
index a65d4cf6a..454dbb06f 100644
--- a/src/com/cyanogenmod/trebuchet/Launcher.java
+++ b/src/com/cyanogenmod/trebuchet/Launcher.java
@@ -55,6 +55,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
+import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
@@ -148,7 +149,9 @@ public final class Launcher extends Activity
static final String EXTRA_SHORTCUT_DUPLICATE = "duplicate";
- static final int MAX_SCREEN_COUNT = 7;
+ static final int MAX_WORKSPACE_SCREEN_COUNT = 7;
+ static final int MAX_HOTSEAT_SCREEN_COUNT = 3;
+ static final int MAX_SCREEN_COUNT = MAX_WORKSPACE_SCREEN_COUNT + MAX_HOTSEAT_SCREEN_COUNT;
static final int DEFAULT_SCREEN = 2;
private static final String PREFERENCES = "launcher.preferences";
@@ -302,6 +305,7 @@ public final class Launcher extends Activity
= new HideFromAccessibilityHelper();
// Preferences
private boolean mShowSearchBar;
+ private boolean mShowHotseat;
private boolean mShowDockDivider;
private boolean mHideIconLabels;
private boolean mAutoRotate;
@@ -382,7 +386,8 @@ public final class Launcher extends Activity
mPaused = false;
// Preferences
mShowSearchBar = PreferencesProvider.Interface.Homescreen.getShowSearchBar();
- mShowDockDivider = PreferencesProvider.Interface.Dock.getShowDivider();
+ mShowHotseat = PreferencesProvider.Interface.Dock.getShowDock();
+ mShowDockDivider = PreferencesProvider.Interface.Dock.getShowDivider() && mShowHotseat;
mHideIconLabels = PreferencesProvider.Interface.Homescreen.getHideIconLabels();
mAutoRotate = PreferencesProvider.Interface.General.getAutoRotate(getResources().getBoolean(R.bool.allow_rotation));
mFullscreenMode = PreferencesProvider.Interface.General.getFullscreenMode();
@@ -942,6 +947,10 @@ public final class Launcher extends Activity
mQsbDivider.setVisibility(View.GONE);
}
+ if (!mShowHotseat) {
+ mHotseat.setVisibility(View.GONE);
+ }
+
if (!mShowDockDivider && mDockDivider != null) {
mDockDivider.setVisibility(View.GONE);
}
@@ -2401,6 +2410,7 @@ public final class Launcher extends Activity
// User long pressed on empty space
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
+
startWallpaper();
} else {
if (!(itemUnderLongClick instanceof Folder)) {
@@ -3019,7 +3029,7 @@ public final class Launcher extends Activity
* Shows the hotseat area.
*/
void showHotseat(boolean animated) {
- if (!LauncherApplication.isScreenLarge()) {
+ if (mShowHotseat) {
if (animated) {
if (mHotseat.getAlpha() != 1f) {
int duration = 0;
@@ -3038,7 +3048,7 @@ public final class Launcher extends Activity
* Hides the hotseat area.
*/
void hideHotseat(boolean animated) {
- if (!LauncherApplication.isScreenLarge()) {
+ if (mShowHotseat) {
if (animated) {
if (mHotseat.getAlpha() != 0f) {
int duration = 0;
@@ -3615,7 +3625,7 @@ public final class Launcher extends Activity
public int compare(View a, View b) {
CellLayout.LayoutParams alp = (CellLayout.LayoutParams) a.getLayoutParams();
CellLayout.LayoutParams blp = (CellLayout.LayoutParams) b.getLayoutParams();
- int cellCountX = LauncherModel.getCellCountX();
+ int cellCountX = LauncherModel.getWorkspaceCellCountX();
return (alp.cellY * cellCountX + alp.cellX) - (blp.cellY * cellCountX + blp.cellX);
}
});
diff --git a/src/com/cyanogenmod/trebuchet/LauncherModel.java b/src/com/cyanogenmod/trebuchet/LauncherModel.java
index 22ea2f2b3..13f2250d7 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherModel.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherModel.java
@@ -135,8 +135,9 @@ public class LauncherModel extends BroadcastReceiver {
private IconCache mIconCache;
private Bitmap mDefaultIcon;
- private static int mCellCountX;
- private static int mCellCountY;
+ private static int sWorkspaceCellCountX;
+ private static int sWorkspaceCellCountY;
+ private static int sHotseatCellCount;
protected int mPreviousConfigMcc;
@@ -610,12 +611,16 @@ public class LauncherModel extends BroadcastReceiver {
| (screen & 0xFF) << 16 | (localCellX & 0xFF) << 8 | (localCellY & 0xFF);
}
- static int getCellCountX() {
- return mCellCountX;
+ static int getWorkspaceCellCountX() {
+ return sWorkspaceCellCountX;
}
- static int getCellCountY() {
- return mCellCountY;
+ static int getWorkspaceCellCountY() {
+ return sWorkspaceCellCountY;
+ }
+
+ static int getHotseatCellCount() {
+ return sHotseatCellCount;
}
/**
@@ -623,8 +628,16 @@ public class LauncherModel extends BroadcastReceiver {
* when performing local/canonical coordinate transformations.
*/
static void updateWorkspaceLayoutCells(int shortAxisCellCount, int longAxisCellCount) {
- mCellCountX = shortAxisCellCount;
- mCellCountY = longAxisCellCount;
+ sWorkspaceCellCountX = shortAxisCellCount;
+ sWorkspaceCellCountY = longAxisCellCount;
+ }
+
+ /**
+ * Updates the model orientation helper to take into account the current layout dimensions
+ * when performing local/canonical coordinate transformations.
+ */
+ static void updateHotseatLayoutCells(int cellCount) {
+ sHotseatCellCount = cellCount;
}
/**
@@ -712,6 +725,27 @@ public class LauncherModel extends BroadcastReceiver {
}
/**
+ * Count the amount of items of a type
+ */
+ static int countAllItemsOfType(Context context, int itemType) {
+ final ContentResolver cr = context.getContentResolver();
+ Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI, null,
+ "itemType=?", new String[]{ String.valueOf(itemType) }, null);
+ return c.getCount();
+ }
+
+ /**
+ * Count the amount of items of a type in a container
+ */
+ static int countAllItemsOfType(Context context, int itemType, long container) {
+ final ContentResolver cr = context.getContentResolver();
+ Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI, null,
+ "itemType=? and container=?", new String[]{ String.valueOf(itemType),
+ String.valueOf(container) }, null);
+ return c.getCount();
+ }
+
+ /**
* Set this as the current Launcher activity object for the loader.
*/
public void initialize(Callbacks callbacks) {
@@ -1152,17 +1186,7 @@ public class LauncherModel extends BroadcastReceiver {
private boolean checkItemPlacement(ItemInfo occupied[][][], ItemInfo item) {
int containerIndex = item.screen;
if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
- // We use the last index to refer to the hotseat and the screen as the rank, so
- // test and update the occupied state accordingly
- if (occupied[Launcher.MAX_SCREEN_COUNT][item.cellX][0] != null) {
- Log.e(TAG, "Error loading shortcut into hotseat " + item
- + " into position (" + item.screen + ":" + item.cellX + "," + item.cellY
- + ") occupied by " + occupied[Launcher.MAX_SCREEN_COUNT][item.screen][0]);
- return false;
- } else {
- occupied[Launcher.MAX_SCREEN_COUNT][item.cellX][0] = item;
- return true;
- }
+ containerIndex += Launcher.MAX_WORKSPACE_SCREEN_COUNT;
} else if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
// Skip further checking if it is not the hotseat or workspace container
return true;
@@ -1214,11 +1238,11 @@ public class LauncherModel extends BroadcastReceiver {
final Cursor c = contentResolver.query(
LauncherSettings.Favorites.CONTENT_URI, null, null, null, null);
- // +1 for the hotseat (it can be larger than the workspace)
// Load workspace in reverse order to ensure that latest items are loaded first (and
// before any earlier duplicates)
final ItemInfo occupied[][][] =
- new ItemInfo[Launcher.MAX_SCREEN_COUNT + 1][mCellCountX + 1][mCellCountY + 1];
+ new ItemInfo[Launcher.MAX_SCREEN_COUNT][Math.max(sWorkspaceCellCountX, sHotseatCellCount)]
+ [Math.max(sWorkspaceCellCountY, sHotseatCellCount)];
try {
final int idIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites._ID);
@@ -1444,13 +1468,13 @@ public class LauncherModel extends BroadcastReceiver {
if (DEBUG_LOADERS) {
Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms");
Log.d(TAG, "workspace layout: ");
- for (int y = 0; y < mCellCountY; y++) {
+ for (int y = 0; y < sWorkspaceCellCountY; y++) {
String line = "";
for (int s = 0; s < Launcher.MAX_SCREEN_COUNT; s++) {
if (s > 0) {
line += " | ";
}
- for (int x = 0; x < mCellCountX; x++) {
+ for (int x = 0; x < sWorkspaceCellCountX; x++) {
line += ((occupied[s][x][y] != null) ? "#" : ".");
}
}
@@ -1567,8 +1591,8 @@ public class LauncherModel extends BroadcastReceiver {
Collections.sort(workspaceItems, new Comparator<ItemInfo>() {
@Override
public int compare(ItemInfo lhs, ItemInfo rhs) {
- int cellCountX = LauncherModel.getCellCountX();
- int cellCountY = LauncherModel.getCellCountY();
+ int cellCountX = LauncherModel.getWorkspaceCellCountX();
+ int cellCountY = LauncherModel.getWorkspaceCellCountY();
int screenOffset = cellCountX * cellCountY;
int containerOffset = screenOffset * (Launcher.MAX_SCREEN_COUNT + 1); // +1 hotseat
long lr = (lhs.container * containerOffset + lhs.screen * screenOffset +
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java b/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java
index 2b9866a67..e211abfec 100644
--- a/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java
@@ -24,8 +24,6 @@ import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
-import com.cyanogenmod.trebuchet.R;
-
/**
* An abstraction of the original CellLayout which supports laying out items
* which span multiple cells into a grid-like layout. Also supports dimming
@@ -66,8 +64,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width);
mOriginalCellHeight = mCellHeight =
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
- mCellCountX = LauncherModel.getCellCountX();
- mCellCountY = LauncherModel.getCellCountY();
+ mCellCountX = LauncherModel.getWorkspaceCellCountX();
+ mCellCountY = LauncherModel.getWorkspaceCellCountY();
mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
index e694c1502..eae0f0273 100644
--- a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
+++ b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
@@ -29,8 +29,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
-
/**
* The linear layout used strictly for the widget/wallpaper tab of the customization tray
*/
@@ -108,8 +106,8 @@ public class PagedViewWidget extends LinearLayout {
name.setText(info.label);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
if (dims != null) {
- int hSpan = Math.min(cellSpan[0], LauncherModel.getCellCountX());
- int vSpan = Math.min(cellSpan[1], LauncherModel.getCellCountY());
+ int hSpan = Math.min(cellSpan[0], LauncherModel.getWorkspaceCellCountX());
+ int vSpan = Math.min(cellSpan[1], LauncherModel.getWorkspaceCellCountY());
dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
}
}
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java
index 6e8d720cc..8564a564b 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -30,7 +30,6 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
@@ -301,6 +300,7 @@ public class Workspace extends PagedView
private int mDefaultHomescreen;
private boolean mStretchScreens;
private boolean mShowSearchBar;
+ private boolean mShowHotseat;
private boolean mResizeAnyWidget;
private boolean mHideIconLabels;
private boolean mScrollWallpaper;
@@ -388,6 +388,7 @@ public class Workspace extends PagedView
mStretchScreens = PreferencesProvider.Interface.Homescreen.getStretchScreens();
mShowSearchBar = PreferencesProvider.Interface.Homescreen.getShowSearchBar();
+ mShowHotseat = PreferencesProvider.Interface.Dock.getShowDock();
mResizeAnyWidget = PreferencesProvider.Interface.Homescreen.getResizeAnyWidget();
mHideIconLabels = PreferencesProvider.Interface.Homescreen.getHideIconLabels();
mTransitionEffect = PreferencesProvider.Interface.Homescreen.Scrolling.getTransitionEffect(
@@ -402,7 +403,7 @@ public class Workspace extends PagedView
mShowScrollingIndicator = PreferencesProvider.Interface.Homescreen.Indicator.getShowScrollingIndicator();
mFadeScrollingIndicator = PreferencesProvider.Interface.Homescreen.Indicator.getFadeScrollingIndicator();
mScrollingIndicatorPosition = PreferencesProvider.Interface.Homescreen.Indicator.getScrollingIndicatorPosition();
- mShowDockDivider = PreferencesProvider.Interface.Dock.getShowDivider();
+ mShowDockDivider = PreferencesProvider.Interface.Dock.getShowDivider() && mShowHotseat;
initWorkspace();
checkWallpaper();
@@ -524,15 +525,20 @@ public class Workspace extends PagedView
}
if (!mShowSearchBar) {
- int paddingTop = 0;
- int paddingLeft = 0;
- if (mLauncher.getCurrentOrientation() == Configuration.ORIENTATION_PORTRAIT) {
- paddingTop = (int)res.getDimension(R.dimen.qsb_bar_hidden_inset);
- paddingLeft = getPaddingRight();
- }
+ int paddingLeft = (int) res.getDimension(R.dimen.workspace_left_padding_qsb_hidden);
+ int paddingTop = (int) res.getDimension(R.dimen.workspace_top_padding_qsb_hidden);
setPadding(paddingLeft, paddingTop, getPaddingRight(), getPaddingBottom());
}
+ if (!mShowHotseat) {
+ int paddingRight = (int) res.getDimension(R.dimen.workspace_right_padding_hotseat_hidden);
+ int paddingBottom = (int) res.getDimension(R.dimen.workspace_bottom_padding_hotseat_hidden);
+ setPadding(getPaddingLeft(), getPaddingTop(), paddingRight, paddingBottom);
+
+ View dockScrollingIndicator = findViewById(R.id.paged_view_indicator_dock);
+ ((MarginLayoutParams)dockScrollingIndicator.getLayoutParams()).bottomMargin = 0;
+ }
+
if (!mShowScrollingIndicator) {
disableScrollingIndicator();
}
@@ -3026,7 +3032,7 @@ public class Workspace extends PagedView
int height = smallestSize.y - paddingTop - paddingBottom;
mLandscapeCellLayoutMetrics = new Rect();
CellLayout.getMetrics(mLandscapeCellLayoutMetrics, res,
- width, height, LauncherModel.getCellCountX(), LauncherModel.getCellCountY(),
+ width, height, LauncherModel.getWorkspaceCellCountX(), LauncherModel.getWorkspaceCellCountY(),
orientation);
}
return mLandscapeCellLayoutMetrics;
@@ -3040,7 +3046,7 @@ public class Workspace extends PagedView
int height = largestSize.y - paddingTop - paddingBottom;
mPortraitCellLayoutMetrics = new Rect();
CellLayout.getMetrics(mPortraitCellLayoutMetrics, res,
- width, height, LauncherModel.getCellCountX(), LauncherModel.getCellCountY(),
+ width, height, LauncherModel.getWorkspaceCellCountX(), LauncherModel.getWorkspaceCellCountY(),
orientation);
}
return mPortraitCellLayoutMetrics;
diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
index 224f99228..a20d812f4 100644
--- a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
+++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
@@ -179,6 +179,9 @@ public final class PreferencesProvider {
}
public static class Dock {
+ public static boolean getShowDock() {
+ return getBoolean("ui_dock_enabled", true);
+ }
public static int getNumberPages() {
return getInt("ui_dock_pages", 1);
}