[Android Themes] Ticklefish:
I think some people are getting a bit confused about how to do this mod. Which is a shame as having an accurate battery icon is such a useful thing to have.

I've found myself with a bit of free time so I thought I'd do this again and, with [MENTION=4485836]Erhany[/MENTION]'s permission, I'd provide a little guide showing what I did.

So here's how I used this mod on my phone, running Android 4.4.4:

The first thing I did was decompile my SystemUI.apk. There are lots of different ways to do this and lots of different ways, but I always use Tickle My Android for all my decompiling and recompiling.

While my apk was decompiling, I downloaded KitKatBattery_Erhany.rar from the OP and extracted it to a spare directory. This file contains two sets of files: "KitkatBattery_Erhany_apktool1" and "KitkatBattery_Erhany_apktool2". I used apktool 2 RC4 to decompile my apk, so I'll be using the files from "KitkatBattery_Erhany_apktool2".

Once my SystemUI.apk was decompiled, I copied the KitkatBattery_Erhany_apktool2\res\ folder to it. This copied all the relevant image files and XML files that the new battery icon would be using into my decompiled apk.

The OP then says to edit public.xml to put some new hex references in. I actually never edit public.xml. Instead, my next step is to recompile SystemUI.apk...and then decompile it again.

This forces public.xml to update itself with references for all the new files. This is a lot easier than editing public.xml myself!

Now the apk is decompiled for the second time, I can copy the KitkatBattery_Erhany_apktool2\smali\ folder into it.

The next stage is to edit "KitKatBattery$1.smali", which is found in "SystemUI.apk\smali\com\erhany\". There are two lines in there which need changing..

The first line says:

const v3, [COLOR="Red"]0xstat_sys_battery_charge!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11[/COLOR]

I looked in "SystemUI.apk\res\values\public.xml" and found this line:

<public type="drawable" name="stat_sys_battery_charge" id="[color="red"]0x7f0201b6[/color]" />

Now all I need to do is swap the parts in red to make the smali look like:

const v3, [COLOR="Red"]0x7f0201b6[/COLOR]

The second line of smali I need to change says:

const v3, [COLOR="red"]0xstat_sys_battery !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/COLOR]

My public.xml has this line in it now:

<public type="drawable" name="stat_sys_battery" id="[COLOR="Red"]0x7f0201b5[/COLOR]" />

So I just need to change this smali line to:

const v3, 0x7f0201b5

My new battery icon is now ready to display on my status bar, so the next step is to edit my "SystemUI.apk\res\layout\status_bar.xml".

This is a long file and, unless you're familiar with Android XML, it can look very confusing. But I only want to change one small part of it.

I want to change this line here:

<com.android.systemui.BatteryMeterView [COLOR="red"]android:id="@id/battery"[/COLOR] android:layout_width="10.5dip" android:layout_height="16.0dip" android:layout_marginBottom="0.33000004dip" android:layout_marginStart="4.0dip" />

This is the line that displays my battery icon. All I have to do is replace it with this line:

<com.erhany.KitKatBattery android:gravity="center" [COLOR="red"]android:id="@id/battery"[/COLOR] android:paddingLeft="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" />

Now I just need to save all the open smali and XML files, recompile and flash my modded SystemUI.apk back to my phone and...that's it!

Sounds complicated, I agree. But, really, it isn't.

Just follow the steps, take your time, and you too will have a new battery icon on your phone! ;)

Any problems, just let us know!