From 0eaec1f5d1b47739b8d33cb45111bccd18f2d7b1 Mon Sep 17 00:00:00 2001 From: Jun Mukai Date: Tue, 9 Jun 2015 15:00:28 -0700 Subject: [PATCH] Specifies the new height/width for update() on ListPopupWindow.show(). The current code is doing setHeight()/setWidth() and then invokes update() with -1 for height/width params. However, javadoc for setHeight() says that "If the popup is showing, calling this method will take effect the next time the popup is shown", and update() says "Width and height can be set to -1 to update location only." That said, ListPopupWindow should invoke update() with the obtained width/height instead of invoking setWidth()/setHeight() to resize the popup window correctly. Bug: 21276583 Change-Id: I0961820ff2e845a0f68c20d6eea827aa898c2101 --- core/java/android/widget/ListPopupWindow.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index 94b9416bfdada..afc683ad439e3 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -618,12 +618,11 @@ public class ListPopupWindow { heightSpec = mDropDownHeight; } - mPopup.setWidth(widthSpec); - mPopup.setHeight(heightSpec); mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible); mPopup.update(getAnchorView(), mDropDownHorizontalOffset, - mDropDownVerticalOffset, -1, -1); + mDropDownVerticalOffset, (widthSpec < 0)? -1 : widthSpec, + (heightSpec < 0)? -1 : heightSpec); } else { final int widthSpec; if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {