Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,784,443 Members 48,858 Now Online
XDA Developers Android and Mobile Development Forum

[Q] zooper widget conditionals and advanced explanation?

Tip us?
 
pbl57lsu
Old
#1  
Junior Member - OP
Thanks Meter 1
Posts: 7
Join Date: Oct 2013
Default [Q] zooper widget conditionals and advanced explanation?

I have been using zooper for over a month now. the conditional advanced formulas make no sense to me. ive tried looking at the formulas for built in widgets such as the clocks to get a better understanding but the numbers for radius and such make no sense to me what so ever. does anyone have a legend breakdown or anything remotely useful for beginners in the advanced stage of zooper?
 
Claribelsmith
Old
#2  
Member
Thanks Meter 2
Posts: 75
Join Date: May 2013
i am out of mind in this ask and coming up to the thread to have any ideas suggesting me best in the issue .. i guess it is going to take some time
 
ack154
Old
#3  
ack154's Avatar
Senior Member
Thanks Meter 35
Posts: 189
Join Date: Oct 2011

 
DONATE TO ME
The only conditional I usually use is when charging my battery. Like right now I have a header for my battery piece that just says "battery" but when it's charging, it says "charging" instead.

So my Conditional formula for that says:

Code:
$#BSTATN#=2?Charging:Battery$
It's kind of like this: $IF?THEN:IFNOT$... so If BSTATN is 2 (charging), then write Charging, if not, write Battery. The original formula for this was an "IF NOT" at first but this is easier for what I want to do.

I haven't gotten into any radius stuff with it though... like I said, this is about the most I do with conditionals... maybe it'll help?
Nexus 5 | Nexus 7

Galaxy S4 GPE
Nexus 4
Galaxy Tab 2 7.0
Galaxy Nexus
Galaxy S2
iPhone 4
iPhone 3GS
The Following 3 Users Say Thank You to ack154 For This Useful Post: [ Click to Expand ]
 
ack154
Old
#4  
ack154's Avatar
Senior Member
Thanks Meter 35
Posts: 189
Join Date: Oct 2011

 
DONATE TO ME
So I think I figured out the clock bit... First thing I found was this. I also added their WallAnalog default template to look at its pieces.

If you look at their example, they have [ar], [as], and [r] for each of the hands.

