diff options
| author | Po Lu | 2023-02-21 21:07:57 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-21 21:07:57 +0800 |
| commit | 77feba74564c4d58b472b82fec0137091bb5c7e1 (patch) | |
| tree | 23d08bc1e5e0b11d95a09a7559e8224c9bbd56d0 /java | |
| parent | 8ca4162ecdb174e59d59fc127a1bc4fef7b89fa2 (diff) | |
| download | emacs-77feba74564c4d58b472b82fec0137091bb5c7e1.tar.gz emacs-77feba74564c4d58b472b82fec0137091bb5c7e1.zip | |
Update Android port
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(addSubmenu, inflateMenuItems): Handle tooltips correctly.
* src/android.c (android_scan_directory_tree): Fix limit
generation for root directory.
* src/androidmenu.c (android_init_emacs_context_menu)
(android_menu_show): Implement menu item help text on Android
8.0 and later.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsContextMenu.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/java/org/gnu/emacs/EmacsContextMenu.java b/java/org/gnu/emacs/EmacsContextMenu.java index 184c611bf9d..6b3ae0c6de9 100644 --- a/java/org/gnu/emacs/EmacsContextMenu.java +++ b/java/org/gnu/emacs/EmacsContextMenu.java | |||
| @@ -26,6 +26,7 @@ import android.content.Context; | |||
| 26 | import android.content.Intent; | 26 | import android.content.Intent; |
| 27 | 27 | ||
| 28 | import android.os.Bundle; | 28 | import android.os.Bundle; |
| 29 | import android.os.Build; | ||
| 29 | 30 | ||
| 30 | import android.view.Menu; | 31 | import android.view.Menu; |
| 31 | import android.view.MenuItem; | 32 | import android.view.MenuItem; |
| @@ -54,7 +55,7 @@ public class EmacsContextMenu | |||
| 54 | private class Item implements MenuItem.OnMenuItemClickListener | 55 | private class Item implements MenuItem.OnMenuItemClickListener |
| 55 | { | 56 | { |
| 56 | public int itemID; | 57 | public int itemID; |
| 57 | public String itemName; | 58 | public String itemName, tooltip; |
| 58 | public EmacsContextMenu subMenu; | 59 | public EmacsContextMenu subMenu; |
| 59 | public boolean isEnabled, isCheckable, isChecked; | 60 | public boolean isEnabled, isCheckable, isChecked; |
| 60 | 61 | ||
| @@ -147,7 +148,7 @@ public class EmacsContextMenu | |||
| 147 | item name. */ | 148 | item name. */ |
| 148 | 149 | ||
| 149 | public EmacsContextMenu | 150 | public EmacsContextMenu |
| 150 | addSubmenu (String itemName, String title) | 151 | addSubmenu (String itemName, String title, String tooltip) |
| 151 | { | 152 | { |
| 152 | EmacsContextMenu submenu; | 153 | EmacsContextMenu submenu; |
| 153 | Item item; | 154 | Item item; |
| @@ -155,6 +156,7 @@ public class EmacsContextMenu | |||
| 155 | item = new Item (); | 156 | item = new Item (); |
| 156 | item.itemID = 0; | 157 | item.itemID = 0; |
| 157 | item.itemName = itemName; | 158 | item.itemName = itemName; |
| 159 | item.tooltip = tooltip; | ||
| 158 | item.subMenu = createContextMenu (title); | 160 | item.subMenu = createContextMenu (title); |
| 159 | item.subMenu.parent = this; | 161 | item.subMenu.parent = this; |
| 160 | 162 | ||
| @@ -214,6 +216,13 @@ public class EmacsContextMenu | |||
| 214 | 216 | ||
| 215 | if (item.isChecked) | 217 | if (item.isChecked) |
| 216 | menuItem.setChecked (true); | 218 | menuItem.setChecked (true); |
| 219 | |||
| 220 | /* If the tooltip text is set and the system is new enough | ||
| 221 | to support menu item tooltips, set it on the item. */ | ||
| 222 | |||
| 223 | if (item.tooltip != null | ||
| 224 | && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) | ||
| 225 | menuItem.setTooltipText (item.tooltip); | ||
| 217 | } | 226 | } |
| 218 | } | 227 | } |
| 219 | } | 228 | } |