From 9b9d2c572fe26ddbdd0aed8b9d5899b0f9b5c08c Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Wed, 15 Jul 2015 19:00:18 -0700 Subject: Fix comment bug in I71a8d356e868dc7715b030ca1078da4ec39368c3. This is a coment-only follow up CL for I71a8d356e868dc7715b030ca, which wrongly changed coordinates from window-local to view-local (relative to FloatingToolbar#mParent) when showing PopupWindow. The position of PopupWindow still needs to be specified in window-local coordinates as we had done before I71a8d356e868dc7715b030ca1078da4ec39368c3. Currently the problem might not be visible to users because 1. FloatingToolbar is not a public API hence all the instances are under our controll. 2. FloatingToolbar#mParent is alwasy initialized with PhoneWindow#getDecorView() for now. Bug: 22335001 Change-Id: Ib641dda49f7ab1c7d60207c36a47767bb408971c --- core/java/com/android/internal/widget/FloatingToolbar.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java index b3f688bbbd04..3482d3ce2ba3 100644 --- a/core/java/com/android/internal/widget/FloatingToolbar.java +++ b/core/java/com/android/internal/widget/FloatingToolbar.java @@ -450,7 +450,10 @@ public final class FloatingToolbar { } refreshCoordinatesAndOverflowDirection(contentRectOnScreen); preparePopupContent(); - // We need to specify the offset relative to mParent. + // PopupWindow#showAtLocation() receives the location relative to the attached window + // hence the following code is correct when and only when mParent is aligned to the + // top-left of the attached window. + // TODO: Fix the following logic so that mParent can be placed at anywhere. // TODO: Consider to use PopupWindow.setLayoutInScreenEnabled(true) so that we can // specify the popup poision in screen coordinates. mParent.getLocationOnScreen(mParentPositionOnScreen); @@ -519,6 +522,10 @@ public final class FloatingToolbar { cancelOverflowAnimations(); refreshCoordinatesAndOverflowDirection(contentRectOnScreen); preparePopupContent(); + // PopupWindow#update() receives the location relative to the attached window hence + // the following code is correct when and only when mParent is aligned to the top-left + // of the attached window. + // TODO: Fix the following logic so that mParent can be placed at anywhere. // We need to specify the offset relative to mParent. // TODO: Consider to use PopupWindow.setLayoutInScreenEnabled(true) so that we can // specify the popup poision in screen coordinates. -- cgit v1.2.3-59-g8ed1b