diff --git a/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/LL.java b/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/LL.java index bd1f732..32f356a 100644 --- a/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/LL.java +++ b/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/LL.java @@ -13,9 +13,10 @@ import net.pierrox.lightning_launcher.views.ItemLayout; import org.mozilla.javascript.Scriptable; /** - * The main object to access Lightning Launcher features. + * The main object to access Lightning Launcher features. * The LL object gives access to desktops, items or give contextual data on the event. - * @deprecated use {@link Lightning} instead. + * + * @deprecated check alternatives on each function. */ public class LL { private Lightning mLightning; @@ -31,6 +32,9 @@ public class LL { /** * Returns the currently displayed desktop. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getCurrentDesktop()} instead together with {@link Lightning#getActiveScreen()} + *
LL.getCurrentDesktop() -> getActiveScreen().getCurrentDesktop() */ public Desktop getCurrentDesktop() { int id = mLightning.getEngine().readCurrentPage(mLightning.getConfiguration().getHomeDesktopId()); @@ -47,6 +51,10 @@ public class LL { /** * Returns the home desktop. * As of Lightning V14, this method looks for the desktop in the home screen, then in the background desktop. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getContainerById(int)} instead together with {@link Configuration#getHomeDesktopId()} + *
LL.getHomeDesktop() -> getHomeScreen().getContainerById(getConfiguration().getHomeDesktopId()) + * (note: in some rare cases {@link Lightning#getHomeScreen()} may return null. If necessary consider searching on {@link Lightning#getBackgroundScreen()} as an alternative) */ public Desktop getHomeDesktop() { int id = mLightning.getConfiguration().getHomeDesktopId(); @@ -63,6 +71,10 @@ public class LL { /** * Returns the desktop used as the lock screen, or null if not set. * As of Lightning V14, this method looks for the desktop in the lock screen, then in the home screen, and finally in the background desktop. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getContainerById(int)} instead together with {@link Configuration#getLockscreenDesktopId()} + *
LL.getLockscreenDesktop() -> getLockScreen().getContainerById(getConfiguration().getLockscreenDesktopId()) + * (note: in most cases {@link Lightning#getLockScreen()} may return null. If necessary consider searching on {@link Lightning#getHomeScreen()} or {@link Lightning#getBackgroundScreen()} as an alternative) */ public Desktop getLockscreenDesktop() { int id = mLightning.getConfiguration().getLockscreenDesktopId(); @@ -85,6 +97,9 @@ public class LL { /** * Returns the desktop used as the floating desktop, or null if not set. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getContainerById(int)} instead together with {@link Configuration#getFloatingDesktopId()} + *
LL.getFloatingDesktop(); -> getFloatingScreen().getContainerById(getConfiguration().getFloatingDesktopId()) */ public Desktop getFloatingDesktop() { int id = mLightning.getConfiguration().getFloatingDesktopId(); @@ -103,6 +118,10 @@ public class LL { /** * Returns an array of desktop identifiers. + * + * @deprecated use {@link Configuration#getAllDesktops()} instead together with {@link Lightning#getConfiguration()} + * (Difference: returns a java array instead of {@link Array}, convert if necessary) + *
LL.getAllDesktops() ~> getConfiguration().getAllDesktops() */ public Array getAllDesktops() { int[] so = mLightning.getConfiguration().getAllDesktops(); @@ -116,7 +135,9 @@ public class LL { /** * Returns a container by its id. - * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getContainerById(int)} + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getContainerById(int)} instead with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
LL.getContainerById(id) -> getEvent().getScreen().getContainerById(id) */ public Container getContainerById(int id) { Screen screen; @@ -132,10 +153,13 @@ public class LL { } /** - * Returns a desktop by its name, as set in the "Configure desktop" screen. The desktop name can be retrieved using {@link Desktop#getName()}. + * Returns a desktop by its name, as set in the "Configure desktop" screen. The desktop name can be retrieved using {@link Desktop#getName()}. * This method will return null if no desktop by that name can be found * * @param name name of the desktop + * + * @deprecated use {@link HomeScreen#getDesktopByName(String)} instead together with {@link Lightning#getHomeScreen()} + *
LL.getDesktopByName(name) -> getHomeScreen().getDesktopByName(name) */ public Desktop getDesktopByName(String name) { Screen dashboardScreen = LLApp.get().getScreen(ScreenIdentity.HOME); @@ -148,7 +172,11 @@ public class LL { /** * Go to a specified desktop, without changing the current position in this desktop. + * * @param id desktop identifier + * + * @deprecated use {@link HomeScreen#goToDesktop(int)} instead together with {@link Lightning#getHomeScreen()} + *
LL.goToDesktop(id) -> getHomeScreen().goToDesktop(id) */ public void goToDesktop(int id) { LLApp.get().displayPagerPage(id, false); @@ -156,9 +184,13 @@ public class LL { /** * Go to a specified desktop and set the current absolute position in this desktop, setting a scale of 1 and using animations. This method does nothing when the script is run in background. + * * @param id desktop identifier * @param x absolute X position, in pixel * @param y absolute Y position, in pixel + * + * @deprecated use {@link HomeScreen#goToDesktopPosition(int, float, float)} instead together with {@link Lightning#getHomeScreen()} + *
LL.goToDesktopPosition(id, x, y) -> getHomeScreen().goToDesktopPosition(id, x, y) */ public void goToDesktopPosition(int id, float x, float y) { goToDesktopPosition(id, x, y, 1, true); @@ -166,11 +198,15 @@ public class LL { /** * Go to a specified desktop and set the current absolute position in this desktop. This method does nothing when the script is run in background. + * * @param id desktop identifier * @param x absolute X position, in pixel * @param y absolute Y position, in pixel * @param scale zoom factor (1=100%, 0.5=50%, negative values are acceptable, 0 is not very useful) * @param animate whether to animate the move + * + * @deprecated use {@link HomeScreen#goToDesktopPosition(int, float, float, float, boolean)} instead together with {@link Lightning#getHomeScreen()} + *
LL.goToDesktopPosition(id, x, y, scale, animate) -> getHomeScreen().goToDesktopPosition(id, x, y, scale, animate) */ public void goToDesktopPosition(int id, float x, float y, float scale, boolean animate) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getScriptScreen(); @@ -180,7 +216,9 @@ public class LL { /** * Returns the event object associated with this script execution. * The event provides contextual data, such as the current desktop, which item has been tapped, and so on. - * @deprecated use {@link Lightning#getEvent_()} + * + * @deprecated use {@link Lightning#getEvent_()} instead + *
LL.getEvent() -> getEvent() */ public Event getEvent() { return mLightning.findEventInStack(); @@ -190,6 +228,9 @@ public class LL { /** * Same as #runAction(int,String) with a null data. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#runAction(int)} instead together with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
LL.runAction(action) -> getEvent().getScreen().runAction(action) */ public void runAction(int action) { mLightning.getScriptScreen().runAction(action); @@ -197,6 +238,9 @@ public class LL { /** * Same as #runAction(int,Item,String) with a null item and data. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#runAction(int, String)} instead together with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
LL.runAction(action, data) -> getEvent().getScreen().runAction(action, data) */ public void runAction(int action, String data) { mLightning.getScriptScreen().runAction(action, data); @@ -204,9 +248,13 @@ public class LL { /** * Run a Lightning action. This method does nothing when the script is run in background. + * * @param action action code (one of the values defined in {@link net.pierrox.lightning_launcher.script.api.EventHandler} * @param item item to be used as the target (only useful with actions requiring an item) * @param data optional data to send to be used by the action, use null if none + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#runAction(int, Item, String)} instead together with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
LL.runAction(action, item, data) -> getEvent().getScreen().runAction(action, item, data) */ public void runAction(int action, Item item, String data) { mLightning.getScriptScreen().runAction(action, item, data); @@ -215,23 +263,28 @@ public class LL { /** * Run another script. * Optional data can be transmitted to the called script and retrieved using {@link Event#getData()}. + * * @param name name of the script as found in the script editor * @param data optional data to send to the script. Use JSON to pass more than a string. - * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#runScript(String, String)} + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#runScript(String, String)} instead together with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
LL.runScript(name, data) -> getEvent().getScreen().runScript(name, data) */ public void runScript(final String name, final String data) { mLightning.getScriptScreen().runScript(name, data); } /** - * @deprecated use Script#setTag(String) instead together with #getCurrentScript + * @deprecated use {@link Script#setTag(String)} instead together with {@link Lightning#getCurrentScript()} + *
LL.setScriptTag(tag) -> getCurrentScript().setTag(tag) */ public void setScriptTag(String tag) { getCurrentScript().setTag(tag); } /** - * @deprecated use Script#getTag() instead + * @deprecated use {@link Script#getTag()} instead together with {@link Lightning#getCurrentScript()} + *
LL.getScriptTag() -> getCurrentScript().getTag() */ public String getScriptTag() { return getCurrentScript().getTag(); @@ -239,6 +292,9 @@ public class LL { /** * Retrieve the currently executed script. + * + * @deprecated use {@link Lightning#getCurrentScript()} instead + *
LL.getCurrentScript() -> getCurrentScript() */ public Script getCurrentScript() { return mLightning.getCurrentScript(); @@ -246,8 +302,12 @@ public class LL { /** * Retrieve a script by name + * * @param name as given by Script#getName() * @return a script or null if not found + * + * @deprecated use {@link Lightning#getScriptByName(String)} instead + *
LL.getScriptByName(name) -> getScriptByName(name) */ public Script getScriptByName(String name) { return mLightning.getScriptByName(name); @@ -255,8 +315,12 @@ public class LL { /** * Retrieve a script by its unique identifier + * * @param id identifier as given by Script#getId() * @return a script or null if no script with this id + * + * @deprecated use {@link Lightning#getScriptById(String)} instead + *
LL.getScriptById(id) -> getScriptById(id) */ public Script getScriptById(String id) { return mLightning.getScriptById(id); @@ -264,6 +328,9 @@ public class LL { /** * Delete a script. + * + * @deprecated use {@link Lightning#deleteScript(Script)} instead + *
LL.deleteScript(script) -> deleteScript(script) */ public void deleteScript(Script script) { mLightning.deleteScript(script); @@ -271,6 +338,9 @@ public class LL { /** * Create a new script. Use this API wisely. + * + * @deprecated use {@link Lightning#createScript(String, String, int)} instead + *
LL.createScript(name, text, flags) -> createScript(name, text, flags) */ public Script createScript(String name, String text, int flags) { return mLightning.createScript(name, text, flags); @@ -279,6 +349,10 @@ public class LL { /** * Return the collection of scripts matching some flags. * @param flags see Script#FLAG_* + * + * @deprecated use {@link Lightning#getAllScriptMatching(int)} + * (Difference: returns a java array instead of {@link Array}, convert if necessary) + *
LL.getAllScriptMatching(flags) ~> getAllScriptMatching(flags) */ public Array getAllScriptMatching(int flags) { Script[] array = mLightning.getAllScriptMatching(flags); @@ -287,6 +361,9 @@ public class LL { /** * Unlock the screen. + * + * @deprecated use {@link Lightning#unlock()} instead + *
LL.unlock() -> unlock() */ public void unlock() { mLightning.unlock(); @@ -294,16 +371,23 @@ public class LL { /** * Returns true if the screen is currently locked using the Lightning lock screen. + * + * @deprecated use {@link Lightning#isLocked()} instead + *
LL.isLocked() -> isLocked() */ public boolean isLocked() { return mLightning.isLocked(); } /** - * Write data to a file. This is for logging and debug purpose only. The path is not configurable and is: /LightningLauncher/script/log.txt. + * Write data to a file. This is for logging and debug purpose only. The path is not configurable and is: {@literal <}external storage{@literal >}/LightningLauncher/script/log.txt. * Please note that this method won't add newlines automatically when appending data. + * * @param data text to write to the file - * @param append whether to clear the file before to write data, or append data to the existing content + * @param append whether to clear the file before to write data, or append data to the existing content + * + * @deprecated use {@link Lightning#writeToLogFile(String, boolean)} instead + *
LL.writeToLogFile(data, append) -> writeToLogFile(data, append) */ public void writeToLogFile(String data, boolean append) { mLightning.writeToLogFile(data, append); @@ -312,6 +396,10 @@ public class LL { /** * Returns whether the current context is paused. It often means that Lightning Launcher is not displayed, for instance because another app is running. * When the script is executed in the background this method always returns true. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#isPaused()} instead together with {@link Lightning#getHomeScreen()} + * (difference: this function returns false if any screen is not paused, not only the HomeScreen. For an exact substitute check all the other screens too) + *
LL.isPaused(tag) ~> getHomeScreen().isPaused() */ public boolean isPaused() { boolean paused = true; @@ -327,7 +415,12 @@ public class LL { /** * Returns the list of currently open folders. This function returns the opener item, not the container itself. * This method will return null when the script is executed in the background. + * * @return an Array of Folder items, sorted top to bottom (topmost folder is at index 0). + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getOpenFolders()} instead together with {@link Lightning#getActiveScreen()} + * (Difference: returns a java array instead of {@link Array}, convert if necessary) + *
LL.getOpenFolders() ~> getActiveScreen().getOpenFolders() */ public Array getOpenFolders() { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -340,9 +433,12 @@ public class LL { /** * Returns an item by its id. This is a shortcut avoiding to traverse the list of all desktops and folders. + * * @param id item identifier * @return an item, or null if this id is not known. - * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getItemById(int)} + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getItemById(int)} instead together with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
LL.getItemById(id) -> getEvent().getScreen().getItemById(id) */ public Item getItemById(int id) { return mLightning.getScriptScreen().getItemById(id); @@ -351,7 +447,11 @@ public class LL { /** * Create a blank new image of the specified size. Pixel format is always ARGB 8888. * Take care when creating images since it can rapidly exhaust memory and lead to a crash. + * * @return can return null if not enough memory + * + * @deprecated use {@link Image#createImage(int, int)} instead + *
LL.createImage(width, height) -> Image.createImage(width, height) */ public ImageBitmap createImage(int width, int height) { return Image.createImage(width, height); @@ -359,8 +459,12 @@ public class LL { /** * Create an image from the specified file. + * * @param path path of the image * @return can return null if an image cannot be read from the file (not an image or not enough memory) + * + * @deprecated use {@link Image#createImage(String)} instead + *
LL.createImage(path) -> Image.createImage(path) */ public Image createImage(String path) { return Image.createImage(path); @@ -368,11 +472,15 @@ public class LL { /** * Create an image from a package and a resource name. - * For instance:LL.createImage("net.pierrox.lightning_launcher_extreme", "icon") + * For instance: LL.createImage("net.pierrox.lightning_launcher_extreme", "icon") * The density used is either the one given by ActivityManager.getLauncherLargeIconDensity if available, or the current one. + * * @param pkg name of the package, use "android" to access system resources. * @param name name of the drawable resource * @return can return null if an image cannot be read from the package (unknown package, wrong resource name or not enough memory) + * + * @deprecated use {@link Image#createImage(String, String)} instead + *
LL.createImage(pkg, name) -> Image.createImage(pkg, name) */ public Image createImage(String pkg, String name) { return Image.createImage(pkg, name); @@ -386,6 +494,9 @@ public class LL { * @param object the set of functions * @param width the prefered image width, use -1 for as big as possible * @param height the prefered image height, use -1 for as big as possible + * + * @deprecated use {@link Image#createImage(Scriptable, int, int)} instead + *
LL.createImage(object, width, height) -> Image.createImage(object, width, height) */ public ImageScript createImage(Scriptable object, int width, int height) { return Image.createImage(object, width, height); @@ -394,12 +505,16 @@ public class LL { /** * Create a blank animation: frames are created fully transparent and need to be drawn. * Notes: animations created this way are memory expensive and cannot be persisted (yet). This means that Shortcut.setCustomIcon() wont't work, but Shortcut.setImage() will. + * * @param width image width * @param height image height * @param count number of frames to allocate * @param duration default frame duration * @param loopCount initial number of loops to play, use 0 for infinite * @return an animation or null in case of error (most likely out of memory) + * + * @deprecated use {@link Image#createAnimation(int, int, int, int, int)} instead + *
LL.createAnimation(width, height, count, duration, loopCount) -> Image.createImage(width, height, count, duration, loopCount) */ public ImageAnimation createAnimation(int width, int height, int count, int duration, int loopCount) { return Image.createAnimation(width, height, count, duration, loopCount); @@ -412,9 +527,13 @@ public class LL { *
  • load scripts and set them as event handler (useful in script plugins)
  • *
  • load JSON data, such as theme colors, data, etc.
  • * + * * @param pkg package name from which to read resources * @param name name of the raw resource. It must not contain the extension of the raw file, this is the Android identifier. * @return a string or null if the resource cannot be found or read + * + * @deprecated use {@link Lightning#loadRawResource(String, String)} instead + *
    LL.loadRawResources(pkg, name) -> loadRawResources(pkg, name) */ public String loadRawResource(String pkg, String name) { return mLightning.loadRawResource(pkg, name); @@ -422,6 +541,9 @@ public class LL { /** * Persist launcher data now. + * + * @deprecated use {@link Lightning#save()} instead + *
    LL.save() -> save() */ public void save() { mLightning.save(); @@ -432,8 +554,12 @@ public class LL { * Example:
          * var intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.pierrox.net/")
          * LL.startActivity(intent);
    + * * @param intent intent to start the activity * @return true if launch is successful, false if activity not found or permission denied + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#startActivity(Intent)} instead together with {@link Lightning#getActiveScreen()} + *
    LL.startActivity(intent) -> getActiveScreen().startActivity(intent) */ public boolean startActivity(Intent intent) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -449,10 +575,14 @@ public class LL { *
  • token: String, optional value passed as third argument in startActivityForResult
  • * * This method cannot be called when the executing script is run in the background. In that case it will do nothing and return false + * * @param intent intent to start the activity * @param receiver a script to execute upon activity end * @param token an optional string data that you can transmit to the receiver script * @return true if the activity has been started + * + * @deprecated use {@link ActivityScreen#startActivityForResult(Intent, Script, String)} instead together with an {@link ActivityScreen} + *
    LL.startActivityForResult(intent, receiver, token) -> 'startActivityForResult' in getActiveScreen() ? getActiveScreen().startActivityForResult(intent, receiver, token) : false */ public boolean startActivityForResult(Intent intent, Script receiver, String token) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -465,9 +595,13 @@ public class LL { /** * Send a tasker intent, optionally waiting for its completion to return. + * * @param intent an intent built with TaskerIntent (see http://tasker.dinglisch.net/invoketasks.html for samples) * @param synchronous when true, Lightning will wait for Tasker task completion before to return, otherwise it will return immediately * @return when synchronous is true returns true if the intent has been sent successfully and Tasker reports a success too, when synchronous is false this method always returns true.. + * + * @deprecated use {@link Lightning#sendTaskerIntent(TaskerIntent, boolean)} instead + *
    LL.sendTaskerIntent(intent, synchronous) -> sendTaskerIntent(intent, synchronous) */ public boolean sendTaskerIntent(TaskerIntent intent, boolean synchronous) { return mLightning.sendTaskerIntent(intent, synchronous); @@ -476,6 +610,9 @@ public class LL { /** * Return the Android Context this script is linked with (an activity context). * This is meant to be used with Android services. + * + * @deprecated use {@link net.pierrox.lightning_launcher.script.api.screen.Screen#getContext()} instead with a {@link net.pierrox.lightning_launcher.script.api.screen.Screen} + *
    LL.getContext() -> getActiveScreen().getContext() */ public Context getContext() { Screen screen = LLApp.get().getActiveScreen(); @@ -489,8 +626,12 @@ public class LL { /** * Translate a Java class into a JavaScript object. * This is a convenience method that avoid repeated use of fully qualified names while scripting Java. + * * @param name fully qualified class name * @return true if the operation succeeded, false if the class cannot be loaded or if already bound + * + * @deprecated use {@link Lightning#bindClass(String)} instead + *
    LL.bindClass(name) -> bindClass(name) */ public boolean bindClass(String name) { return mLightning.getEngine().getScriptExecutor().bindClass(name); @@ -498,10 +639,14 @@ public class LL { /** * Request the user to pick a color. + * * @param title text displayed at the top of the dialog * @param color initial color to display * @param hasAlpha whether to display the transparency slider. It will not enforce a fully opaque color, it only acts on the slider visibility. * @return either the selected color, or undefined if the dialog has been canceled + * + * @deprecated use {@link ActivityScreen#pickColor(String, int, boolean)} instead together with an {@link ActivityScreen} + *
    LL.pickColor(title, color, hasAlpha) -> 'pickColor' in getActiveScreen() ? getActiveScreen().pickColor(title, color, hasAlpha) : 0 */ public int pickColor(String title, int color, boolean hasAlpha) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -516,6 +661,7 @@ public class LL { * 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. + * * @param title text displayed at the top of the dialog * @param value initial value to display * @param valueType either INT or FLOAT. It will default to FLOAT if valueType is not a known value. @@ -524,6 +670,9 @@ public class LL { * @param interval interval between values when sliding * @param unit text to display after the value (for instance "%" or "px"). When using "%" with FLOAT, scale value by 100 * @return either the selected value, or undefined if the dialog has been canceled + * + * @deprecated use {@link ActivityScreen#pickNumericValue(String, float, String, float, float, float, String)} instead together with an {@link ActivityScreen} + *
    LL.pickNumericValue(title, value, valueType, min, max, interval, unit) -> 'pickNumericValue' in getActiveScreen() ? getActiveScreen().pickNumericValue(title, value, valueType, min, max, interval, unit) : 0 */ public float pickNumericValue(String title, float value, String valueType, float min, float max, float interval, String unit) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -539,8 +688,12 @@ public class LL { * 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. + * * @param maxPixels maximum number of pixels in the returned image (width x height), 0 for no limit, 1048576 is one mega pixels (1024 x 1024) * @return an {@link net.pierrox.lightning_launcher.script.api.Image}, or null if the user canceled the operation, or if the image cannot be loaded + * + * @deprecated use {@link ActivityScreen#pickImage(int)} instead together with an {@link ActivityScreen} + *
    LL.pickImage(maxPixels) -> 'pickImage' in getActiveScreen() ? getActiveScreen().pickImage(maxPixels) : null */ public Image pickImage(int maxPixels) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -554,9 +707,13 @@ public class LL { /** * 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. + * * @param image image to be cropped * @param 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) * @return a cropped image, or null if the operation failed or the user canceled it + * + * @deprecated use {@link ActivityScreen#cropImage(ImageBitmap, boolean)} instead together with an {@link ActivityScreen} + *
    LL.cropImage(image, full_size) -> 'cropImage' in getActiveScreen() ? getActiveScreen().cropImage(image, full_size) : null */ public ImageBitmap cropImage(ImageBitmap image, boolean full_size) { net.pierrox.lightning_launcher.script.api.screen.Screen screen = mLightning.getActiveScreen(); @@ -569,6 +726,9 @@ public class LL { /** * Set a boolean variable. This is a shortcut for LL.getVariables().edit().setBoolean(name, value).commit();. When modifying several at once, consider using the {@link net.pierrox.lightning_launcher.script.api.PropertyEditor} object instead for best efficiency. + * + * @deprecated use {@link Lightning#setVariableBoolean(String, boolean)} instead + *
    LL.setVariableBoolean(name, value) -> setVariableBoolean(name, value) */ public void setVariableBoolean(String name, boolean value) { mLightning.setVariableBoolean(name, value); @@ -576,6 +736,9 @@ public class LL { /** * Set a boolean variable. This is a shortcut for LL.getVariables().edit().setInteger(name, value).commit();. When modifying several at once, consider using the {@link net.pierrox.lightning_launcher.script.api.PropertyEditor} object instead for best efficiency. + * + * @deprecated use {@link Lightning#setVariableInteger(String, long)} instead + *
    LL.setVariableInteger(name, value) -> setVariableInteger(name, value) */ public void setVariableInteger(String name, long value) { mLightning.setVariableInteger(name, (int)value); @@ -583,6 +746,9 @@ public class LL { /** * Set a boolean variable. This is a shortcut for LL.getVariables().edit().setFloat(name, value).commit();. When modifying several at once, consider using the {@link net.pierrox.lightning_launcher.script.api.PropertyEditor} object instead for best efficiency. + * + * @deprecated use {@link Lightning#setVariableFloat(String, float)} instead + *
    LL.setVariableFloat(name, value) -> setVariableFloat(name, value) */ public void setVariableFloat(String name, float value) { mLightning.setVariableFloat(name, value); @@ -590,6 +756,9 @@ public class LL { /** * Set a string variable. This is a shortcut for LL.getVariables().edit().setString(name, value).commit();. When modifying several at once, consider using the {@link net.pierrox.lightning_launcher.script.api.PropertyEditor} object instead for best efficiency. + * + * @deprecated use {@link Lightning#setVariableString(String, String)} instead + *
    LL.setVariableString(name, value) -> setVariableString(name, value) */ public void setVariableString(String name, String value) { mLightning.setVariableString(name, value); @@ -597,6 +766,9 @@ public class LL { /** * Retrieve the whole set of known variables (builtins and user ones). + * + * @deprecated use {@link Lightning#getVariables()} instead + *
    LL.getVariables() -> getVariables() */ public VariableSet getVariables() { return mLightning.getVariables(); diff --git a/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/Lightning.java b/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/Lightning.java index 390906c..b66a578 100644 --- a/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/Lightning.java +++ b/app/llx/core/src/main/java/net/pierrox/lightning_launcher/script/api/Lightning.java @@ -314,7 +314,7 @@ public class Lightning { * Return the lock screen, null if not created yet */ public ActivityScreen getLockScreen() { - return (HomeScreen) createScreen(LLApp.get().getScreen(net.pierrox.lightning_launcher.api.ScreenIdentity.LOCK)); + return (ActivityScreen) createScreen(LLApp.get().getScreen(net.pierrox.lightning_launcher.api.ScreenIdentity.LOCK)); } /** @@ -339,7 +339,9 @@ public class Lightning { } public Screen createScreen(net.pierrox.lightning_launcher.engine.Screen screen) { - if(screen.getIdentity() == net.pierrox.lightning_launcher.api.ScreenIdentity.HOME) { + if(screen == null){ + return null; + } else if(screen.getIdentity() == net.pierrox.lightning_launcher.engine.ScreenIdentity.HOME) { return new HomeScreen(this, screen); } else if(screen.getContext() instanceof Activity) { return new ActivityScreen(this, screen);