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

[Guide] How to center clock and change its color in status bar

OP kmokhtar79

11th March 2013, 05:47 AM   |  #1  
kmokhtar79's Avatar
OP Senior Member
Flag Beijing
Thanks Meter: 5,808
 
2,307 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Credit goes to raubkatze and ebyee for helping me to edit this guide to not overlapping clock with notifications

Here is a guide how to change the status bar clock position to center and change it's color.

Assuming know how to use apk tools use this guide:

Guide:

Center Clock Mod and its Color
1. Decompile SystemUI.apk
2. Search for Systemui/res/layout/tw_status_bar.xml
3. Delete all these lines

Code:
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="0.0dip" android:paddingRight="2.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="horizontal" android:id="@id/left_icons" android:paddingLeft="4.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textSize="15.0dip" android:gravity="center_vertical" android:id="@id/carrierLabel" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <ImageView android:id="@id/operatorLogoIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/tw_stat_notify_operator_logo" />
            <ImageView android:id="@id/doNotDisturbIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_dnd" android:alpha="0.7" android:scaleX="0.85" android:scaleY="0.85" />
            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:id="@id/right_icons" android:paddingRight="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/tw_signal_cluster_view" />
                <TextView android:textSize="12.0dip" android:textColor="#ffa6a6a6" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_network_name_separator" />
                <ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
            <com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ff959595" android:ellipsize="none" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" />
        </LinearLayout>

4. Substitute with the following and save.

Code:
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="1.0dip" android:paddingRight="1.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="horizontal" android:id="@id/left_icons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textSize="15.0dip" android:gravity="center_vertical" android:id="@id/carrierLabel" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <ImageView android:id="@id/operatorLogoIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/tw_stat_notify_operator_logo" />
            <ImageView android:id="@id/doNotDisturbIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_dnd" android:alpha="0.7" android:scaleX="0.85" android:scaleY="0.85" />
            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
        </LinearLayout>
        <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent">
            <com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ffffffff" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
        </LinearLayout>
        <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/right_icons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentRight="true">
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/tw_signal_cluster_view" />
                <TextView android:textSize="12.0dip" android:textColor="#ffa6a6a6" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_network_name_separator" />
                <ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
        </LinearLayout>
5. look on the red part in above lines - this is the color you can set for clock (it is set to white in this case)
6. recompile SystemUI.apk and push to your device

ff defines level of transparency, so do not change it as the clock text won't be clear enough to read.

Put your favorite color code for the XXXXXX value.
Last edited by kmokhtar79; 24th May 2013 at 09:53 AM.
The Following 11 Users Say Thank You to kmokhtar79 For This Useful Post: [ View ]
11th March 2013, 05:48 AM   |  #2  
kmokhtar79's Avatar
OP Senior Member
Flag Beijing
Thanks Meter: 5,808
 
2,307 posts
Join Date:Joined: Aug 2012
Donate to Me
More
reserved
The Following User Says Thank You to kmokhtar79 For This Useful Post: [ View ]
11th March 2013, 05:50 PM   |  #3  
Member
Flag Belgium
Thanks Meter: 8
 
76 posts
Join Date:Joined: Jan 2011
More
Quote:
Originally Posted by kmokhtar79

Here is a guide how to change the status bar clock position to center and change it's color.

Assuming know how to use apk tools use this guide:

Guide:

Center Clock Mod and its Color
Decompile SystemUI.apk
Systemui/res/layout/tw_status_bar.xml

Delete:

Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
Then find this line and create a blank under it:

xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"> What's this?

Copy this line in the gap and save.

Code:
<LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">
	<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:paddingTop="3.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" />
</LinearLayout>
To change the clock color after
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock"
Add

Code:
android:textColor="#ffXXXXXX
ff defines level of transparency, so do not change it as the clock text won't be clear enough to read.

Put your favorite color code for the XXXXXX value.

Hello,

i tested but it didn't work.

i received " stop com.android.systemui" and that's all

Plz help me, if you want of course..
11th March 2013, 06:11 PM   |  #4  
kmokhtar79's Avatar
OP Senior Member
Flag Beijing
Thanks Meter: 5,808
 
2,307 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Re: [Guide] How to center clock and it color in status bar
Quote:
Originally Posted by phil10

Hello,

i tested but it didn't work.

i received " stop com.android.systemui" and that's all

Plz help me, if you want of course..

How did you compile it? Did you delete resource file and modified xml in keeps fold. I am talking about apk multi tools.

Sent from my GT-N7000 using Tapatalk HD
The Following User Says Thank You to kmokhtar79 For This Useful Post: [ View ]
11th March 2013, 07:39 PM   |  #5  
Member
Flag Belgium
Thanks Meter: 8
 
76 posts
Join Date:Joined: Jan 2011
More
Quote:
Originally Posted by kmokhtar79

How did you compile it? Did you delete resource file and modified xml in keeps fold. I am talking about apk multi tools.

Sent from my GT-N7000 using Tapatalk HD

Sorry,

for me, it's not very clear.

what is the file to delete?

yes, i decompiled and compiled too with apkmultitool

and you writed this is : xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"> ok i found, but the probleme is the same, "stop and the same message. Maybe the rom?, my rom is LSZ TEAM Union V.4
Last edited by phil10; 11th March 2013 at 09:54 PM.
12th March 2013, 02:28 AM   |  #6  
kmokhtar79's Avatar
OP Senior Member
Flag Beijing
Thanks Meter: 5,808
 
2,307 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Re: [Guide] How to center clock and it color in status bar
Quote:
Originally Posted by phil10

Sorry,

for me, it's not very clear.

what is the file to delete?

yes, i decompiled and compiled too with apkmultitool

and you writed this is : xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"> ok i found, but the probleme is the same, "stop and the same message. Maybe the rom?, my rom is LSZ TEAM Union V.4

Use this guide

http://forum.xda-developers.com/show...php?p=36388180





Sent from my GT-N7000 using Tapatalk HD
The Following User Says Thank You to kmokhtar79 For This Useful Post: [ View ]
13th March 2013, 10:55 AM   |  #7  
eybee1970's Avatar
Recognized Contributor
Thanks Meter: 13,291
 
4,922 posts
Join Date:Joined: Jan 2010
very useful guide, mate!

maybe some additions you can post in OP:

the line to delete is named as follows:

Code:
<com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ff959595" android:ellipsize="none" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" />
for better understanding with the clock color to add, this is how the line is showing up after adding the color string (I set color to white just as an example):

Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:paddingTop="3.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" android:textColor="#ffffffff" />
EDIT: maybe you can work out how to make the notifications not overlap the center clock, which is quite annoying...I did not manage to work it out for my own 'til now
Last edited by eybee1970; 13th March 2013 at 10:57 AM.
The Following User Says Thank You to eybee1970 For This Useful Post: [ View ]
13th March 2013, 12:09 PM   |  #8  
eybee1970's Avatar
Recognized Contributor
Thanks Meter: 13,291
 
4,922 posts
Join Date:Joined: Jan 2010
ok, I worked out the method for notifications not overlapping Center clock (all credits go to raubkatze for the HowTo)

1. decompile SystemUI.apk
2. open /res/layout/tw_status_bar with Notepad++
3. search for following lines:

Code:
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="0.0dip" android:paddingRight="2.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="horizontal" android:id="@id/left_icons" android:paddingLeft="4.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textSize="15.0dip" android:gravity="center_vertical" android:id="@id/carrierLabel" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <ImageView android:id="@id/operatorLogoIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/tw_stat_notify_operator_logo" />
            <ImageView android:id="@id/doNotDisturbIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_dnd" android:alpha="0.7" android:scaleX="0.85" android:scaleY="0.85" />
            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:id="@id/right_icons" android:paddingRight="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/tw_signal_cluster_view" />
                <TextView android:textSize="12.0dip" android:textColor="#ffa6a6a6" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_network_name_separator" />
                <ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
            <com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ff959595" android:ellipsize="none" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" />
        </LinearLayout>
4. delete all these lines and substitute with the following:

Code:
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="1.0dip" android:paddingRight="1.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="horizontal" android:id="@id/left_icons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textSize="15.0dip" android:gravity="center_vertical" android:id="@id/carrierLabel" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <ImageView android:id="@id/operatorLogoIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/tw_stat_notify_operator_logo" />
            <ImageView android:id="@id/doNotDisturbIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_dnd" android:alpha="0.7" android:scaleX="0.85" android:scaleY="0.85" />
            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
        </LinearLayout>
        <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent">
            <com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ffffffff" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
        </LinearLayout>
        <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/right_icons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentRight="true">
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/tw_signal_cluster_view" />
                <TextView android:textSize="12.0dip" android:textColor="#ffa6a6a6" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_network_name_separator" />
                <ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
        </LinearLayout>
5. look on the red part in above lines - this is the color you can set for clock (it is set to white in this case)
6. save the changes you made to tw_status_bar
7. recompile SystemUI.apk and push to your device
Last edited by eybee1970; 13th March 2013 at 12:30 PM.
The Following 3 Users Say Thank You to eybee1970 For This Useful Post: [ View ]
13th March 2013, 12:18 PM   |  #9  
kmokhtar79's Avatar
OP Senior Member
Flag Beijing
Thanks Meter: 5,808
 
2,307 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Wow! Ebyee Thanks. That is nice edit. Going to mode it for myself
OP updated.
The Following User Says Thank You to kmokhtar79 For This Useful Post: [ View ]
13th March 2013, 12:40 PM   |  #10  
eybee1970's Avatar
Recognized Contributor
Thanks Meter: 13,291
 
4,922 posts
Join Date:Joined: Jan 2010
Quote:
Originally Posted by kmokhtar79

Wow! Ebyee Thanks. That is nice edit. Going to mode it for myself
OP updated.

you should give proper credits to raubkatze in OP - it is his solution, just ported to Note1

The Following 2 Users Say Thank You to eybee1970 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes