[Thunderbolt Themes and Apps] tsachi:
Index

post 1: Introduction

Post 2: Simple image swap

Post 3: Decompiling and recompiling files

Post 4: Image locations in Sense ROMS

Post 8: How to use the kitchen

Post 9: Advanced modification: Add / Remove alarm notification

Post 10: Advanced modification: Add / Remove Location indicator

Introduction

There are several resources available with information about theme creation, however I find that information is usually scattered on many different threads. It is also not always newbie friendly. In this thread I would like to give a quick summary for the newbie to help start making your phone look the way you like it. Before I go into the actual details, I would like to suggest some shortcuts. You don’t always need to do things the hard way. The options that you have are:

Use the Ultimate online Kitchen . For those not familiar, this is an online tool that lets you pick and choose components and then packages them for you into the base files you supply. You can get very far using the kitchen with lots of options for customizing your phone.

Start with the kitchen and add some images. The kitchen is great to get a good baseline without going into code. You don’t have to worry about finding where color definitions sit, or what hex values are good to use. Most of the time, however, we want icons that are not available in the kitchen. The solution a lot of themers are using is to create a good base in the kitchen, then add modifications of their own.

Replace individual images, but keep everything else the same. This is a solution for those who want to manually swap battery files, or create their set of notification items and move it from ROM to ROM. You can use this either on the stock files from your ROM, or on files you generated in the kitchen.

Going into the guts – this is the advanced version. You decompile the files and modify the source code to get what you want. This is the only way to get the non-standard stuff done. Once again, you can start with a stock ROM, or you can run it through the kitchen to do some of the tedious work and then go into the guts.

I will describe the methods for both 3 (post 2) and 4 (post 3). I also have a list of where you can locate icons on the phone in post 3, that I will expand in the future.

Background

System Icons and background images sit in two main files: framework-res.apk (in system/framework) and system-ui.apk (in system/app). Additionally, sense ROMs have com.htc.resources.apk (in system/framework Within these files there is a res directory, and under that you have the folders containing data. Google has guidelines on icon design, although themers usually ignore those in order to get a different from stock look. One thing you would notice is that there are sometimes repeated folders of icons. This is usually baggage from different android versions (2.1, 2.2, 2.3). One thing to remember, it’s usually easy to add images, but you can get into all sorts of trouble if you ake things out.

Each application has its own res folder where the launcher icon and other visuals are kept. There are, however, a lot of applications that reference the framework.apk for visuals. For example the my location in maps, or google talk notification.

There are 2 types of images that you would encounter. Normal icons and images are non-scalable. They take a certain amount of real estate on the phone, and that’s it. Example of these are the battery levels and notification icons. The other type is the .9 images. These are images that are going to be stretched to fit whatever space is needed. An example of that are the menu backgrounds. The .9 images have a special format. The one pixel border around them defines how they stretch and how content is displayed in them. It is highly recommended to follow the standards in order to get repeatable and consistent look. Android SDK has a tool to help with .9 file design: draw9patch.bat.

Important note:

The .9 files show the borders ONLY when de-compiled. If you grab a file from the framework directly you will not see that line. It is therefore required to compile the .9 files after you make them. You can use apk manager or ThemePro-JAVA to recompile the framework apk after modifying the files.

Definitions for which image is used where sit in the xml files under the drawable folder. These are compiled xml files, you can’t edit them with a text editor. For this introduction I will not go into modifying xml files, but I’ll describe it in a later post. Each apk also has a resources file that describes what is in there. If you add, remove, or rename files in the apk you will have discrepancy with the resource file and the theme will not work (more likely you will be stuck in an infinite bootup loop). To add, remove, or rename files you have to go through full apk decompile.

Before you start:

Warning: frameworks are highly linked with other files. You can’t just take a framework from one ROM and put it in another. Always keep a backup of the original files ready to be installed (see below), otherwise you may need to re-flash the ROM. Frameworks are also sensitive to compression. DO NOT use winzip to handle the files, it can cause problems with the final apk file.

There are several things you would need before you start

A rooted phone

SDK installed on the computer

A zip handling software other than winzip (winRAR and 7-zip are both good options)

Amend2edify . If you are on a mac you will need auto sign for mac instead

For advanced work - APK manager

These are mostly windows tools, with some support for linux, so if you're on a mac you need to find the equivalent program.

Create a backup

Grab the framewor k-res.apk, com.htc.resources.apk and system-ui.apk from your phone. They are located in the system/framework and system/app folders. You would need them as a starting point for your modification and you need them for a backup

If you plan to modify any other files, grab them and note where you took them from (most likely /system/app for things like dialer, email, etc)

Create a clockwork installation file of the original files (see post below)

Name the installation framework-original.zip, or something else that would be easily recognized in case of trouble, and then copy it to your internal sd card.

Create installation and test it

After you have finished modifying the files, the best way to get them to the phone is through clockwork installation. You can push files to the phone using adb, but in my experience it's not worth it.

Create install file

I am calling the parent folder “main”

Create a folder main\framework

Place your modified files (framework-res.apk and com.htc.resources.apk) in that folder

Create a folder main\app

Place the modified files (system-ui.apk + any other apps you modified) in that folder

Create the following folder tree:main \META-INF\com\google\android

In the android folder create a text file named update-script

Edit the update-script file content “copy_dir PACKAGE:app SYSTEM:app copy_dir

PACKAGE:framework SYSTEM:framework”

From the main folder add the three folders you created to a new zip file

Use amend2edify to convert and sign the zip file you created

WARNING: Do not name your framework file "update.zip"! Do not name your file “PG05IMG.zip”!

Testing

Give the file a name that is easy to recognize and copy it to your internal sd card

Reboot into recovery

Select install zip from card -> choose zip from sdcard

Select the installation of the new framework and confirm the installation

Reboot

If you are stuck in an infinite boot-up cycle reboot back to recovery

You can try to send “adb reboot recovery” to the phone over usb

You can battery pull then use power + volume key to boot into recovery

Install your original framework backup and reboot

hint: if you are like me and have a lot of files, name your test file z_filename.zip That way in recovery you use the up volume and get to it quickly.