5,606,779 Members 38,185 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Colouring a progress bar (many conditions)

Tip us?
 
teteu86
Old
#1  
teteu86's Avatar
Senior Member - OP
Thanks Meter 14
Posts: 157
Join Date: Sep 2012
Default [Q] Colouring a progress bar (many conditions)

Hi. I have the following working code to colour a progress bar:
Code:
[cf]$#BLEVN#<20?ffec1818$$#BLEVN#>=20 && #BLEVN#<50?ffdfec1c$$#BLEVN#>=50?ff36e057$[/cf]
And I am trying to add another condition (priority):

Code:
#BSTATN#=2:ff50e4ff
But I can't put an if inside of another, I've tried many ways (apparently all wrong).

Would you give me a hand?

The objective is: colour if charging. if not charging, colour according to the bat level.
The Following User Says Thank You to teteu86 For This Useful Post: [ Click to Expand ]
 
kwerdenker
Old
#2  
kwerdenker's Avatar
Recognized Themer
Thanks Meter 1569
Posts: 1,238
Join Date: Apr 2010
Location: Probably the Zooper Forums
Quote:
Originally Posted by teteu86 View Post
Hi. I have the following working code to colour a progress bar:
Code:
[cf]$#BLEVN#<20?ffec1818$$#BLEVN#>=20 && #BLEVN#<50?ffdfec1c$$#BLEVN#>=50?ff36e057$[/cf]
And I am trying to add another condition (priority):

Code:
#BSTATN#=2:ff50e4ff
But I can't put an if inside of another, I've tried many ways (apparently all wrong).

Would you give me a hand?

The objective is: colour if charging. if not charging, colour according to the bat level.
I did something similar for another user here. That was about text display but the general idea on how to combine two different conditions is the same. You should be able to adapt the code posted in the linked post to your situation without much of a problem
Mobile: LG Nexus 4 | ROM: Paranoid Android 4.0 + Xposed | Kernel: faux Kernel
Tablet: Asus Nexus 7 (2013) | ROM: Paranoid Android 3+ | Kernel: faux Kernel


The Following User Says Thank You to kwerdenker For This Useful Post: [ Click to Expand ]
 
teteu86
Old
#3  
teteu86's Avatar
Senior Member - OP
Thanks Meter 14
Posts: 157
Join Date: Sep 2012
Quote:
Originally Posted by kwerdenker View Post
I did something similar for another user here. That was about text display but the general idea on how to combine two different conditions is the same. You should be able to adapt the code posted in the linked post to your situation without much of a problem
Thank you. I leave the code in the case someone searches for it.

Code:
[cf]$#BSTATN#=2?ff50e4ff$$#BLEVN#<20 && #BSTATN#!=2?ffec1818$$#BLEVN#>=20 && #BLEVN#<50 && #BSTATN#!=2?ffdfec1c$$#BLEVN#>=50 && #BSTATN#!=2?ff36e057$[/cf]
The Following User Says Thank You to teteu86 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes