1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-18 17:01:01 -08:00

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.
This commit is contained in:
Po Lu 2023-03-04 15:55:09 +08:00
parent 39a7e6b79f
commit 2634765bc3
3 changed files with 79 additions and 34 deletions

View file

@ -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)