Android 5.0.2 and New Factory Images For Nexus 7 (Wi-Fi) Available

Android 5.0 is has been publicly available since early November, and the … more

Github Tutorial App Shows You How to Use… Github

Github can get pretty complicated and using it can become quite daunting, especially … more

Google Glass-like Clip-On For Regular Glasses Developed by Sony

For the price of $2,000, a pair of glasses that can run apps, take pictures, … more

Micromax Takes OnePlus to Court! Android Wear Receives Lollipop – XDA TV

Android 5.0 Lollipop is available officially for the Moto 360! … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] Percent and colors

OP error404

22nd January 2014, 10:57 PM   |  #1  
error404's Avatar
OP Senior Member
Thanks Meter: 1,001
 
533 posts
Join Date:Joined: Jan 2011
Donate to Me
More
I have two questions (hope you guys can help me):

1 - Is there a way to hide some numbers? Here's what i want:
$((#usedSD#/#totalSD#)*100)$ = this will give me a percentage of used space in SD card, but i don't want the decimal numbers (23,33 - want to remove the numbers after the comma).

2 - How to apply different colors to a text?
#Battery# < 20 red color
#Battery# < 60 green color
#Battery# > 60 blue color

Sorry for my english and thank you in advance.
22nd January 2014, 11:17 PM   |  #2  
kwerdenker's Avatar
Recognized Themer
Flag Probably the Zooper Forums
Thanks Meter: 2,394
 
1,421 posts
Join Date:Joined: Apr 2010
Donate to Me
More
Quote:
Originally Posted by yudroid

I have two questions (hope you guys can help me):

1 - Is there a way to hide some numbers? Here's what i want:
$((#usedSD#/#totalSD#)*100)$ = this will give me a percentage of used space in SD card, but i don't want the decimal numbers (23,33 - want to remove the numbers after the comma).

2 - How to apply different colors to a text?
#Battery# < 20 red color
#Battery# < 60 green color
#Battery# > 60 blue color

Sorry for my english and thank you in advance.

1. You can use floor() to round numbers to their nearest lower integer or ceil() for the upper variant. Your code should look like this $(floor((#usedSD#/#totalSD#)*100))$
You can find all the available math functions for Zooper here: http://zooper.themerapp.com/support/...th-expressions

2. Advanced Parameters are your friend here. The following code put into the Advanced Parameters of a text module will change the color according to your specifications:
Code:
$#BLEVN#<20?[c]ffff0000[/c]$$#BLEVN#>=20 && #BLEVN#<60?[c]ff00ff00[/c]$$#BLEVN#>=60?[c]ff0000ff[/c]$
The Following 3 Users Say Thank You to kwerdenker For This Useful Post: [ View ]
23rd January 2014, 04:36 PM   |  #3  
Junior Member
Thanks Meter: 0
 
9 posts
Join Date:Joined: Nov 2013
Quote:
Originally Posted by kwerdenker

2. Advanced Parameters are your friend here. The following code put into the Advanced Parameters of a text module will change the color according to your specifications:

Code:
$#BLEVN#<20?[c]ffff0000[/c]$$#BLEVN#>=20 && #BLEVN#<60?[c]ff00ff00[/c]$$#BLEVN#>=60?[c]ff0000ff[/c]$

After put this code I have only this text "ff0000ff" - I do not have battery level....what is wrong ?
23rd January 2014, 04:49 PM   |  #4  
kwerdenker's Avatar
Recognized Themer
Flag Probably the Zooper Forums
Thanks Meter: 2,394
 
1,421 posts
Join Date:Joined: Apr 2010
Donate to Me
More
Quote:
Originally Posted by geeket

After put this code I have only this text "ff0000ff" - I do not have battery level....what is wrong ?

You probably put the code into the text field instead in the Advanced Parameters field. Scroll down to the end of the module options when editing your text module, there you'll find it.

Send from my secret moonbase via space carrier pigeons
The Following User Says Thank You to kwerdenker For This Useful Post: [ View ]
23rd January 2014, 05:12 PM   |  #5  
Junior Member
Thanks Meter: 0
 
9 posts
Join Date:Joined: Nov 2013
Quote:
Originally Posted by kwerdenker

You probably put the code into the text field instead in the Advanced Parameters field. Scroll down to the end of the module options when editing your text module, there you'll find it.

Send from my secret moonbase via space carrier pigeons

OK - I have this but...all should look like this:

+add "text" -> in "edit text" write #BLEV# -> in advaced Parameters write Your code
23rd January 2014, 05:24 PM   |  #6  
kwerdenker's Avatar
Recognized Themer
Flag Probably the Zooper Forums
Thanks Meter: 2,394
 
1,421 posts
Join Date:Joined: Apr 2010
Donate to Me
More
Quote:
Originally Posted by geeket

OK - I have this but...all should look like this:

+add "text" -> in "edit text" write #BLEV# -> in advaced Parameters write Your code

Yes, that should work 😃

Send from my secret moonbase via space carrier pigeons
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes