[TUT] How To Center The Clock On The Statusbar..And Other XML Mods As Well!

Status
Not open for further replies.

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
@both of you: which one I should follow?? :crying:
or I could combine both of your tuts on single xml??

I want to say mine, but serajr's xml is actually better. Grr... ;)

Don't combine the code, that will just cause huge problems and won't work at all. It's worth having a look at what all this code actually does. If you know what these lines mean, then you can start doing lots of fun things to your phone yourself.
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
@Ticklefish

Can you move the signal bar to the left side of statusbar?

I tried this http://forum.xda-developers.com/showthread.php?t=1361715 but when I open the arrays.xml , in the item, I didn't see like the tutorial shown, just found some number in the <item></item>

*Sorry for my bad english

Yes, you can. And very easily too, if you're on ICS. Can you share your status_bar.xml please? Then I can show you how?
 
Last edited:

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
@Ticklefish

Can you move the signal bar to the left side of statusbar?

I tried this http://forum.xda-developers.com/showthread.php?t=1361715 but when I open the arrays.xml , in the item, I didn't see like the tutorial shown, just found some number in the <item></item>

*Sorry for my bad english
Yes, you can. And very easily too, if you're on ICS. Can you share your status_bar.xml please? Then I can show you how?

Whoops...duplicate post!!
 
  • Like
Reactions: billy.bong

billy.bong

Senior Member
Jul 15, 2012
86
38
0
Cimahi, Bandung
Yes, you can. And very easily too, if you're on ICS. Can you share your status_bar.xml please? Then I can show you how?

Whoops...duplicate post!!
Yap, the status_bar.xml in my attachment.
Just remove the .doc extension.
Thank you very much, mate :good::cyclops:

FYI the status_bar.xm I uploaded was decompiled from MIUI system ui. :D
 

Attachments

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Yap, the status_bar.xml in my attachment.
Just remove the .doc extension.
Thank you very much, mate :good::cyclops:

FYI the status_bar.xm I uploaded was decompiled from MIUI system ui. :D
Well, I'm not on MIUI but the basics are still the same. In theory.

This code here should put your signal icon to the left of the carrier label in the statusbar. Try it out and if it doesn't work, please provide a screenshot so I can see what it's doing.

Code:
  <?xml version="1.0" encoding="utf-8" ?> 
  <com.android.systemui.statusbar.phone.PhoneStatusBarView android:background="@drawable/status_bar_background" android:focusable="true" android:descendantFocusability="afterDescendants" xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]" xmlns:systemui="[URL]http://schemas.android.com/apk/res/com.android.systemui[/URL]">
 <com.android.systemui.TorchServiceView android:layout_gravity="top|left|center" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:foreground="#ff000000" /> 
 <com.android.systemui.statusbar.phone.BatteryIndicator android:layout_gravity="top" android:id="@id/battery_indicator" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/battery_indicator" android:scaleType="fitXY" /> 
 <com.android.systemui.statusbar.phone.BatteryIndicatorCharging android:layout_gravity="top|right|center" android:id="@id/battery_indicator_charging" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/battery_indicator_charging" /> 
 <LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="6.0dip" android:paddingRight="6.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
 <LinearLayout android:paddingRight="6.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
  <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" /> 
  <com.android.systemui.statusbar.phone.CarrierLabel android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/carrier" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> 
  <LinearLayout android:id="@id/notification_icon_cluster" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
   <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="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" /> 
  </LinearLayout>
 </LinearLayout>
 <com.android.systemui.statusbar.NetworkSpeedView android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/network_speed_view" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6.0dip" /> 
 <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: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/signal_cluster_view" />  -->
   <com.android.systemui.statusbar.phone.BatteryStatusIconView android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
  </LinearLayout>
  <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/clock" android:paddingTop="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> 
 </LinearLayout>
 <LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
  <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginRight="4.0dip">
   <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="centerInside" /> 
   <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="centerInside" /> 
  </ImageSwitcher>
  <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:paddingRight="10.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
   <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" /> 
   <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" /> 
  </com.android.systemui.statusbar.phone.TickerView>
 </LinearLayout>
 <LinearLayout android:gravity="center" android:id="@id/returnToIncallScreen" android:background="@drawable/status_bar_green_bar_bg" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
  <ImageView android:id="@id/callStateIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/status_bar_ic_return_to_incall_screen_normal" /> 
  <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:text="@string/return_to_incall_screen" android:singleLine="true" android:layout_weight="1.0" /> 
  <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/callIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" /> 
  <Chronometer android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:id="@id/callTimer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:singleLine="true" /> 
 </LinearLayout>
