mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-30 00:51:50 -08:00
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.
This commit is contained in:
parent
8ca4162ecd
commit
77feba7456
3 changed files with 36 additions and 7 deletions
|
|
@ -26,6 +26,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
|
@ -54,7 +55,7 @@ public class EmacsContextMenu
|
|||
private class Item implements MenuItem.OnMenuItemClickListener
|
||||
{
|
||||
public int itemID;
|
||||
public String itemName;
|
||||
public String itemName, tooltip;
|
||||
public EmacsContextMenu subMenu;
|
||||
public boolean isEnabled, isCheckable, isChecked;
|
||||
|
||||
|
|
@ -147,7 +148,7 @@ public class EmacsContextMenu
|
|||
item name. */
|
||||
|
||||
public EmacsContextMenu
|
||||
addSubmenu (String itemName, String title)
|
||||
addSubmenu (String itemName, String title, String tooltip)
|
||||
{
|
||||
EmacsContextMenu submenu;
|
||||
Item item;
|
||||
|
|
@ -155,6 +156,7 @@ public class EmacsContextMenu
|
|||
item = new Item ();
|
||||
item.itemID = 0;
|
||||
item.itemName = itemName;
|
||||
item.tooltip = tooltip;
|
||||
item.subMenu = createContextMenu (title);
|
||||
item.subMenu.parent = this;
|
||||
|
||||
|
|
@ -214,6 +216,13 @@ public class EmacsContextMenu
|
|||
|
||||
if (item.isChecked)
|
||||
menuItem.setChecked (true);
|
||||
|
||||
/* If the tooltip text is set and the system is new enough
|
||||
to support menu item tooltips, set it on the item. */
|
||||
|
||||
if (item.tooltip != null
|
||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
menuItem.setTooltipText (item.tooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue