Android customization – How to use Advanced Parameters in Zooper Widget

June 12, 2014
28 70 3

This is it guys, over the last few weeks we have built a custom control panel widget using Zooper Widget and Tasker, today we add the final touch and learn about Zooper Widget Advanced parameters.

The final touch to our control panel is to manipulate an image in Zooper Widget so that it only appears when you have headphones plugged into your device. This task requires the Tasker code with ZW Variables created last week, head back there to check it all out, if needed, before you continue here today. Head back to our de facto ultimate Zooper Widget design guide for a reminder on how to input an image into your Zooper Widget design. Once you have an image in place, to be used as our ‘headphones in’ icon, you are ready to proceed.

Using Advanced Parameters in Zooper Widget

If you had followed along the instructions from the last two weeks, this is going to be fairly simple. Just make sure you have a Bitmap image setup in your Zooper Widget that will act as your notification icon.

Zooper Widget Tasker Headphones In

Head into the Layout section of your Zooper Widget and tap in to edit your Bitmap image element.

Select Advanced Parameters at the very bottom.

We have options once again, you may use the dropdown selections to build your advanced parameters, or simply type them out. Also, we must choose the best method to hide our Bitmap image element. We could change the X and/or Y Offset values to move the Bitmap way off the screen or we could change the opacity (alpha) value to make it completely transparent. My personal preference is to change the scaling percentage (size) of the Bitmap element to 0, this way I know where it is and it is practically impossible to hit should I decide to give it its own Tap action.

Please note that the folks behind Zooper Widget recommend changing the X or Y Offsets, as moving the element takes less processing time than re-drawing it, as needs to happen when the transparency or size changes.For our application of indicating headphone status, I can accept the fraction of a second delay, if you find the delay unreasonable, try changing the X Offset to 10,000 to make the image ‘disappear.’

My Advanced Parameters string looks like this: $#TZHEADPHONESTATE#=Headphones in?[s]70[/s]:[s]0[/s]$

Let us break that down: The opening and closing “$” indicate that this is what we call an ‘IF’ statement. So, IF the value of our ZW Variable in Tasker, which I called “ZHEADPHONESTATE,” equals the text “Headphones in” ? Then assign our Bitmap to scale 70 : else, assign the bitmap to scale 0. (You will have to play with the scale size for your own design to make the icon fit your control panel.)

Tap OK in the top right of the screen to save changes.

Tap the system back button to return to the Homescreen.

You’ve done it. Like I said, with the previous work in place, Advanced Parameters are pretty easy to implement. Don’t get me wrong, they can be extremely complicated in terms of what you make them do, but the procedure is pretty simple.

A deeper look at Zooper Widget Advanced Parameters

Did you get how the Advanced Parameters worked? As another example, skipping the Tasker integration, you could try having the icon pop up when the battery level goes below 20%. The Advanced Parameters string would look like: $#BLEV#<20?[s]100[/s]:[s]0[/s]$

Note that you can use most typical mathematical operators, such as <  >  =  >=  or  <=. Also, use != for ‘not equal’.

Always keep in mind the format of the IF statement and you’ll never go wrong. In plain english, “IF comparison is true, do this, else do that.” In pseudo code – $Comparison?Do this if True:do that if False$ So, if #BLEV# (battery level) is less than 20, change Bitmap to full size, [s]100[/s], but if battery level is not less than 20, change the Bitmap to size 0, [s]0[/s], since we want the image to only show up when the battery is low.

Zooper Widget Battery Low

I urge you to go ahead and try out the Advanced Parameters for a bunch of other stuff. Try popping up a notification icon when there is an Alarm set, your battery is overheating, your internal storage is getting low, your WiFi speed is unreasonably slow, you have a calendar event within the next hour, a SMS or email has arrived, you missed a call, it’s your mother’s birthday and many, many more.

Taking it to the next level, you would use the Advanced Parameters to rotate a Rect element in order to simulate the hands of an analogue clock. You could even lump a bunch together to change the main image in a widget based on the weather, time of day and your Lat and Long. The sky is the limit, I do hope that you enjoy designing your own widgets.

It took a few weeks, but we have finally worked our way through what was little more than an introduction to Zooper Widget. We’d be happy to see your efforts, hear your outcome stories and more, go ahead and share in the comments below. With the tools in these tutorials, you’ll be able to push forward to build any design with Zooper Widget, and load it with function by linking it to Tasker. If you have any specific request, submit those too, we can hopefully run a tutorial for it one day as well.

Tasker

We briefly stepped into the world of Tasker during the process of building this custom control panel widget, I encourage you to join me next week when we will be going a little deeper into Tasker. As mentioned, we have already covered some of the basics, so we’ll work from there and get right into building our own tools. Buckle in, Zooper Widget is great for design, but Tasker rocks system functionality like no other.

Comments

  • http://www.rebelwithoutaclue.com/ Rebel without a Clue

    I didn’t know changing x/y values takes less cpu than redrawing a bmp. Might consider rewriting some of my widgets :)
    Also was wondering why you solved the size parameter this way. Wouldn’t [s]$#BLEV#<20?100:0$[/s] be shorter and do the same?
    Do you by any chance know if wifisignal and cellsignal use a lot of cpu? Zooper takes a lot more battery drain lately and I don't know if that is the reason or the fact I'm on LTE recently and Zooper can't handle cellsignal on LTE.

    • http://www.androidauthority.com/author/jonathan-feist/ Jonathan Feist

      Thanks Rebel, I’ll admit that it was only very recently that I learned of the CPU usage thing – I have widgets to re-code myself. It is a bit more code, but I wanted to maintain the consistency of using the same full IF string structure for the beginners out there. Future ZW articles will just be recipes, not tutorials, and will have more concise code.

      I haven’t specifically looked into battery use for cell/wifi signal in a long time, based on my findings back then (2011/2012), the widget re-draws every time the signal strength changes and the screen is on, which can be a lot. Screen off, no redraws, no problem. As for working with LTE specifically, as recent as just a couple months ago people over on XDA were having issues getting accurate readings of LTE signal strength, especially from Sprint and AT&T, I couldn’t say if that takes more battery or not. Aside from ZW, LTE does typically use more battery than 3G etc.

      I feel like I just gave you more questions than answers. I found the guys over on the Zooper Widget beta stream on Google+ a big help, the devs usually drop by too. https://plus.google.com/communities/118029856631955840911

      • http://www.rebelwithoutaclue.com/ Rebel without a Clue

        Wow… for testing purposes I removed the widget showing WiFi signal and Cell Signal and cpu usage went from 13 to 3%. Guess I will leave out those two than :)