diff options
| author | Po Lu <luangruo@yahoo.com> | 2023-03-04 15:55:09 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2023-03-04 15:55:09 +0800 |
| commit | 2634765bc382c27e2d11dc14174ca80d9cf41e15 (patch) | |
| tree | 3ef522e33fec01fbe0447dfc10306e6e58e17d8d /java/org/gnu/emacs/EmacsView.java | |
| parent | 39a7e6b79fdeafc539a36f6831d922a2622cb679 (diff) | |
Improve context menus on old versions of Android
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): New
field `lastClosedMenu'.
(onContextMenuClosed): Don't send event if a menu is closed
twice in a row. Also, clear wasSubmenuSelected immediately.
* java/org/gnu/emacs/EmacsContextMenu.java: Display submenus
manually in Android 6.0 and earlier.
* java/org/gnu/emacs/EmacsView.java (onCreateContextMenu)
(popupMenu): Adjust accordingly.
Diffstat (limited to 'java/org/gnu/emacs/EmacsView.java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsView.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java index d2330494bc7..617836d8811 100644 --- a/java/org/gnu/emacs/EmacsView.java +++ b/java/org/gnu/emacs/EmacsView.java @@ -464,19 +464,22 @@ public final class EmacsView extends ViewGroup if (contextMenu == null) return; - contextMenu.expandTo (menu); + contextMenu.expandTo (menu, this); } public boolean popupMenu (EmacsContextMenu menu, int xPosition, - int yPosition) + int yPosition, boolean force) { - if (popupActive) + if (popupActive && !force) return false; contextMenu = menu; popupActive = true; + Log.d (TAG, "popupMenu: " + menu + " @" + xPosition + + ", " + yPosition + " " + force); + /* Use showContextMenu (float, float) on N to get actual popup behavior. */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) |
