summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-12-08 15:14:37 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-12-08 15:14:37 -0800
commit882754e8cc5833e19696271d612b4b9eabcc5bb3 (patch)
tree5662b5c030c35098810d582a68c8c0a4e1dff3b2 /core
parentc1eaeea687e16a1e9e52b4e4ea6f12dbd460c9bf (diff)
parentedd9508aba83a0e6ed49cce3840783c1c72d1430 (diff)
downloadframeworks_base-882754e8cc5833e19696271d612b4b9eabcc5bb3.zip
frameworks_base-882754e8cc5833e19696271d612b4b9eabcc5bb3.tar.gz
frameworks_base-882754e8cc5833e19696271d612b4b9eabcc5bb3.tar.bz2
Merge "Modified GridView to report when to small"
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/GridView.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 84bc5f2..df01da7 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -889,10 +889,11 @@ public class GridView extends AbsListView {
return sel;
}
- private void determineColumns(int availableSpace) {
+ private boolean determineColumns(int availableSpace) {
final int requestedHorizontalSpacing = mRequestedHorizontalSpacing;
final int stretchMode = mStretchMode;
final int requestedColumnWidth = mRequestedColumnWidth;
+ boolean didNotInitiallyFit = false;
if (mRequestedNumColumns == AUTO_FIT) {
if (requestedColumnWidth > 0) {
@@ -922,6 +923,11 @@ public class GridView extends AbsListView {
default:
int spaceLeftOver = availableSpace - (mNumColumns * requestedColumnWidth) -
((mNumColumns - 1) * requestedHorizontalSpacing);
+
+ if (spaceLeftOver < 0) {
+ didNotInitiallyFit = true;
+ }
+
switch (stretchMode) {
case STRETCH_COLUMN_WIDTH:
// Stretch the columns
@@ -954,6 +960,7 @@ public class GridView extends AbsListView {
break;
}
+ return didNotInitiallyFit;
}
@Override
@@ -976,7 +983,7 @@ public class GridView extends AbsListView {
}
int childWidth = widthSize - mListPadding.left - mListPadding.right;
- determineColumns(childWidth);
+ boolean didNotInitiallyFit = determineColumns(childWidth);
int childHeight = 0;
int childState = 0;
@@ -1035,7 +1042,7 @@ public class GridView extends AbsListView {
int ourSize = (mRequestedNumColumns*mColumnWidth)
+ ((mRequestedNumColumns-1)*mHorizontalSpacing)
+ mListPadding.left + mListPadding.right;
- if (ourSize > widthSize) {
+ if (ourSize > widthSize || didNotInitiallyFit) {
widthSize |= MEASURED_STATE_TOO_SMALL;
}
}