Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a86d1e0b authored by Oren Blasberg's avatar Oren Blasberg Committed by Android (Google) Code Review
Browse files

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

parents 0967da39 23e282d2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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
     */
+4 −2
Original line number Diff line number Diff line
@@ -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
     */
+4 −3
Original line number Diff line number Diff line
@@ -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 {