summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-11-12 11:33:14 +0000
committerDanesh M <daneshm90@gmail.com>2014-06-06 00:47:46 -0700
commit980e8f6359076717f6c3ed074754330a41ea9c42 (patch)
treec8efdc3bb0c0a4fc4efd64bdd038e58849bdf0c7 /src/com/android
parentf65a7aa503cda295d7904d1275f86c83bb7e5f69 (diff)
downloadandroid_packages_apps_Trebuchet-980e8f6359076717f6c3ed074754330a41ea9c42.tar.gz
android_packages_apps_Trebuchet-980e8f6359076717f6c3ed074754330a41ea9c42.tar.bz2
android_packages_apps_Trebuchet-980e8f6359076717f6c3ed074754330a41ea9c42.zip
Fix CellLayout UNSPECIFIED exception (issue 11627191)
Change-Id: Id2f840a804c51e8c61bb28882796059584e4c8bb
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/Folder.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 3ce3be4e6..0222dc6e0 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -116,6 +116,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private int DRAG_MODE_REORDER = 1;
private int mDragMode = DRAG_MODE_NONE;
+ // We avoid measuring the scroll view with a 0 width or height, as this
+ // results in CellLayout being measured as UNSPECIFIED, which it does
+ // not support.
+ private static final int MIN_CONTENT_DIMEN = 5;
+
private boolean mDestroyed;
private AutoScrollHelper mAutoScrollHelper;
@@ -970,8 +975,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
int maxContentAreaHeight = grid.availableHeightPx -
workspacePadding.top - workspacePadding.bottom -
mFolderNameHeight;
- return Math.min(maxContentAreaHeight,
+ int height = Math.min(maxContentAreaHeight,
mContent.getDesiredHeight());
+ return Math.max(height, MIN_CONTENT_DIMEN);
+ }
+
+ private int getContentAreaWidth() {
+ return Math.max(mContent.getDesiredWidth(), MIN_CONTENT_DIMEN);
}
private int getFolderHeight() {
@@ -983,11 +993,12 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
int height = getFolderHeight();
- int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(mContent.getDesiredWidth(),
+ int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(getContentAreaWidth(),
MeasureSpec.EXACTLY);
int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(),
MeasureSpec.EXACTLY);
- mContent.setFixedSize(mContent.getDesiredWidth(), mContent.getDesiredHeight());
+
+ mContent.setFixedSize(getContentAreaWidth(), getContentAreaHeight());
mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
mFolderName.measure(contentAreaWidthSpec,
MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));