Page 1 of 5

Create your own quick setting tile on Lollipop

Posted: 03 Dec 2014 20:29
by Martin
Hi,

While looking for a possibility to switch mobile data on Lollipop without root I stumbled on a way to show your own quick settings tile that allows to execute a flow in Automagic.

:!: Requires root and Lollipop. Maybe it completely messes up the regular quick settings tiles/toggles. I've not checked if it can be completely reverted so it's only something you should do when you have a proper backup and factory reset is an option in the worst case. Use at your own risk etc...

How it looks:
AutomagicQuickSetting.png
AutomagicQuickSetting.png (27.28 KiB) Viewed 34093 times
Here are the two required flows: Flows (imports into flow group Tile)
  1. ShowTile: modifies a system setting to show the default quick settings tiles plus your own tile. The last action in the flow configures the visibility, label and the broadcast intent to send when the tile is pressed.
    :arrow: The action Set System Setting needs to be verified after the import: open the flow ShowTile, edit action Set System Setting and check I have verified the setting, I know what I'm doing
  2. TileFlow: simple flow to execute when the tile is pressed. The broadcast action is defined in flow ShowTile above.
You can remove the system setting with action Execute Root Command: settings delete secure sysui_qs_tiles. It seems that installing the Automagic tile also shows the Cast screen and Hotspot tiles, not sure if the tiles will go away again after the tiles are not used for some time.

Regards,
Martin

Re: Create your own quick setting tile on Lollipop

Posted: 17 Dec 2014 12:18
by cimbrum
Nice! Thanks for sharing!
LE: Just tried it on latest Lollipop 5.0.1 on Nexus 5. "Flows ended with an error". Maybe there's some incompatibilities with the latest Android build.

Re: Create your own quick setting tile on Lollipop

Posted: 18 Dec 2014 19:40
by Martin
Maybe action Set System Setting failed the verification. The action Set System Setting needs to be manually verified first after the flow is imported for security reasons otherwise it will fail with an error.
To do the verification, open the flow ShowTile, edit action Set System Setting and check I have verified the setting, I know what I'm doing and try to execute the flow again. Please send the log to me if the flow still fails (on the flowlist: menu->Manage->Log, menu->Send Log).

Re: Create your own quick setting tile on Lollipop

Posted: 24 Dec 2014 19:58
by jadaag
After reverification of the set system settings working perfect on lollipop 5.0.1
What functions can I give to the quick settings tile??
Thnx

Re: Create your own quick setting tile on Lollipop

Posted: 29 Dec 2014 19:55
by Martin
The tile executes the flow called 'TileFlow' so you can execute every action available in Automagic that you would like to use. For example to turn on/off auto sync, request a manual sync, connect to a specific bluetooth device etc.
The tile can be quite useful because it can be accessed also on the lock screen by swiping down from the top of the screen.

BTW: the last update of Automagic included a new extension that allows to set an arbitrary image in the tile. The image needs to be quite small, otherwise the intent will not work.
To set an image use an action Init Variable Image File, scale down the image with action Modify Image to approximately 300*300 and then replace putInt("iconId", 17301577); with putByteArray("iconBitmap", image_data); in the action Send Broadcast that's used to update the tile.
This mechanism could be useful to switch between two images when you implement a flow that acts like a toggle.

Re: Create your own quick setting tile on Lollipop

Posted: 31 Dec 2014 12:05
by jadaag
Okay thnx for the info.. Appreciate it.

Re: Create your own quick setting tile on Lollipop

Posted: 10 Jan 2015 13:07
by steelersmb
So, just to confirm if I wanted to use an image. I would go and edit the Send Broadcast and under the Extras, I would do "Init Variable Image File, scale down the image with action Modify Image to approximately 300*300 " and then replace putInt("iconId", 17301577); with putByteArray("iconBitmap", image_data).

Thank you.

Re: Create your own quick setting tile on Lollipop

Posted: 12 Jan 2015 20:15
by Martin
Here's an example flow called ShowTile2 that can be used instead of the regular ShowTile flow from before:
ShowTile2

The last action that's used to update the tile now uses the putByteArray-function:

Code: Select all

putBoolean("visible", true);
putString("label", "Automagic");
putString("onClickUri", "intent:#Intent;action=automagic.ACTION_1;end");
//putInt("iconId", 17301577);
putByteArray("iconBitmap", image_data);// <-- important line to add the image to the intent
//putString("iconPackage", "android");

Re: Create your own quick setting tile on Lollipop

Posted: 13 Jan 2015 16:51
by jadaag
Is there a way to get more then one tile with different flows?

Re: Create your own quick setting tile on Lollipop

Posted: 13 Jan 2015 20:50
by Martin
You can add more tiles by editing action Set System Setting to default,intent(automagic.TILE_1),intent(automagic.TILE_2).
The individual tiles can be visually modified by using either automagic.TILE_1 or automagic.TILE_2 in the action field of action Send Broadcast.
To execute another flow you would also have to use a different value for the onClickUri in the extras of the intent, for example ...;action=automagic.ACTION_2;... and also use automagic.ACTION_2 in the trigger of the second flow to execute.