public class

EventHandler

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

Class Overview

Describe an event handler made of an action, some optional data and possibly a handler to execute after this one. Handlers are chained in a linked list. The last handler in the list has no next. When modifying an EventHandler acquired from getEventHandler(String), you still need to call setEventHandler(String, EventHandler) to save changes.

Summary

Constants
int ADD_ITEM
int APP_DRAWER
int BACK
int CLOSE_ALL_FOLDERS
int CLOSE_TOPMOST_FOLDER
int CUSTOMIZE_CONTAINER
int CUSTOMIZE_ITEM
int CUSTOMIZE_LAUNCHER
int CUSTOMIZE_PAGE This constant is deprecated. use CUSTOMIZE_CONTAINER
int CUSTOM_MENU
int EDIT_LAYOUT
int GO_DESKTOP_POSITION
int GO_HOME
int GO_HOME_ZOOM_TO_ORIGIN
int HIDE_FLOATING_DESKTOP
int ITEM_MENU
int LAUNCHER_MENU
int LAUNCH_APP
int LAUNCH_ITEM
int LAUNCH_SHORTCUT
int MOVE_ITEM
int NEXT_DESKTOP
int NEXT_PAGE This constant is deprecated. use NEXT_DESKTOP
int NOTHING
int OPEN_FOLDER
int OPEN_HIERARCHY_SCREEN
int PREVIOUS_DESKTOP
int PREVIOUS_PAGE This constant is deprecated. use PREVIOUS_DESKTOP
int RESTART
int RUN_SCRIPT
int SEARCH
int SEARCH_APP
int SELECT_DESKTOP_TO_GO_TO
int SELECT_WALLPAPER
int SET_VARIABLE
int SHOW_APP_SHORTCUTS
int SHOW_FLOATING_DESKTOP
int SHOW_HIDE_APP_MENU
int SHOW_HIDE_APP_MENU_STATUS_BAR
int SHOW_HIDE_STATUS_BAR
int SHOW_NOTIFICATIONS
int SWITCH_FULL_SCALE_OR_ORIGIN
int UNLOCK_SCREEN
int UNSET
int USER_MENU
int WALLPAPER_SECONDARY_TAP
int WALLPAPER_TAP
int ZOOM_FULL_SCALE
int ZOOM_TO_ORIGIN
Public Constructors
EventHandler(int action, String data)
EventHandler(int action, String data, EventHandler next)
Public Methods
int getAction()
Return the action to execute.
String getData()
An optional data associated to this handler.
EventHandler getNext()
Return the action to execute after this one.
void setAction(int action)
Replaces the action for this handler.
void setData(String data)
Set optional data for this action.
void setNext(EventHandler next)
Set the next element in the list.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ADD_ITEM

Constant Value: 22 (0x00000016)

public static final int APP_DRAWER

Constant Value: 2 (0x00000002)

public static final int BACK

Constant Value: 36 (0x00000024)

public static final int CLOSE_ALL_FOLDERS

Constant Value: 30 (0x0000001e)

public static final int CLOSE_TOPMOST_FOLDER

Constant Value: 29 (0x0000001d)

public static final int CUSTOMIZE_CONTAINER

Constant Value: 10 (0x0000000a)

public static final int CUSTOMIZE_ITEM

Constant Value: 11 (0x0000000b)

public static final int CUSTOMIZE_LAUNCHER

Constant Value: 9 (0x00000009)

public static final int CUSTOMIZE_PAGE

This constant is deprecated.
use CUSTOMIZE_CONTAINER

Constant Value: 10 (0x0000000a)

public static final int CUSTOM_MENU

Constant Value: 37 (0x00000025)

public static final int EDIT_LAYOUT

Constant Value: 8 (0x00000008)

public static final int GO_DESKTOP_POSITION

Constant Value: 33 (0x00000021)

public static final int GO_HOME

Constant Value: 25 (0x00000019)

public static final int GO_HOME_ZOOM_TO_ORIGIN

Constant Value: 26 (0x0000001a)

public static final int HIDE_FLOATING_DESKTOP

Constant Value: 43 (0x0000002b)

public static final int ITEM_MENU

Constant Value: 12 (0x0000000c)

public static final int LAUNCHER_MENU

