Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,807,128 Members 41,208 Now Online
XDA Developers Android and Mobile Development Forum

Guide/tutorial-statusbar clock-add seconds,day of week,date-full customiztion options

Tip us?
 
rastigo
Old
(Last edited by rastigo; 1st September 2014 at 05:38 AM.)
#1  
rastigo's Avatar
Senior Member - OP
Thanks Meter 730
Posts: 827
Join Date: Apr 2013
Location: Pune
Clock Guide/tutorial-statusbar clock-add seconds,day of week,date-full customiztion options

This guide will help you in customizing the statusbar clock and play with it a bit. This mod requires a deodexed LGSystemUI.apk. It took me about a month to cook this mod.This guide couldnt have been possible without @Ticklefish , so I thank him for his terrific knowledge and his willingness to help others.

Special thanks to @Spannaa for his guide based on which this one was made...Truly awesome both @Spannaa and @Ticklefish

Basically an inbuilt android function called "TEXTCLOCK" is used in the mod to display clock in html code


You need to have knowledge of compiling and decompiling ...Tools recommended:
Apktool 1.5.2 (coz it handles smali files perfectly, although we don't touch any of them in this mod)
Notepad++

Remember the variable used should be in format like :
Quote:
<b>...</b> ..................................makes the the enclosed text bold
<i>...</i>...................................makes the the enclosed text italic
<font size=xx>...</font>............sets the font size of the enclosed text to X.0dip
<font fgcolor ="#ffffffff">...</>........sets the foreground colour of the enclosed text
<font bgcolor ="#ff000000">...</>... .sets the background colour of the enclosed text
fgcolor and bgcolor set the foreground and background color. Note that these attributes should be in hexcode like “#ff00ff00”.
<u>...</u>.... Underlines the text
<strike>...</strike>.... creates a strikethrough

There are lots of options for customizations available. You can change the strings above using any of the following.


Quote:
d.............Day Of Month " 1"
dd.......... Day Of Month adds Zero before,"01"
EEEE......Day Of Week "Tuesday"
EEE........Week Day short "Tue"
MMMM....Month "SEPTEMBER"
MMM.......Month short "SEP"
MM..........Month adds zero before "09"
M............Month "9"
yyyy........Year "2014"
yy............Year Short "14"
h..............Hour 12 hour, 5
hh............Hour adds zero before "08"
H.............Hour 24 hour 5pm="5/17"
HH...........Hour 24 hour add zero before ie. 5am = "05"
In some ROMs if "HH" won't work replace the same with "kk" instead of "HH"
m.............Minute 5 min="5"
mm..........Minute add zero before 5min ="05"
s..............Second 7secs ="7"
ss............Second add zero before 7sec="07"
a..............AM/PM
Step 1
Decompile your LGSystemUI.apk. Edit /res/layout/statusbar.xml and find the line:

HTML Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textSize="18.0dip" android:textColor="#ffffffff" android:gravity="center" android:id="@id/clock" android:paddingBottom="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
V.Imp: Do not delete this line...Just hide the clock by adding "andoid:visibility="gone""
Change it to

HTML Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textSize="18.0dip" android:visibility="gone" android:textColor="#ffffffff" android:gravity="center" android:id="@id/clock" android:paddingBottom="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />

Step 2

Just below that line add the following code:


HTML Code:
<TextClock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:format12Hour="@string/status_bar_clock_12hr_format" android:format24Hour="@string/status_bar_clock_24hr_format" />


VVV IMP: The above line must be below the stock clock code or the statusbar will crash

Step 3

Open /res/values/strings and add the following strings at the end.


HTML Code:
<string name="status_bar_clock_12hr_format"><font size="13">EEE, </font>h:mm<font size="10"> a</font></string>
<string name="status_bar_clock_24hr_format"><font size="13">EEE, </font>HH:mm</string>


You can change this to what is mentioned before with your choice of clock format

Step 4
Open/res/values/styles and find


HTML Code:
<style name="TextAppearance.StatusBar.Clock" parent="@*android:style/TextAppearance.StatusBar.Icon">
        <item name="android:textSize">18.0dip</item>
        <item name="android:textStyle">normal</item>
        <item name="android:textColor">#ffffffff</item>
Here you can customize size.bold,colour of the clock

Step 5
Recompile your LGSystemUI.apk.
Copy meta_inf folder and AndroidManifest.xml from original file to recompiled file.
Rename the recompiled file as LGSystemUI.apk
Push to /system/priv-app with 644 permissions.
Reboot and enjoy the mod.

For eg. my strings read as follows:


HTML Code:
<string name="status_bar_clock_12hr_format"><font size="13">EEE, </font>h:mm:ss<font size="10"> a</font></string>
<string name="status_bar_clock_24hr_format"><font size="13">EEE, </font>HH:mm:ss</string>
Output of which is as under:

Click image for larger version

Name:	screenshot.png
Views:	311
Size:	32.7 KB
ID:	2919792


For those who arent profoud with compile/decompile...I am posting a G2 STOCK KK LGSystemUI.apk for download. It has

-Short day of the week.
-Clock with seconds
-Small am/pm
SCRRENSHOT:Click image for larger version

Name:	screenshota.png
Views:	321
Size:	35.3 KB
ID:	2919858
Rename to LGSystemUI.apk and push to /system/priv-app with 644 permissions and delete the LGSystemUI.odex file.

Stock G2 KK Download





You have to play around a bit with the strings added to strings.xml in order to figure out your desired result





A lot of hardwork went into making this guide so please show appreciation by pressing thanks button. Please also give credit if youve used this in your MODS/ROM
The Following 10 Users Say Thank You to rastigo For This Useful Post: [ Click to Expand ]
 
glfsd
Old
#2  
glfsd's Avatar
Senior Member
Thanks Meter 70
Posts: 120
Join Date: Jul 2011
thanks rastigo.
a clarification, if "HH" does not work, replace with "kk"
The Following User Says Thank You to glfsd For This Useful Post: [ Click to Expand ]
 
TyJones916
Old
#3  
TyJones916's Avatar
Member
Thanks Meter 19
Posts: 95
Join Date: Mar 2012
Location: Sac-Town
Very helpful!! Thanks!!
 
leonevo
Old
#4  
leonevo's Avatar
Junior Member
Thanks Meter 16
Posts: 21
Join Date: Dec 2010
Location: Salamanca
Thanks mate!!!
Great job
 
XxZombiePikachu
Old
#5  
XxZombiePikachu's Avatar
Recognized Contributor
Thanks Meter 1,423
Posts: 2,516
Join Date: Jul 2013
Location: Aguada
So I am finally testing this but have fun into an issue not sure what could have gone wrong, systemui is deodexed and the strings are there but 24 hour clock looks like this
 


And 12 hour clock same but last number changes
 



Any ideas @rastigo

XXZOMBIEPIKACHU WAS HERE
The Following User Says Thank You to XxZombiePikachu For This Useful Post: [ Click to Expand ]
 
rastigo
Old
(Last edited by rastigo; 6th September 2014 at 02:36 PM.)
#6  
rastigo's Avatar
Senior Member - OP
Thanks Meter 730
Posts: 827
Join Date: Apr 2013
Location: Pune
Share your strings.xml and statusbar.xml i will look and revert
The Following User Says Thank You to rastigo For This Useful Post: [ Click to Expand ]
 
XxZombiePikachu
Old
#7  
XxZombiePikachu's Avatar
Recognized Contributor
Thanks Meter 1,423
Posts: 2,516
Join Date: Jul 2013
Location: Aguada
Quote:
Originally Posted by rastigo View Post
Share your strings.xml and statusbar.xml i will look and revert
It's okay I figured out what I was doing wrong, I was using textclock styles but had forgotten to install modded systemui with the strings for textclock added
 



XXZOMBIEPIKACHU WAS HERE
The Following 2 Users Say Thank You to XxZombiePikachu For This Useful Post: [ Click to Expand ]
 
rastigo
Old
#8  
rastigo's Avatar
Senior Member - OP
Thanks Meter 730
Posts: 827
Join Date: Apr 2013
Location: Pune
Yeah, possibilities are endless
Attached Images
File Type: jpg 1410014953685.jpg - [Click for QR Code] (47.7 KB, 112 views)
The Following 2 Users Say Thank You to rastigo For This Useful Post: [ Click to Expand ]
 
XxZombiePikachu
Old
#9  
XxZombiePikachu's Avatar
Recognized Contributor
Thanks Meter 1,423
Posts: 2,516
Join Date: Jul 2013
Location: Aguada
Quote:
Originally Posted by rastigo View Post
Yeah, possibilities are endless
so how did you get the clock and separate date? do you still apply visibility gone to the clock and use two textclock(one on left and one on right? or do you leave clock on right and remove it from the 12/24 hour format strings/place textclock on the left?
The Following User Says Thank You to XxZombiePikachu For This Useful Post: [ Click to Expand ]
 
rastigo
Old
(Last edited by rastigo; 7th September 2014 at 05:53 PM.)
#10  
rastigo's Avatar
Senior Member - OP
Thanks Meter 730
Posts: 827
Join Date: Apr 2013
Location: Pune
Quote:
Originally Posted by XxZombiePikachu View Post
so how did you get the clock and separate date? do you still apply visibility gone to the clock and use two textclock(one on left and one on right? or do you leave clock on right and remove it from the 12/24 hour format strings/place textclock on the left?
You leave the original clock line untouched. Just remember to add the same clock line above textclock with visibility gone. Or systemui will crash. That way you have clock and the textclock with your string both. Remember to add the exact same clock line with visibility gone before each textclock.... Like i said possibilities are limitless

The Following User Says Thank You to rastigo For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes