summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-06-25 20:00:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-25 20:00:56 +0000
commite71c6e3832a963ed3cfa8c124374799f774eccb3 (patch)
tree1a078253e3e9ea8e0600bfbb5020d4d4c7f67aa6
parentfdf102e62ddf04ed1a3157b00d4da5b56d298df3 (diff)
parentba4332d9cf09b7e342783e39efd41646792a5b06 (diff)
downloadframeworks_base-e71c6e3832a963ed3cfa8c124374799f774eccb3.zip
frameworks_base-e71c6e3832a963ed3cfa8c124374799f774eccb3.tar.gz
frameworks_base-e71c6e3832a963ed3cfa8c124374799f774eccb3.tar.bz2
Merge "Constrain ListPopupWindow hint width spec to >= 0" into mnc-dev
-rw-r--r--core/java/android/widget/ListPopupWindow.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index 534bfad..c6de5dd 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1127,10 +1127,19 @@ public class ListPopupWindow {
break;
}
- // measure the hint's height to find how much more vertical space
- // we need to add to the drop down's height
- int widthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.AT_MOST);
- int heightSpec = MeasureSpec.UNSPECIFIED;
+ // Measure the hint's height to find how much more vertical
+ // space we need to add to the drop down's height.
+ final int widthSize;
+ final int widthMode;
+ if (mDropDownWidth >= 0) {
+ widthMode = MeasureSpec.AT_MOST;
+ widthSize = mDropDownWidth;
+ } else {
+ widthMode = MeasureSpec.UNSPECIFIED;
+ widthSize = 0;
+ }
+ final int widthSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
+ final int heightSpec = MeasureSpec.UNSPECIFIED;
hintView.measure(widthSpec, heightSpec);
hintParams = (LinearLayout.LayoutParams) hintView.getLayoutParams();