TrianguloY

now browsing by tag

 
 

For me, when a ‘door opens’ and it has a lot of things at the other side, I sometimes get a bit shocked at the…

For me, when a ‘door opens’ and it has a lot of things at the other side, I sometimes get a bit shocked at the beginning, and it takes me time to try and get used to it.

It happened when the ‘Image update’, and specially with the ‘java update’.

Now, thanks mainly to Lukas Morawietz​, but also to the others scripters that published scripts with ‘java code’ I think I can now understand well and make my own ones.

I’m full of new ideas, but with less free time than in the past. So perhaps I will publish some ‘pieces of code’ without a specific use, but that others can use to make a useful script. (I have one to make a notification, another to edit an Intent, another to read the logcat…ask if you are interested)

Enough for now. This post is to share a script, so here it is.

Instructions: set it in the resumed event of an item (use a new shortcut, intent/icon/label will be overwritten)

The script ideally takes the last used app (that is not the launcher) and change the item to be as the app shortcut of that app.

It will take the default icon, no icon packs.

It can be buggy sometimes (I didn’t tested it a lot too), and maybe it throws an error, but I hope not to

The code is a bit messy, and I’m sure it can be improved

It can be modified to show more than one of the recent apps, but it is not implemented. Feel free to do so

Personally I’m using it now in my own screen to change the behavior of the HOME key. It will launch the previous app and the icon is placed under the HOME button (transparent nav bar) [although two more lines of code were necessary]

If you are still undecided to try all this new API features, think as if you can just use almost all android functions, only using the LL.bindClass() where necessary. Also in the java examples where it uses ‘this’ or simply nothing, in most cases you will need LL.getContext()

Thanks again Pierre Hébert​ for this awesome launcher.

]]>

(This seems like a bug, but it is a feature suggestion)

(This seems like a bug, but it is a feature suggestion)

The ‘bounding box’ of a container is not recalculated when moving items from script.

If you move an item from script ‘outside’ of the available pages, you won’t be able to scroll to it until the launcher refresh (open another app, then go back to the launcher). This is more noticeable if you have the ‘fit desktop to items’ active.

This means that the ‘computation’ of the available screen is made from time to time, I guess when the container loads, when you exit edit mode… But not when moving items from script.

Will be possible to add a container.refresh() or similar to manually force this calculation? Is it too cheap to do it every time an item moves (I guess not)?

Or

Is it possible with something currently available?

I found that calling {LL.save();container.getProperties().edit().commit(); } works. But it takes almost a second to refresh the container. ( [!] Something to note: if you don’t call LL.save() before the commit() all the container returns to the previous state. I guess this is the reported and known issue of deleted items that appears again and related)

Second suggestion:

Could be possible to set ‘borders’ in the calculation of the bounding box when the ‘fit desktop to items’ is checked? I mean to add an offset so that you can always scroll a little more than the last item.

I’m suggesting this mainly because I have transparent nav bar, and the items scroll under it. But now the last item is always under the bar, so I can’t click it. I need to manually add an item at the bottom to force it to scroll a bit more.

I know I can automate this from an script, adding automatically an invisible item accordingly. But it seems like a ‘bad’ solution in my opinion. A built in feature will be better.

]]>

This is a behavior of stop points that seems to be wrong.

This is a behavior of stop points that seems to be wrong. It can be an expected feature, but to be honest it seems to not be.

Snapping stop points always acts when you release the finger in a ‘no-fling’ state even when the direction of the scrolling is different to the matching direction.

It is difficult to understand, so here are instructions.

In a desktop where you can scroll in the four directions place a stop point in the right second screen. Enable the snapping. Optionally but better to understand the bug, set it to react to the right side and only to right-to-left direction (and desktop-wide recommended)

If you are in the origin position and scroll up and down, when you release the finger you can:

a) release it while fling: the desktop will continue scrolling up or down a bit and will stop. All ok.

b) release it in a stopped position: if you move the finger up and down, then you stop it, and release it in this ‘stopped’ state, the desktop will scroll to the right: the stop point is acting, and it is supposed to not do it.

[If you need a video tell me]

I guess the bug is because when you release the finger and the launcher search for a snapping stop point, it takes only the current velocity of scrolling, and not the previous one. It is understandable because if you instead scrolled horizontally and released the finger in the stopped state the stop point will need to act, but only if the last previous movement the finger where moving right-to-left. Now it also acts if you scroll a bit to the left, stop the finger and then release the finger.

An even more funny behavior: if you have another stop point at the bottom, both will act scrolling the screen diagonally. If you have another at the left, one of those will act (I think the nearest one)

So, instead of only decide if a snapping stop point need to act or not, instead of decide it only with the current scrolling velocity, you will need to keep a variable with the last non-zero one and use that instead if the current one is zero.

In my opinion.

]]>

Carousel folder

Carousel folder

I had the idea of this one since looong time ago, but I forgot it. At that moment I tried to change the z-position of the items to allow ‘rotate’ the items in the folder preview, but it didn’t worked well.

Now with the ability to draw images it was just so easy 😛 so I made it more configurable.

