Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,808,000 Members 50,668 Now Online
XDA Developers Android and Mobile Development Forum

[Q] How to switch widgets on a conditional?

Tip us?
 
silkshadow
Old
#1  
silkshadow's Avatar
Senior Member - OP
Thanks Meter 10
Posts: 160
Join Date: Jun 2007
Default [Q] How to switch widgets on a conditional?

I am using Media Ultilties which gives a 0 or 1 conditional if music is playing or not. What I am trying to do is show a zooper music control widget if music is playing and to show a weather widget in the same place if there is no music playing.

I did see the trick to show the pause button or show the play button using this conditional. However, I am not sure how to apply that to an entire widget. Also, the trick I saw only moves the button off the widget screen (changes the X value to 1000), it doesn't actually hide it. So my questions are:

1) Is there a better command to hide elements on a conditional, or is changing the X value (or y value) the only option?

2) How do I apply this conditional to 2 entire widgets, so one shows if music is playing and the other if music is not playing. I have and know how to use tasker, if that is involved anywhere.

3) If I move an entire widget off the space by changing the X coordinates, does it still consume resources? By that I mean, is the widget still loaded and, for example, would the weather data continue to update?

Thanks!
 
scottx .
Old
#2  
scottx .'s Avatar
Senior Member
Thanks Meter 775
Posts: 2,207
Join Date: Jun 2011
Location: San Antonio, Texas
Quote:
Originally Posted by silkshadow View Post
I am using Media Ultilties which gives a 0 or 1 conditional if music is playing or not. What I am trying to do is show a zooper music control widget if music is playing and to show a weather widget in the same place if there is no music playing.

I did see the trick to show the pause button or show the play button using this conditional. However, I am not sure how to apply that to an entire widget. Also, the trick I saw only moves the button off the widget screen (changes the X value to 1000), it doesn't actually hide it. So my questions are:

1) Is there a better command to hide elements on a conditional, or is changing the X value (or y value) the only option?

2) How do I apply this conditional to 2 entire widgets, so one shows if music is playing and the other if music is not playing. I have and know how to use tasker, if that is involved anywhere.

3) If I move an entire widget off the space by changing the X coordinates, does it still consume resources? By that I mean, is the widget still loaded and, for example, would the weather data continue to update?

Thanks!
Use that same one that you use to show and hide the play/pause button to hide every element you dont want seen or show the ones you do. I've done it and hidden over half of the widget once the music is playing and show the music controls.
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)
The Following User Says Thank You to scottx . For This Useful Post: [ Click to Expand ]
 
silkshadow
Old
#3  
silkshadow's Avatar
Senior Member - OP
Thanks Meter 10
Posts: 160
Join Date: Jun 2007
Totally makes sense, I should've figured on that. Thank you so much for helping me out!
The Following User Says Thank You to silkshadow For This Useful Post: [ Click to Expand ]
 
scottx .
Old
#4  
scottx .'s Avatar
Senior Member
Thanks Meter 775
Posts: 2,207
Join Date: Jun 2011
Location: San Antonio, Texas
Quote:
Originally Posted by silkshadow View Post
Totally makes sense, I should've figured on that. Thank you so much for helping me out!
always use opacity to show and hide if you can.
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)
 
einrae214
Old
#5  
einrae214's Avatar
Senior Member
Thanks Meter 1,272
Posts: 1,133
Join Date: Jan 2011
Location: Columbus, O.H.

 
DONATE TO ME
What is the command line to make the widget relocate when music is playing. ?
You The Realist Person Breathing Only If I Hold My Breath.
 
scottx .
Old
#6  
scottx .'s Avatar
Senior Member
Thanks Meter 775
Posts: 2,207
Join Date: Jun 2011
Location: San Antonio, Texas
Quote:
Originally Posted by einrae214 View Post
What is the command line to make the widget relocate when music is playing. ?
Relocate? How so? Explain what you want to do and maybe I can help.
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


Add the Xperia Z2 Lock Screen to Your Favorite KitKat ROM

Almost every OEM adds its own unique flair to their stock firmwares. While some of … more

Android App Review: Control Your Phone with Quick Control Panel – XDA Developer TV

Your Android smart device has many features that you … more

Play Music on Android Wear with Stellio Music Player

Android Wear smartwatchesare growing inpopularity every day. Some devices have already … more

Schedule is up for xda:devcon ’14

With xda:devcon ’14 just around the corner, and the venue close to selling out, there is a lot … more