summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/CellLayout.java11
-rw-r--r--src/com/android/launcher2/Folder.java18
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java11
3 files changed, 33 insertions, 7 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 22516cc33..ae2250773 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -64,6 +64,8 @@ public class CellLayout extends ViewGroup {
private int mCountX;
private int mCountY;
+ private int mOriginalWidthGap;
+ private int mOriginalHeightGap;
private int mWidthGap;
private int mHeightGap;
private int mMaxGap;
@@ -155,8 +157,8 @@ public class CellLayout extends ViewGroup {
mCellWidth = a.getDimensionPixelSize(R.styleable.CellLayout_cellWidth, 10);
mOriginalCellHeight =
mCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10);
- mWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, 0);
- mHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, 0);
+ 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();
@@ -872,7 +874,7 @@ public class CellLayout extends ViewGroup {
int numWidthGaps = mCountX - 1;
int numHeightGaps = mCountY - 1;
- if (mWidthGap < 0 || mHeightGap < 0) {
+ if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight;
int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom;
int hFreeSpace = hSpace - (mCountX * mOriginalCellWidth);
@@ -885,6 +887,9 @@ public class CellLayout extends ViewGroup {
mCellHeight = mOriginalCellHeight + remainingVSpace / mCountY;
mChildren.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
+ } else {
+ mWidthGap = mOriginalWidthGap;
+ mHeightGap = mOriginalHeightGap;
}
// Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index ef02de6bc..7641fe7f2 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -35,6 +35,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
+import android.view.View.MeasureSpec;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.EditorInfo;
@@ -783,6 +784,23 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
centerAboutIcon();
}
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
+ // Technically there is no padding at the bottom, but we add space equal to the padding
+ // and have to account for that here.
+ int height = getPaddingTop() + mContent.getDesiredHeight() + mFolderNameHeight;
+
+ int contentWidthSpec = MeasureSpec.makeMeasureSpec(mContent.getDesiredWidth(),
+ MeasureSpec.EXACTLY);
+ int contentHeightSpec = MeasureSpec.makeMeasureSpec(mContent.getDesiredHeight(),
+ MeasureSpec.EXACTLY);
+ mContent.measure(contentWidthSpec, contentHeightSpec);
+
+ mFolderName.measure(contentWidthSpec,
+ MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));
+ setMeasuredDimension(width, height);
+ }
+
private void arrangeChildren(ArrayList<View> list) {
int[] vacant = new int[2];
if (list == null) {
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index fc1b01288..bec00ec0c 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -41,6 +41,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
private int mOriginalCellHeight;
private int mCellWidth;
private int mCellHeight;
+ private int mOriginalWidthGap;
+ private int mOriginalHeightGap;
private int mWidthGap;
private int mHeightGap;
private int mMaxGap;
@@ -72,7 +74,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
mPeekWidth = resources.getDimensionPixelSize(R.dimen.apps_customize_peek_width);
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
- mWidthGap = mHeightGap = -1;
+ mOriginalHeightGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
mChildren = new PagedViewCellLayoutChildren(context);
@@ -221,12 +223,10 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions");
}
-
-
int numWidthGaps = mCellCountX - 1;
int numHeightGaps = mCellCountY - 1;
- if (mWidthGap < 0 || mHeightGap < 0) {
+ if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight;
int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom;
int hFreeSpace = hSpace - (mCellCountX * mOriginalCellWidth);
@@ -236,6 +236,9 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
mChildren.setGap(mWidthGap, mHeightGap);
mHolographicChildren.setGap(mWidthGap, mHeightGap);
+ } else {
+ mWidthGap = mOriginalWidthGap;
+ mHeightGap = mOriginalHeightGap;
}
// Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY