Or Continue to Thread: Guide/tutorial-statusbar clock…
Find Your Device:
31st August 2014, 10:25 PM   |  #1  
rastigo's Avatar
OP Senior Member
Flag Pune
Thanks Meter: 1,214
 
891 posts
Join Date:Joined: Apr 2013
More
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:	479
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:	484
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
Last edited by rastigo; 1st September 2014 at 06:38 AM.
The Following 14 Users Say Thank You to rastigo For This Useful Post: [ View ]