diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-12-30 23:12:34 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2012-12-30 23:14:27 +0000 |
commit | 8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550 (patch) | |
tree | 92014e3fd024af6c7091bd077b3bcfca8628437d /src | |
parent | 8dd822a77c94a57b670faca72227e46338d3feee (diff) | |
download | packages_apps_trebuchet-8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550.zip packages_apps_trebuchet-8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550.tar.gz packages_apps_trebuchet-8ef4dd94aa73ef5a1fc7cac0945a38a6680fa550.tar.bz2 |
LauncherModel: Fixes
Change-Id: Ibc2cd7e30309380ac95467467df8d831ca12a183
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java | 12 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/CellLayout.java | 5 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/DragLayer.java | 22 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Folder.java | 5 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Hotseat.java | 2 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java | 13 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 20 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/LauncherModel.java | 74 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java | 6 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/PagedViewWidget.java | 6 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 26 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java | 3 |
12 files changed, 105 insertions, 89 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java index d1a2006..84c1e44 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 4029ed1..6e12831 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 e26a291..f7f46ac 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 d2a9dea..0015298 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 08ca1ed..bf48d0d 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 10bdb72..fd11fa0 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 a65d4cf..454dbb0 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 22ea2f2..13f2250 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 2b9866a..e211abf 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 e694c15..eae0f02 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 6e8d720..8564a56 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 224f992..a20d812 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); } |