[Hero, G2 Touch Themes and Apps] Habarug:
Hello :) A little while ago I managed to learn how to theme totally from scratch. I knew nothing of anything before I started, but now I know how to port themes :D As I still see myself as a n00b there may be some weird things I've done, but at least I manage to create the themes :P This might not be the best way to theme, or the easiest, but it works :D

Overview PNGS

1) Getting the files

2) Getting the images

3) Port

4) Package and Sign

The only programs I've used is 7zip and autosigner :) download them and install 7zip and extract autosigner to a nice location for example your desktop :)

Getting the files

The first you need to do (after getting the programs) is to find the file you will mod (edit). This will mostly be the framework-res.apk because this decides most of looks of phone (for example the statusbar). Download the .zip of the rom your going to theme. Open it up (shouldn't require any programs, if does, use 7zip: either drag it onto the 7zip icon or right click and choose open with). Open system -> app and copy the framework-res.apk (or any other apk you would like to theme, for example the settings). Now paste it into an appropriate folder.

Getting the images

Now you need to find the images you want to use in your new theme. Find either an update.zip with a theme or an .apk with a theme chooser theme (if there is both a version for Froyo and GB, use the Froyo version as this will make it easier :) ) Open it up with 7zip (drag it into the 7zip icon). Now you can do either of two options:

1)	You can take the whole drawable-mdpi folder and copy it out. You should probably don’t do this with a Themechooser apk, as they usually don’t have all icons in this folder, as they often lend a few from HDPI.

2)	Take only the images you want and copy them to a folder. For example if you want the signal icons, copy the “stat_sys_signal_0” (-4 of course) and copy them out. If you want the statusbar background, copy “statusbar_background”. This way you can mix several themes, take the best of several themes and make your personal theme :D

When you’re done getting your icons, close the window.

Porting

Now open the Rom’s default framework-res.apk with 7-zip. If you’re going to port a whole theme, delete the /res/drawable-mdpi folder and copy in your own. If you’re going to port just a few icons, open the /res/drawable-mdpi folder and paste your icons. You might want to check if the icons have the same names in the different framework. For example the headset icons can be both “stat_sys_headset” and “stat_notify_headset”. Also if you port from a theme chooser theme, you will have to rename every single .png you port. This is really boring, but necessary. You need to remove the “framework_res” and the “android_systemui” from the beginning of all the names. So “framework_res_activity_title_bar.9.png” needs to be changed to “activity_title_bar.9.png”. Because this is so boring you better keep your renamed icons, so it’s easier to port it to another rom :)

This is kind of off-topic: my carrier lends network of another carrier. Therefor my phone is allways roaming. This puts a stupid “r” with my signal icons. To avoid this I allways take normal signal icons, copy them, and rename one of the two .pngs from for example “stat_sys_signal_1” to “stat_sys_r_signal_1”. This way I get rid of this stupid “r” and it will always show the normal icons :D

Packing and signing

Now the porting is done and the next job is to push the new framework to your phone. If you are familiar with adb, you can push it to system/framework on your phone. You don’t need to anything more with the apk before pushing it. Else you can create a flashable .zip for your theme. I’ve attached a .zip with update script (I haven’t created it. Just stole it from one of Elelinux’ add-ons :) ). Download the zip. Create a folder named system and a folder named framework. First drag the new, modded framework_res.apk to the framework folder, then drag the framework folder into the system folder, before you drag the system folder into the attached zip. If you use Clockworkmod recovery, you can just flash the zip right as it is, but if you use Amon_Ra or want it to be compatible with every recovery because you want to post it, you need to do something.

Unpack autosigner and launch the exe file inside. Drag the .zip into the new window and press sign. It will now appear a new file in the same folder as the file you wanted to sign. Its name is the same, but with “_signed” at the end. You can rename the file as you wish both before and after the signing.

XML Editing:

I decided to add a little section about XML editing as well :) I really don't know all about this myself, but i can tell how to set it up and some examples to what you can do ;) Even though this may seem really complicated, it's not written in a completely different language, like Java in the smali files, so often it is possible to use logic to get what you want ;)

Tools needed: APK Multi-tool. as well as Java, if you don't have it installed.

Overview:

1) Setting up

2) Examples

3) Finish

Settings up

Download APK Multi-tool and extract/ unzip it to wherever you want ( I have it on my desktop). Now you can place the apk you want to modify (usually the framework_res.apk) in the "Place_apk_for_modding" folder. Then you open the script. If you don't get an error, proceed to b), if you do get an error proceed to a)

a)) If you do get an error where it says something like "java not found" you need to correct the Java path (or install Java if you haven't done that, which you should have) . I had to do this to get it working. First open my computer and click disk C, or D if you have installed Java there. Open programfiles (or whatever it's called in your language) and scroll to the Java folder. Now open the folder there jdk folder or whatever you have there and open the "bin" folder. Look at the top of your window, where it says where on you're computer you are (like Windows: C to the left, and then Programfiles and so on). Right click it and click copy address. Mine is "C:\Program Files\Java\jdk1.7.0_01\bin . Now you can close the window.

Open "My computer" again. On the top bar below the navigationbar, click Sytemoptions (sorry, not really sure what it's called in Englsih, as my computer is Norwegian, please correct me if I'm wrong). On the left click the "advanced" link and in the popup that appears click "environment variables". Scroll down to the "path" variable and edit it. Paste the address you copied and click OK. You should now be able to proceed to b). If you still get an error, please tell me and I'll try to help :)

b) type 25 and press enter to select current project. Here you will see all the apks in the "Place_apk_for_modding" folder. Select the appropriate number (in this case probably 1) and press enter to continue. Then you hit 9 and enter to decompile it. I cannot really explain it, but it enables you to edit the xmls in the apk. If you try to edit them by using 7Zip, the xmls will be just messed up. When it's done decompiling, you have gotten a new folder in the "projects" folder. In this case it is probably named framework_res.apk. Minimize the script (DON'T CLOSE IT) and you're ready to edit the xmls ;)

Examples on edits:

COMING SOON

Finish:

When you're done editing, open the script again (remember what I said about not closing it? :P ). Click 11, unless you are editing a non system apk. If you are editing the framework or settings or such, use 11. If you get an error now, you have probably done something wrong, try to see in the log what you have done wrong. Every time I've had an error, I've ended up in bootloop when I've flashed, so it is probably better to just start over. Another tip is to do one thing at the time. For example: you decompile, edit the notification color in pulldown, compile. Take the compiled apk, decompile edit another thing and so on, this makes it easier to not mess up and it also shows what you are doing wrong.

On the "Is this a system apk?" you should probably say y, as I said above. I also usually copy over the files I didn't edit, as this seems safer. Follow the instructions and you should be fine. When you're done and the script is done compiling, you will find a unsigned_**** (for example unsigned_framework-res.apk) in the "place_apk_for_modding" folder. This is your modified apk, and you can try to push it to ur device with an update.zip or adb, if you know how to use that :)

Well this was the end of my guide for now :) If there's anything which is unclear or you have other suggestions, feel free to post ;) I've probably forgotten something :P