</com.android.systemui.statusbar.phone.PhoneStatusBarView>
 
  • Like
Reactions: billy.bong

billy.bong

Senior Member
Jul 15, 2012
86
38
0
Cimahi, Bandung
MIUI, eh? Wow..that's some busy code. Can you share a screenshot of how it looks now?
See my attachment :D

But the status_bar.xml, when I trying to edit it, i'ts not totally different with another ICS status_bar.xml bro.
Thank you for wanna to help me. Sorry if I bother you, mate :cowboy:



Well, I'm not on MIUI but the basics are still the same. In theory.

This code here should put your signal icon to the left of the carrier label in the statusbar. Try it out and if it doesn't work, please provide a screenshot so I can see what it's doing.

--deleted--
Ok I'll try it :D
 

Attachments

Last edited:

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
See my attachment :D

But the status_bar.xml, when I trying to edit it, i'ts not totally different with another ICS status_bar.xml bro.
Yeah, it's the same sort of thing. There's just a few things that must be unique to MIUI itself but nothing that should cause too much of an issue.

I moved the 'signal_cluster' line to just above the 'CarrierLabel' line. That should put the signal icons just to the left of the carrier label.

Maybe.
 
  • Like
Reactions: zzapz

billy.bong

Senior Member
Jul 15, 2012
86
38
0
Cimahi, Bandung
Yeah, it's the same sort of thing. There's just a few things that must be unique to MIUI itself but nothing that should cause too much of an issue.

I moved the 'signal_cluster' line to just above the 'CarrierLabel' line. That should put the signal icons just to the left of the carrier label.

Maybe.
Yap, it's work mate :D

See my attachment. Thank you very much dude :)
The conclusion is just move the line that describe the signal bar, to the position that we want. For example to the left carrier label, just move the signal bar line, then put it in above the line that describe the carrier label. That's right?

But onething bro, there's more space in the left of the signal bar (I mark red circle on it), and when I move the clock into the center of status bar, there's more space too in the right of the battery. Any idea to remove that space?

Thanks for your help dude :)
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Yap, it's work mate :D

See my attachment. Thank you very much dude :)
The conclusion is just move the line that describe the signal bar, to the position that we want. For example to the left carrier label, just move the signal bar line, then put it in above the line that describe the carrier label. That's right?

But onething bro, there's more space in the left of the signal bar (I mark red circle on it), and when I move the clock into the center of status bar, there's more space too in the right of the battery. Any idea to remove that space?

Thanks for your help dude :)
No problem. :cool:

Just moving the line doesn't always do what you want. This code has a lot of LinearLayout tags and it's where you put the line in relation to those that's important. In my original post, I was trying to keep the clock in the first LinearLayout, so it would move out of the way of any notifications.
serajr had the clock outside the LinearLayout but did something clever with the background of the second one.
It all sounds complicated but it does make sense. Honest!

Try this code out for a centered clock. I'm not sure about the spaces, to be honest. I've tried something that may get rid of the one to the left of the signal icon but it might not work
The space that remains when you center the clock..is that a MIUI option? If so, it may be just something that MIUI does. This code centers the clock from the beginning.

