diff options
author | Danesh M <daneshm90@gmail.com> | 2013-10-24 20:16:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-10-24 20:16:50 +0000 |
commit | a39739b8104131f098c0fc1680b063fd7d12bad7 (patch) | |
tree | 087c08b6757e5c53cb517bfdf96da2fada2c33e6 /src/com/cyanogenmod/trebuchet/CellLayout.java | |
parent | efa4b8d18459243abf379bb0135ee0a89165a50a (diff) | |
download | android_packages_apps_Trebuchet-a39739b8104131f098c0fc1680b063fd7d12bad7.tar.gz android_packages_apps_Trebuchet-a39739b8104131f098c0fc1680b063fd7d12bad7.tar.bz2 android_packages_apps_Trebuchet-a39739b8104131f098c0fc1680b063fd7d12bad7.zip |
Revert "Trebuchet : Fix dynamic padding"
This reverts commit efa4b8d18459243abf379bb0135ee0a89165a50a.
Change-Id: Ibc3857b7cb94cce395cbaa2671b34cced3a538b9
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/CellLayout.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/CellLayout.java | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/com/cyanogenmod/trebuchet/CellLayout.java b/src/com/cyanogenmod/trebuchet/CellLayout.java index 2118a95f0..eab7d1e02 100644 --- a/src/com/cyanogenmod/trebuchet/CellLayout.java +++ b/src/com/cyanogenmod/trebuchet/CellLayout.java @@ -74,6 +74,7 @@ public class CellLayout extends ViewGroup { private int mOriginalHeightGap; private int mWidthGap; private int mHeightGap; + private int mMaxGap; private boolean mScrollingTransformsDirty = false; private final Rect mRect = new Rect(); @@ -190,6 +191,7 @@ public class CellLayout extends ViewGroup { mCellHeight = mOriginalCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10); 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.getWorkspaceCellCountX(); mCountY = LauncherModel.getWorkspaceCellCountY(); mOccupied = new boolean[mCountX][mCountY]; @@ -281,6 +283,11 @@ public class CellLayout extends ViewGroup { mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context); + if (!LauncherApplication.isScreenLarge()){ + mCellWidth = (mCellWidth * res.getInteger(R.integer.default_cell_count_x)) / mCountX; + mCellHeight = (mCellHeight * res.getInteger(R.integer.default_cell_count_y)) / mCountY; + } + mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); addView(mShortcutsAndWidgets); } @@ -992,26 +999,10 @@ public class CellLayout extends ViewGroup { if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) { int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight(); int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom(); - - if (hSpace - (mCountX * mCellWidth) < 0) { - mCellWidth = hSpace / mCountX; - } - if (vSpace - (mCountY * mCellHeight) < 0) { - mCellHeight = vSpace / mCountY; - } - int hFreeSpace = hSpace - (mCountX * mCellWidth); int vFreeSpace = vSpace - (mCountY * mCellHeight); - - mWidthGap = 0; - mHeightGap = 0; - - if (numWidthGaps > 0) { - mWidthGap = hFreeSpace / numWidthGaps; - } - if (numHeightGaps > 0) { - mHeightGap = vFreeSpace / numHeightGaps; - } + mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0); + mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0); mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); } else { mWidthGap = mOriginalWidthGap; |