Center Clock on Status Bar Cyanogenmod 7 on Galaxy Mini (edited by apktool on Ubuntu 11.04)


To move clock to center of status bar status_bar.xml must be edited. This file(status_bar.xml) is in SystemUI.apk . SystemUI.apk is in /system/app in Android system, so lets backup it first before edit it. To edit status_bar.xml , SystemUI.apk must be decompiled.

After decompile it, lets find status_bar.xml  SystemUI/res/layout with text editor. In this tutorial I use apktool which can be downloaded from http://code.google.com/p/android-apktool/downloads/list . There are windows version and Linux version. After download them, lets locate them in one folder. You can locate *.apk file in that folder and running apktool to edit it. If you use Linux, to make your work easier, lets locate the file which extracted from apktool-install-linux-r04-brut1.tar.bz2 and apktool1.4.1.tar.bz2 to /usr/local/bin (dont forget to change file owner and permission setting if you do this) . So apktool can be accesed from everywhere when we will use it again.

●      First pull SystemUI.apk and framework-res.apk to computer

user@computer$ adb pull /system/app/SystemUI.apk /apktool_location

user@computer$ adb pull /system/framework/framework-res.apk /apktool_location

 

●      Install framework

user@computer$ apktool if framework-res.apk

●      decompile SystemUI.apk

user@computer$ apktool if SystemUI.apk

user@computer$ apktool d SystemUI.apk

You will get SystemUi folder and lets find status_bar.xml under /SystemUI/res/layout/.

●      Edit status_bar.xml with gedit or others

Find “ <com.android.systemui.statusbar.Clock “ on status_bar.xml

and delete “<com.android.systemui.statusbar.Clock” until “/>” like this :

Add this code :

<LinearLayout android:gravity=”center” android:orientation=”horizontal” android:layout_width=”fill_parent” android:layout_height=”fill_parent”>

<com.android.systemui.statusbar.Clock android:textAppearance=”@android:style/TextAppearance.StatusBar.Icon” android:textSize=”15.0sp” android:typeface=”normal” android:textStyle=”bold” android:textColor=”#ffff0000″ android:gravity=”center”  android:paddingTop=”2.0px” android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:singleLine=”true” android:layout_weight=”1.0″ />

</LinearLayout>

to status_bar.xml after “xmlns:android=”http://schemas.android.com/apk/res/android“> “ and before “ <LinearLayout .. “ like this :

Save status_bar.xml and exit text editor.

●      Lets back to terminal and compile SystemUi.apk from SystemUI folder

user@computer$ apktool b SystemUI

Your terminal will be like this :

●      OK lets finishing, find folder build in SystemUI folder, and find /build/apk/resources.arsc and /build/apk/res/layout/status_bar.xml, then add thoose file to original SystemUI.apk with archive apps (ex: ark in KDE , winrar in windows)

●      Then lets transfer that modified SystemUI.apk (which modified by adding files which compiled with apktool), lets open terminal

user@computer$ adb push SystemUI.apk /sdcar /up_to_you_anywhere_locate_it/SystemUI-x.apk

user@computer$ adb shell

– on adb shell :

# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

# cp /sdcard/up_to_you_anywhere_locate_it/SystemUI-x.apk /system/app/

# cd /system/app/

# chmod 0644 SystemUI-x.apk

# stop

# mv SystemUI.apk  ./SystemUI.apk.original

# mv SystemUI-x.apk  ./SystemUI.apk

# reboot

●      Lets lenjoy it🙂

source : http://forum.xda-developers.com/showthread.php?t=1174202

<LinearLayout android:gravity=”center” android:orientation=”horizontal” android:layout_width=”fill_parent” android:layout_height=”fill_parent”>

<com.android.systemui.statusbar.Clock android:textAppearance=”@android:style/TextAppearance.StatusBar.Icon” android:textSize=”15.0sp” android:typeface=”normal” android:textStyle=”bold” android:textColor=”#ffff0000″ android:gravity=”center”  android:paddingTop=”2.0px” android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:singleLine=”true” android:layout_weight=”1.0″ />

</LinearLayout>

2 thoughts on “Center Clock on Status Bar Cyanogenmod 7 on Galaxy Mini (edited by apktool on Ubuntu 11.04)

  1. Im trying to do this on a non cynogen ROM and I keep getting errors when I re compile the apk. Is this possible ?

    The error is “invalid token”

    1. i do apologize if my answer doesnt make you satisfied,
      what the whole “invalid token” is?
      it looks like something with apktool , the latest apktool is the best, if u still get error you can also use apkmanager, good luck🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s