public class

Shortcut

extends Item
java.lang.Object
   ↳ net.pierrox.lightning_launcher.script.api.Item
     ↳ net.pierrox.lightning_launcher.script.api.Shortcut
Known Direct Subclasses

Class Overview

A shortcut is a label and an icon, tapping on it will usually launch an app. It is used for both so called 'apps' and 'shortcuts' because these two objects are really the same thing (technically)

Summary

Public Methods
Image getCustomIcon()
Retrieve the custom icon file associated with this shortcut.
Image getDefaultIcon()
Retrieve the default icon file associated to this shortcut.
Image getIconLayer(String which)
Retrieve the image currently used in a shortcut icon layer.
Image getImage()
Retrieves the live image for this shortcut as displayed on a given screen This is the image which results in compositing the default or custom icon with various options, such as reflection.
Intent getIntent()
Return the intent associated with this shortcut
String getLabel()
Returns the label of this shortcut.
void launch()
Launch the intent associated with this shortcut.
void setCustomIcon(Image image)
Set a new custom icon for this item.
void setDefaultIcon(Image image)
Set a new icon for this item.
void setIconLayer(Image image, String which, boolean persistent)
Set an icon layer image (background, overlay, mask), persistently.
void setIconLayer(Image image, String which)
Set an icon layer image (background, overlay, mask).
void setImage(Image image)
Replaces the current live image on a given screen.
void setIntent(Intent intent)
Set the intent launched by this shortcut.
void setLabel(String label, boolean persistent)
Set the label of this shortcut, possibly making the change persistent.
void setLabel(String label)
Set the label of this shortcut.
String toString()
[Expand]
Inherited Methods
From class net.pierrox.lightning_launcher.script.api.Item
From class java.lang.Object

Public Methods

public Image getCustomIcon ()

Retrieve the custom icon file associated with this shortcut. The custom icon overrides the default icon but the default icon is kept so that the shortcut can be reverted to its original state.

Returns
  • an icon, or null if no icon is defined

public Image getDefaultIcon ()

Retrieve the default icon file associated to this shortcut. For an app this is the original icon defined by the package.

public Image getIconLayer (String which)

Retrieve the image currently used in a shortcut icon layer. This image can be shared amongst several items.

Parameters
which either "b" for background, "o" for overlay, "m" for mask
Returns
  • an image, or null if there is no image

public Image getImage ()

Retrieves the live image for this shortcut as displayed on a given screen This is the image which results in compositing the default or custom icon with various options, such as reflection. This image is in RAM only.

public Intent getIntent ()

Return the intent associated with this shortcut

public String getLabel ()

Returns the label of this shortcut.

public void launch ()

Launch the intent associated with this shortcut. This generic method does nothing when the script is run in background: in this context an app or shortcut can be launched using LL.getContext().startActivity(item.getIntent)); instead.

public void setCustomIcon (Image image)

Set a new custom icon for this item. Saving animations is experimental.

See Also

public void setDefaultIcon (Image image)

Set a new icon for this item. Saving animations is experimental.

Parameters
image using a null object will delete the icon
See Also

public void setIconLayer (Image image, String which, boolean persistent)

Set an icon layer image (background, overlay, mask), persistently. This method behaves differently according to the persistent parameter. If set to false, the method will behave as #setIconLayer(Image,String), otherwise the modification will be persistent and will only affect this item. Usage of ImageAnimation is currently not supported (only the first frame will be displayed).

Parameters
which either "b" for background, "o" for overlay, "m" for mask
persistent whether to save changes and affect only this item

public void setIconLayer (Image image, String which)

Set an icon layer image (background, overlay, mask). Note: since the image is set on the shortcut configuration, which can be shared by several items, it may be that the modification is visible on other items Usage of ImageAnimation is currently not supported.

Parameters
which either "b" for background, "o" for overlay, "m" for mask

public void setImage (Image image)

Replaces the current live image on a given screen. This is done in RAM only and has no impact on default or custom icons.

public void setIntent (Intent intent)

Set the intent launched by this shortcut.

public void setLabel (String label, boolean persistent)

Set the label of this shortcut, possibly making the change persistent.

Parameters
label new value for the label

public void setLabel (String label)

Set the label of this shortcut. Note that changes will not be persisted, and the item can still be retrieved using its original name. Same as calling

setLabel(label, false);
.

Parameters
label new value for the label

public String toString ()