public class

Menu

extends Object
java.lang.Object
   ↳ net.pierrox.lightning_launcher.script.api.Menu

Class Overview

Provides an access to the popup menu, so that it can be customized.

Summary

Constants
int MODE_APP_SHORTCUTS The app shortcuts menu (Android 7.1+)
int MODE_CONTAINER_CUSTOM Custom container menu (populated with selected script entries)
int MODE_CONTAINER_EM Main container menu in edit mode
int MODE_CONTAINER_NO_EM Main container menu in normal mode (not edit mode)
int MODE_CONTAINER_SUBMENU_ITEMS
int MODE_CONTAINER_SUBMENU_SCRIPTS
int MODE_CONTAINER_SUBMENU_SELECT
int MODE_CONTAINER_SUBMENU_SETTINGS
int MODE_ITEM_CUSTOM Custom item menu (populated with selected script entries)
int MODE_ITEM_EM Main item menu in edit mode
int MODE_ITEM_NO_EM Main item menu in normal mode (not edit mode)
int MODE_ITEM_SUBMENU_ACTION The action sub menu (App info, Play Store, etc.)
int MODE_ITEM_SUBMENU_EDIT The edit sub menu (Select an icon, Edit label, etc.)
int MODE_ITEM_SUBMENU_POSITION The position sub menu (Detach from grid, Pin, etc.)
int MODE_ITEM_SUBMENU_SCRIPTS The scripts sub menu
Public Methods
View addMainItem(String text, Function action)
Add a main item, using the default style
void close()
Request this menu to be closed.
ViewGroup getMainItemsView()
Return the items container, where the main textual buttons can be found
int getMode()
Return the current menu mode.
ViewGroup getRootView()
Return the root view for the menu.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int MODE_APP_SHORTCUTS

The app shortcuts menu (Android 7.1+)

Constant Value: 15 (0x0000000f)

public static final int MODE_CONTAINER_CUSTOM

Custom container menu (populated with selected script entries)

Constant Value: 10 (0x0000000a)

public static final int MODE_CONTAINER_EM

Main container menu in edit mode

Constant Value: 1 (0x00000001)

public static final int MODE_CONTAINER_NO_EM

Main container menu in normal mode (not edit mode)

Constant Value: 13 (0x0000000d)

public static final int MODE_CONTAINER_SUBMENU_ITEMS

Constant Value: 8 (0x00000008)

public static final int MODE_CONTAINER_SUBMENU_SCRIPTS

Constant Value: 9 (0x00000009)

public static final int MODE_CONTAINER_SUBMENU_SELECT

Constant Value: 14 (0x0000000e)

public static final int MODE_CONTAINER_SUBMENU_SETTINGS

Constant Value: 7 (0x00000007)

public static final int MODE_ITEM_CUSTOM

Custom item menu (populated with selected script entries)

Constant Value: 10 (0x0000000a)

public static final int MODE_ITEM_EM

Main item menu in edit mode

Constant Value: 2 (0x00000002)

public static final int MODE_ITEM_NO_EM

Main item menu in normal mode (not edit mode)

Constant Value: 12 (0x0000000c)

public static final int MODE_ITEM_SUBMENU_ACTION

The action sub menu (App info, Play Store, etc.)

Constant Value: 6 (0x00000006)

public static final int MODE_ITEM_SUBMENU_EDIT

The edit sub menu (Select an icon, Edit label, etc.)

Constant Value: 3 (0x00000003)

public static final int MODE_ITEM_SUBMENU_POSITION

The position sub menu (Detach from grid, Pin, etc.)

Constant Value: 4 (0x00000004)

public static final int MODE_ITEM_SUBMENU_SCRIPTS

The scripts sub menu

Constant Value: 9 (0x00000009)

Public Methods

public View addMainItem (String text, Function action)

Add a main item, using the default style

Parameters
text label to be displayed
action called when the item is clicked, this must be a function with a single "view" argument
Returns
  • the view created for the item

public void close ()

Request this menu to be closed. This action is not automatically triggered when an item is clicked, it need to be done manually.

public ViewGroup getMainItemsView ()

Return the items container, where the main textual buttons can be found

public int getMode ()

Return the current menu mode. The mode is one of the constants above and gives a hint on the context for which the menu is displayed

public ViewGroup getRootView ()

Return the root view for the menu. This view includes everything (title, icon buttons, main buttons)