Instructions: Run this script from a folder item (remember to check ‘item menu’ in the script editor) to:

Change the item folder

Set the script to the swipe directions and tap.

Open the folder.

You can optionally pass data to the script to perform this actions:

Launch the first item displayed: “launch” (by default when tap)

Rotate in one direction: “+” (by default swipe left/down)

Rotate in the other direction: “-” (by default swipe right/up)

There are also some settings in the script to change the maximum number of items to show, the size of them and the margin.

The order of the items is the z-position (the same when going into the hierarchy menu)

Note: folders by default have a custom background, you may want to remove it from the item/icon menu.

Enjoy 😀

]]>

In v10.5b1 there was a specific feature added: “when creating shortcut to scripts, optional data can now be passed…

In v10.5b1 there was a specific feature added: “when creating shortcut to scripts, optional data can now be passed as argument” that has gone unnoticed, and it’s more powerful than it seems. (Mainly because I think almost nobody used it in their scripts)

With this, a script can have custom parameter per item that don’t need to be stored in a tag, or included in the code as config.

However, now that I discovered it and I want to use this feature, it is still hard to use: you can only use it from ‘launch a shortcut, lightning, run script’, if you use the normal ‘run script’ that dialog is not showed [Even thought it is possible: you can set it as a custom EventHandler from a script]

There is another old suggestion: when choosing a script to run, show only the list of scripts, not the whole script editor.

So, Pierre Hébert, my suggestion is:

How difficult will be to have a custom dialog with:

Title: “Choose a script”

Drop down list with the list of scripts (the same one as in the script editor)

The ‘extra data passed, leave blank if not used’ text

A text box where to add the extra data

(Optionally: a checkbox to show/hide that two last items)

A cancel button and a accept button.

This will improve the mentioned feature, and people will understand better how to choose a script (pressing back to accept is, sorry, not obvious :/ )

Note: I know you said you will be busy, but I hope you can add this to the to-do list 🙂 (and I hope this is easy enough to do it at once, but I don’t know)

]]>

I made this one (and modification) due to Pierre’s comment saying Home is no longer related to a house.

I made this one (and modification) due to Pierre’s comment saying Home is no longer related to a house. Well, now in android L it’s related to a circle. (Jacob Barton, I made this before you posted your suggestion, it seems we both thought in the same 😛 )

Sorry for the bad quality.

Yes, I like the detailed red lightning 😉

]]>

Sliding Puzzle

Sliding Puzzle

This script is a little one (not so little now, but it was 😛 ) that converts any shortcut in one of those puzzles where there is a hole and you need to move tiles to make a picture.

Instructions:

– Run the script from the item, if it is the first time it will override the default item with the custom one, otherwise it will recover that saved item.

– Choose the grid size and the color of the piece (hole).

It will automatically set the script to the four swipe directions, swipe from the item and solve the item. Optionally it will disable the tap to launch action.

– At the beginning there is the function that runs when solved, by default it launches the item, you can modify it if prefer.

Note 1: the randomize function is random, it won’t never leave the puzzle resolved, but can leave it with a one-move-to-solve.

Note 2: it uses some bitmap copies, for me it works but maybe it freezes in devices with less memory.

Note 3: I tested it personally in my main screen, and it works well, however I didn’t add checks, so be sure the inputs in the setup are ok. If it crash or makes an error write a comment.

I know it is just another mini-game made with scripts and no really useful, but: you can set it as a lock screen! No need to remember patterns, only resolve a not so easy puzzle. Or set it to protect apps, or even as a way to self control if you don’t want to open an app a lot of times ;D

]]>

API page mistake.

API page mistake.

In propertySet page, under item properties the event handlers start with ‘i.’ (i.swipeUp, nor swipeUp)

http://www.pierrox.net/android/applications/lightning_launcher/script/reference/net/pierrox/lightning_launcher/script/api/PropertySet.html

http://www.pierrox.net/android/applications/lightning_launcher/script/reference/net/pierrox/lightning_launcher/script/api/PropertySet.html
]]>

Question: why this don’t work (as I expect) if the last line is commented?

Question: why this don’t work (as I expect) if the last line is commented? Maybe when you set an icon it is set a copy instead?

var e=LL.getEvent();

var it=e.getItem();

//get default icon

var imagen=it.getDefaultIcon();

var bmp_orig = imagen.getBitmap();

//a copy of the icon

var img = LL.createImage(bmp_orig.getWidth(), bmp_orig.getHeight());

img.draw().drawBitmap(bmp_orig, 0, 0, null);

img.update();

//set custom icon

it.setCustomIcon(img);

//paint bitmap

var bit=img.getBitmap();

bit.eraseColor(0xFFFFFFFF);

//dont work

//paint canvas

img.draw().drawColor(0xFF000000);

//dont work too

//save/update

img.update();

img.save();

//uncomment and it will work

//it.setCustomIcon(img);

]]>

Parallax wallpaper that moves with accelerometer.

Parallax wallpaper that moves with accelerometer.

LLX script.

Join the community to see the whole post: https://plus.google.com/105066926163073195690/posts/XqiqsFmcnDS