From b7c1b20c8a5a4d4378ae91b4a1f12a34100df452 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Thu, 17 Feb 2011 12:03:09 -0800 Subject: Fix bug 3465210 - Anchored popups don't appear above anchor when there isn't enough room. Oops. Fix a regression introduced by recent changes. Change-Id: I413998dc2413763f2ea3f31a7ca68f098be19b36 --- core/java/android/widget/PopupWindow.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 53932af65404..4b858d0dd154 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -1056,16 +1056,17 @@ public class PopupWindow { anchor.getWindowVisibleDisplayFrame(displayFrame); final View root = anchor.getRootView(); - if (mAllowScrollingAnchorParent && (p.y + mPopupHeight > displayFrame.bottom || - p.x + mPopupWidth - root.getWidth() > 0)) { + if (p.y + mPopupHeight > displayFrame.bottom || p.x + mPopupWidth - root.getWidth() > 0) { // if the drop down disappears at the bottom of the screen. we try to // scroll a parent scrollview or move the drop down back up on top of // the edit box - int scrollX = anchor.getScrollX(); - int scrollY = anchor.getScrollY(); - Rect r = new Rect(scrollX, scrollY, scrollX + mPopupWidth + xoff, - scrollY + mPopupHeight + anchor.getHeight() + yoff); - anchor.requestRectangleOnScreen(r, true); + if (mAllowScrollingAnchorParent) { + int scrollX = anchor.getScrollX(); + int scrollY = anchor.getScrollY(); + Rect r = new Rect(scrollX, scrollY, scrollX + mPopupWidth + xoff, + scrollY + mPopupHeight + anchor.getHeight() + yoff); + anchor.requestRectangleOnScreen(r, true); + } // now we re-evaluate the space available, and decide from that // whether the pop-up will go above or below the anchor. -- cgit v1.2.3-59-g8ed1b