AR is the Arc Radius... think of this as the center point of whatever rectangle you make for the hand. It is not the center of the circle, but the distance from the center of the clock to the center of your hand.
AS is the Arc Sweep... this tells it what the position of the hand should be based on the time (not really the rotation, but it's point in the circle).
R is the Rotation... this rotation is actually the rotation of your hand as an object. That is, if you make a rectangle for a hand, it has to rotate itself along with the time and AS to look right, otherwise it would just be a level, flat rectangle moving around a circle.

Not sure if that makes any sense, but let's see if I can show what it means.

If you want a simple clock with just 2 hands that tell you the time, here's what you could do:

Minutes Hand:
Size: 5w x 100h
AR: 50
AS/R: $(360/60*#Dm#)$ (this will basically always be this for the minutes - it converts the minutes to a number of degrees within a full circle - 15 min is 90 degrees, 30 min is 180 degrees, etc.

This minute hand would begin at the center of the clock and extend out 100 pixels from there - because the AR number is equal to half of the hand length.

Hour Hand:
Size: 5w x 60h
AR: 30
AS/R: $((#Dh#*60+#Dm#)/2)$ (again, another calculation that will be the same for any hour hand you use, just calculating the # of degrees of a circle for the current hour)

This hand is shorter, but again it extends from the center of the clock outward as the AR is again half of the hand length.

If you want to get a little overlap on the other side of the clock center, you basically make the AR smaller. If you make the minutes hand AR 35 and the hour hand AR 15, you get an overlap on the opposite side of the clock hand of 15 pixels (each AR was reduced by 15).

You can see both examples here. The top is the first one and the bottom is the "overlap" I'm talking about. The hands are the same length in both, but the 15 pixel AR difference shifts the hands inward.



If you want to get crazy, you can add some dots or squares at the end. Again, this is just a matter of getting the rectangle sizes and ARs correct... everything else stays the same. You need to create new rectangles for each of the "dots" at the end of the hands.

If we use the second clock above as the example, maybe we want to put a 5x5 red box at the end of each hand. You need to figure out at what point the hand ends.

So the minute hand is 100 pixels, its center is at an AR of 35, so it extends another 50 pixels past that. So the end of the minute hand is now 85. The hour hand is 60 pixels with an AR of 15. This one goes 30 pixels past the AR for an end point at 45. Now your 5x5 red box needs to be at the end of these. The midpoint of the 5x5 box is at 2.5 pixels. Add this number to the end of the hand distance and you have the AR of the dot. So the minute dot AR is 87.5 and the hour dot is at 47.5. That all make sense?

Plugging in all that with the exact same AS and R values gets you the bottom clock shown here:



Do you follow any of that? I literally just learned this all tonight and it makes sense now. I do have one suggestion though - when you are placing your clock components, Use Center as the Screen Anchor for ALL of the pieces. I seem to get some strange positioning if I try to start from any other anchor point.

PLEASE do ask questions if you have any questions on this.
Nexus 5 | Nexus 7

Galaxy S4 GPE
Nexus 4
Galaxy Tab 2 7.0
Galaxy Nexus
Galaxy S2
iPhone 4
iPhone 3GS
The Following 6 Users Say Thank You to ack154 For This Useful Post: [ Click to Expand ]
 
pbl57lsu
Old
#5  
Junior Member - OP
Thanks Meter 1
Posts: 7
Join Date: Oct 2013
Im going to play with this tomorrow. Ive been slammed at work. This does make a great deal more sense. Thank you very much for the explanation. I just cant read code for these things without understanding what the numbers represent.

Sent from my SM-N900P using xda app-developers app
 
pbl57lsu
Old
#6  
Junior Member - OP
Thanks Meter 1
Posts: 7
Join Date: Oct 2013
My only question really after is what do the $ signs "dm" and all stand for? Thank you this has helped alot.

Sent from my GT-N5110 using xda app-developers app
 
Manu11
Old
#7  
Manu11's Avatar
Junior Member
Thanks Meter 9
Posts: 29
Join Date: Feb 2014
Location: Gandhidham
$ stands for calculation and 'dm' stands for minute and 'dh' stands for hour.
 
scottx .
Old
#8  
scottx .'s Avatar
Senior Member
Thanks Meter 774
Posts: 2,209
Join Date: Jun 2011
Location: San Antonio, Texas
Quote:
Originally Posted by ack154 View Post
So I think I figured out the clock bit... First thing I found was this. I also added their WallAnalog default template to look at its pieces.

If you look at their example, they have [ar], [as], and [r] for each of the hands.

AR is the Arc Radius... think of this as the center point of whatever rectangle you make for the hand. It is not the center of the circle, but the distance from the center of the clock to the center of your hand.
AS is the Arc Sweep... this tells it what the position of the hand should be based on the time (not really the rotation, but it's point in the circle).
R is the Rotation... this rotation is actually the rotation of your hand as an object. That is, if you make a rectangle for a hand, it has to rotate itself along with the time and AS to look right, otherwise it would just be a level, flat rectangle moving around a circle.

Not sure if that makes any sense, but let's see if I can show what it means.

If you want a simple clock with just 2 hands that tell you the time, here's what you could do:

Minutes Hand:
Size: 5w x 100h
AR: 50
AS/R: $(360/60*#Dm#)$ (this will basically always be this for the minutes - it converts the minutes to a number of degrees within a full circle - 15 min is 90 degrees, 30 min is 180 degrees, etc.

This minute hand would begin at the center of the clock and extend out 100 pixels from there - because the AR number is equal to half of the hand length.

Hour Hand:
Size: 5w x 60h
AR: 30
AS/R: $((#Dh#*60+#Dm#)/2)$ (again, another calculation that will be the same for any hour hand you use, just calculating the # of degrees of a circle for the current hour)

This hand is shorter, but again it extends from the center of the clock outward as the AR is again half of the hand length.

If you want to get a little overlap on the other side of the clock center, you basically make the AR smaller. If you make the minutes hand AR 35 and the hour hand AR 15, you get an overlap on the opposite side of the clock hand of 15 pixels (each AR was reduced by 15).

You can see both examples here. The top is the first one and the bottom is the "overlap" I'm talking about. The hands are the same length in both, but the 15 pixel AR difference shifts the hands inward.



If you want to get crazy, you can add some dots or squares at the end. Again, this is just a matter of getting the rectangle sizes and ARs correct... everything else stays the same. You need to create new rectangles for each of the "dots" at the end of the hands.

If we use the second clock above as the example, maybe we want to put a 5x5 red box at the end of each hand. You need to figure out at what point the hand ends.

So the minute hand is 100 pixels, its center is at an AR of 35, so it extends another 50 pixels past that. So the end of the minute hand is now 85. The hour hand is 60 pixels with an AR of 15. This one goes 30 pixels past the AR for an end point at 45. Now your 5x5 red box needs to be at the end of these. The midpoint of the 5x5 box is at 2.5 pixels. Add this number to the end of the hand distance and you have the AR of the dot. So the minute dot AR is 87.5 and the hour dot is at 47.5. That all make sense?

Plugging in all that with the exact same AS and R values gets you the bottom clock shown here:



Do you follow any of that? I literally just learned this all tonight and it makes sense now. I do have one suggestion though - when you are placing your clock components, Use Center as the Screen Anchor for ALL of the pieces. I seem to get some strange positioning if I try to start from any other anchor point.

PLEASE do ask questions if you have any questions on this.
Nice explanation. Thanks for that. I had a few confusion issues on the analogs a month or so ago and used this to help. It helped me create this: https://play.google.com/store/apps/d...skin.analogpro
Google Nexus 5 (16gb, hammerhead (D820(H) (rev_11)))
Google Nexus 4 (16gb, mako (rev_11))
Google Nexus 7 (2013) (16gb, flo)
LG G2 (32gb, D-801)

M. Scott @ Google Play. (Zooper Skins)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes