java.lang.Object | ||
↳ | net.pierrox.lightning_launcher.script.api.screen.Screen | |
↳ | net.pierrox.lightning_launcher.script.api.screen.ActivityScreen |
Known Direct Subclasses |
A screen backed with an Android Activity.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ImageBitmap |
cropImage(ImageBitmap image, boolean full_size)
Request the user to select an area in the image.
| ||||||||||
void |
hideActionBar()
Hide the android action bar.
| ||||||||||
int |
pickColor(String title, int color, boolean hasAlpha)
Request the user to pick a color.
| ||||||||||
Image |
pickImage(int maxPixels)
Request the user to pick an image through the Lightning image picker screen.
| ||||||||||
float |
pickNumericValue(String title, float value, String valueType, float min, float max, float interval, String unit)
Request the user to enter a numeric value.
| ||||||||||
void |
showActionBar(Function onCreateOptionsMenu, Function onOptionsItemSelected)
Display the Android action bar.
| ||||||||||
boolean |
startActivityForResult(Intent intent, Script receiver, String token)
Start an activity and handle the result in another script.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
net.pierrox.lightning_launcher.script.api.screen.Screen
| |||||||||||
From class
java.lang.Object
|
Request the user to select an area in the image. Warning: because images need to be persisted to file while cropping, this method may be slow.
image | image to be cropped |
---|---|
full_size | handling big images can be slow or request too much memory, by setting full_size to false this will allow this method to downscale images (approx. the size of the screen) |
Hide the android action bar.
Request the user to pick a color.
title | text displayed at the top of the dialog |
---|---|
color | initial color to display |
hasAlpha | whether to display the transparency slider. It will not enforce a fully opaque color, it only acts on the slider visibility. |
Request the user to pick an image through the Lightning image picker screen. Warning: images returned by this function may be very large, take care at memory use as exceeding limits will make the launcher crash. Use the maxPixels parameter: the image will be scaled by a power of two so that its number of pixels is below or equal. This function supports picking bitmaps and nine patches.
maxPixels | maximum number of pixels in the returned image (width x height), 0 for no limit, 1048576 is one mega pixels (1024 x 1024) |
---|
Image
, or null if the user canceled the operation, or if the image cannot be loaded
Request the user to enter a numeric value. When using the "%" unit, valueType must be set to FLOAT: the dialog will scale a decimal value so that 0.75 is displayed as 75%. Warning: the returned value may be subject to rounding errors.
title | text displayed at the top of the dialog |
---|---|
value | initial value to display |
valueType | either INT or FLOAT. It will default to FLOAT if valueType is not a known value. |
min | minimum value for the slider |
max | maximum value for the slider |
interval | interval between values when sliding |
unit | text to display after the value (for instance "%" or "px"). When using "%" with FLOAT, scale value by 100 |
Display the Android action bar. Supported on Android 5.0+. When used in the app drawer, the android action bar will replace the current action bar. The action bar is not compatible with the system bar overlap option, which will be temporarily disabled. Sample script: http://www.lightninglauncher.com/wiki/doku.php?id=script_action_bar_sample
onCreateOptionsMenu | see https://developer.android.com/reference/android/app/Activity.html#onCreateOptionsMenu(android.view.Menu) |
---|---|
onOptionsItemSelected | see https://developer.android.com/reference/android/app/Activity.html#onOptionsItemSelected(android.view.MenuItem) |
Start an activity and handle the result in another script. This is similar to http://developer.android.com/reference/android/app/Activity.html#onActivityResult%28int,%20int,%20android.content.Intent%29 This call is asynchronous and the script will continue its execution. Once the started activity ends, the "receiver" script is called with the following parameters set:
intent | intent to start the activity |
---|---|
receiver | a script to execute upon activity end |
token | an optional string data that you can transmit to the receiver script |