Constant Value: 7 (0x00000007)

public static final int LAUNCH_APP

Constant Value: 20 (0x00000014)

public static final int LAUNCH_ITEM

Constant Value: 13 (0x0000000d)

public static final int LAUNCH_SHORTCUT

Constant Value: 23 (0x00000017)

public static final int MOVE_ITEM

Constant Value: 21 (0x00000015)

public static final int NEXT_DESKTOP

Constant Value: 19 (0x00000013)

public static final int NEXT_PAGE

This constant is deprecated.
use NEXT_DESKTOP

Constant Value: 19 (0x00000013)

public static final int NOTHING

Constant Value: 1 (0x00000001)

public static final int OPEN_FOLDER

Constant Value: 32 (0x00000020)

public static final int OPEN_HIERARCHY_SCREEN

Constant Value: 44 (0x0000002c)

public static final int PREVIOUS_DESKTOP

Constant Value: 18 (0x00000012)

public static final int PREVIOUS_PAGE

This constant is deprecated.
use PREVIOUS_DESKTOP

Constant Value: 18 (0x00000012)

public static final int RESTART

Constant Value: 28 (0x0000001c)

public static final int RUN_SCRIPT

Constant Value: 35 (0x00000023)

public static final int SEARCH

Constant Value: 14 (0x0000000e)

public static final int SEARCH_APP

Constant Value: 31 (0x0000001f)

public static final int SELECT_DESKTOP_TO_GO_TO

Constant Value: 27 (0x0000001b)

public static final int SELECT_WALLPAPER

Constant Value: 24 (0x00000018)

public static final int SET_VARIABLE

Constant Value: 41 (0x00000029)

public static final int SHOW_APP_SHORTCUTS

Constant Value: 45 (0x0000002d)

public static final int SHOW_FLOATING_DESKTOP

Constant Value: 42 (0x0000002a)

public static final int SHOW_HIDE_APP_MENU

Constant Value: 15 (0x0000000f)

public static final int SHOW_HIDE_APP_MENU_STATUS_BAR

Constant Value: 16 (0x00000010)

public static final int SHOW_HIDE_STATUS_BAR

Constant Value: 6 (0x00000006)

public static final int SHOW_NOTIFICATIONS

Constant Value: 17 (0x00000011)

public static final int SWITCH_FULL_SCALE_OR_ORIGIN

Constant Value: 5 (0x00000005)

public static final int UNLOCK_SCREEN

Constant Value: 34 (0x00000022)

public static final int UNSET

Constant Value: 0 (0x00000000)

public static final int USER_MENU

Constant Value: 38 (0x00000026)

public static final int WALLPAPER_SECONDARY_TAP

Constant Value: 40 (0x00000028)

public static final int WALLPAPER_TAP

Constant Value: 39 (0x00000027)

public static final int ZOOM_FULL_SCALE

Constant Value: 3 (0x00000003)

public static final int ZOOM_TO_ORIGIN

Constant Value: 4 (0x00000004)

Public Constructors

public EventHandler (int action, String data)

public EventHandler (int action, String data, EventHandler next)

Public Methods

public int getAction ()

Return the action to execute.

Returns
  • one of the possible actions defined by this class

public String getData ()

An optional data associated to this handler. Data can be set for the following actions:

  • LAUNCH_APP/LAUNCH_SHORTCUT: Intent to start, as given by Intent.toUri
  • RUN_SCRIPT: script id (converted to a string, or script id/data (if data are transmitted to the script)
  • OPEN_FOLDER: container identifier (converted to a string). Note that any identifier can be used, but the result of passing a non folder container is undefined (although it may be useful...)
  • GO_DESKTOP_POSITION: same content as the shortcut intent created through the Lightning Desktop position shortcut

Returns
  • can be null

public EventHandler getNext ()

Return the action to execute after this one.

Returns
  • the next event handler, or null if there is no other event handler

public void setAction (int action)

Replaces the action for this handler.

public void setData (String data)

Set optional data for this action.

Parameters
data

public void setNext (EventHandler next)

Set the next element in the list. Warning: the app doesn't check for loops in the linked list (for instance A.next=B and B.next=A), but loops will make the app hang or crash, so be careful when chaining handlers.

Parameters
next the next event handler, use null to terminate the list