Code:
  <?xml version="1.0" encoding="utf-8" ?> 
  <com.android.systemui.statusbar.phone.PhoneStatusBarView android:background="@drawable/status_bar_background" android:focusable="true" android:descendantFocusability="afterDescendants" xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]" xmlns:systemui="[URL]http://schemas.android.com/apk/res/com.android.systemui[/URL]">
 <com.android.systemui.TorchServiceView android:layout_gravity="top|left|center" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:foreground="#ff000000" /> 
 <com.android.systemui.statusbar.phone.BatteryIndicator android:layout_gravity="top" android:id="@id/battery_indicator" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/battery_indicator" android:scaleType="fitXY" /> 
 <com.android.systemui.statusbar.phone.BatteryIndicatorCharging android:layout_gravity="top|right|center" android:id="@id/battery_indicator_charging" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/battery_indicator_charging" /> 
 <LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="6.0dip" android:paddingRight="6.0dip" 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_horizontal|center" android:id="@id/clock" android:paddingTop="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> 
 <LinearLayout android:paddingRight="6.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
  <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" android:gravity="left" /> 
  <com.android.systemui.statusbar.phone.CarrierLabel android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/carrier" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> 
  <LinearLayout android:id="@id/notification_icon_cluster" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
   <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="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" /> 
  </LinearLayout>
 </LinearLayout>
 
 <com.android.systemui.statusbar.NetworkSpeedView android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/network_speed_view" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6.0dip" /> 
 <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: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/signal_cluster_view" />  -->
   <com.android.systemui.statusbar.phone.BatteryStatusIconView android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
  </LinearLayout>
<!--  <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/clock" android:paddingTop="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> -->
 </LinearLayout>
 <LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/status_bar_background" >
  <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginRight="4.0dip">
   <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="centerInside" /> 
   <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="centerInside" /> 
  </ImageSwitcher>
  <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:paddingRight="10.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
   <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" /> 
   <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" /> 
  </com.android.systemui.statusbar.phone.TickerView>
 </LinearLayout>
 
 <LinearLayout android:gravity="center" android:id="@id/returnToIncallScreen" android:background="@drawable/status_bar_green_bar_bg" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
  <ImageView android:id="@id/callStateIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/status_bar_ic_return_to_incall_screen_normal" /> 
  <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:text="@string/return_to_incall_screen" android:singleLine="true" android:layout_weight="1.0" /> 
  <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/callIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" /> 
  <Chronometer android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:id="@id/callTimer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:singleLine="true" /> 
 </LinearLayout>
 
</com.android.systemui.statusbar.phone.PhoneStatusBarView>
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Yap, it's work mate :D

See my attachment. Thank you very much dude :)
The conclusion is just move the line that describe the signal bar, to the position that we want. For example to the left carrier label, just move the signal bar line, then put it in above the line that describe the carrier label. That's right?

But onething bro, there's more space in the left of the signal bar (I mark red circle on it), and when I move the clock into the center of status bar, there's more space too in the right of the battery. Any idea to remove that space?

Thanks for your help dude :)
If that space to the left of the signal icon is still there, try moving the 'signal_cluster' line to just underneath the 'CarrierLabel' line. That will put the signal icon on the right of the carrier label. Not a perfect solution but could work out for you.
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
ohh so~ ok ok
this https://www.box.com/s/9f023a55594aa8a093b4 (framework-res) and https://www.box.com/s/ce71c4897adc84d9ed56 (SystemUI)

btw, you and bro Billy.Bong talk about Signal Bar in left position right??
err, can you take it for me too?? :fingers-crossed:
sorry if it bother you orz;

thanks yoo :D
Done. I used the same principles mentioned above and did it in a few seconds. This can be pushed back to your phone, just make sure you get the permissions right. :cool:
 

Attachments

Last edited:
  • Like
Reactions: knightazura

physcodelic

Senior Member
Apr 15, 2012
207
52
0
Okey successfully move the clock :D

Maybe youre right, I should start learning about this xml stuff...
Hopes my brain wont explode :D

Ah, btw can you write a tuts about 1% battery mod?
Cant find one usefull...
 
Status
Not open for further replies.