Merge "Accommodate NaN in new context menu methods." into nyc-dev am: a86d1e0

am: 1fab8d9

* commit '1fab8d995e74de2128b45d9cae294c8d5ccf2fc6':
  Accommodate NaN in new context menu methods.

Change-Id: Ifaf625d13b5dc57cf69f10ef1af99aef4acfecb6
This commit is contained in:
Oren Blasberg
2016-04-26 23:16:14 +00:00
committed by android-build-merger
3 changed files with 10 additions and 7 deletions

View File

@@ -5750,9 +5750,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* view-relative coordinate.
*
* @param x the X coordinate in pixels relative to the view to which the
* menu should be anchored
* menu should be anchored, or {@link Float#NaN} to disable anchoring
* @param y the Y coordinate in pixels relative to the view to which the
* menu should be anchored
* menu should be anchored, or {@link Float#NaN} to disable anchoring
* @return {@code true} if the context menu was shown, {@code false}
* otherwise
*/

View File

@@ -199,9 +199,11 @@ public interface ViewParent {
* @param originalView the source view where the context menu was first
* invoked
* @param x the X coordinate in pixels relative to the original view to
* which the menu should be anchored
* which the menu should be anchored, or {@link Float#NaN} to
* disable anchoring
* @param y the Y coordinate in pixels relative to the original view to
* which the menu should be anchored
* which the menu should be anchored, or {@link Float#NaN} to
* disable anchoring
* @return {@code true} if the context menu was shown, {@code false}
* otherwise
*/

View File

@@ -733,16 +733,16 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
@Override
public boolean showContextMenuForChild(View originalView) {
return showContextMenuForChildInternal(originalView, 0, 0, false);
return showContextMenuForChildInternal(originalView, Float.NaN, Float.NaN);
}
@Override
public boolean showContextMenuForChild(View originalView, float x, float y) {
return showContextMenuForChildInternal(originalView, x, y, true);
return showContextMenuForChildInternal(originalView, x, y);
}
private boolean showContextMenuForChildInternal(View originalView,
float x, float y, boolean isPopup) {
float x, float y) {
// Only allow one context menu at a time.
if (mWindow.mContextMenuHelper != null) {
mWindow.mContextMenuHelper.dismiss();
@@ -759,6 +759,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
}
final MenuHelper helper;
final boolean isPopup = !Float.isNaN(x) && !Float.isNaN(y);
if (isPopup) {
helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
} else {