public class

Event

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

Class Overview

The event gather useful data dealing with the context of the event, such as which item caused the script to be executed, or what was the container at time of the event.

See Also

Summary

Public Methods
Container getContainer()
Returns the container in which the event has been triggered.
String getData()
Optional data that may have passed to this script when run from runScript(String, String).
long getDate()
Date at which the event occurred.
Item getItem()
Access to the item from which this event originates.
Screen getScreen()
Access to the screen from which this event originates.
String getSource()
Return the event source as a string in the enumeration below.
float getTouchScreenX()
X touch position on the screen at time of event.
float getTouchScreenY()
Absolute Y touch position at time of event.
float getTouchX()
Absolute X touch position at time of event.
float getTouchY()
Absolute Y touch position at time of event.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public Container getContainer ()

Returns the container in which the event has been triggered. This can be either a desktop, folder or panel.

Returns
  • can be null if the event is not linked with a container
See Also
  • #getContainerView()

public String getData ()

Optional data that may have passed to this script when run from runScript(String, String).

public long getDate ()

Date at which the event occurred.

Returns
  • number of milliseconds since January 1, 1970 00:00:00.0 UTC.

public Item getItem ()

Access to the item from which this event originates. Typically the item will be the tapped object when launching a script on tap event, but there will be no item when the event is a global one (such as desktop rotated, two finger swipe gestures, etc.).

Returns
  • an item or null if no item was involved in this event

public Screen getScreen ()

Access to the screen from which this event originates. Scripts run in the background are linked to an invisible screen too.

public String getSource ()

Return the event source as a string in the enumeration below. Names starting with "C_" refer to a container, whereas names starting with "I_" are linked with an item. For instance "C_CLICKED" is "container clicked" and "I_CLICKED" is "item clicked".

  • K_HOME
  • K_MENU
  • K_MENU_L
  • K_BACK
  • K_BACK_L
  • K_SEARCH
  • I_CLICK
  • I_LONG_CLICK
  • I_SWIPE_LEFT
  • I_SWIPE_RIGHT
  • I_SWIPE_UP
  • I_SWIPE_DOWN
  • I_TOUCH
  • I_PAUSED
  • I_RESUMED
  • C_LOADED
  • C_RESUMED
  • C_PAUSED
  • C_CLICK
  • C_LONG_CLICK
  • C_DOUBLE_CLICK
  • C_SWIPE_LEFT
  • C_SWIPE_RIGHT
  • C_SWIPE_UP
  • C_SWIPE_DOWN
  • C_SWIPE2_LEFT
  • C_SWIPE2_RIGHT
  • C_SWIPE2_UP
  • C_SWIPE2_DOWN
  • C_POSITION_CHANGED
  • C_ITEM_ADDED
  • C_ITEM_REMOVED
  • MENU_APP
  • MENU_ITEM
  • MENU_CUSTOM
  • STOP_POINT
  • SHORTCUT
  • PORTRAIT
  • LANDSCAPE
  • SCREEN_ON
  • SCREEN_OFF
  • RUN_SCRIPT
  • APK (script loaded and executed from an APK)
  • BACKGROUND (script started in background from another app)
  • STARTUP

public float getTouchScreenX ()

X touch position on the screen at time of event. This data is available when touching the background and is not available when the event result of an item action or when the script is run in background.

Returns
  • x position expressed in screen coordinates.

public float getTouchScreenY ()

Absolute Y touch position at time of event. This data is available when touching the background and is not available when the event result of an item action or when the script is run in background.

Returns
  • y position expressed in screen coordinates.

public float getTouchX ()

Absolute X touch position at time of event. This data is available when touching the background and is not available when the event result of an item action or when the script is run in background.

Returns
  • x position expressed in container coordinates, not in screen coordinates.

public float getTouchY ()

Absolute Y touch position at time of event. This data is available when touching the background and is not available when the event result of an item action or when the script is run in background.

Returns
  • y position expressed in container coordinates, not in screen coordinates.