[Galaxy S II Themes and Apps] OriginsOfLewis:
How to create a dialer for stock Samsung roms:

Requirements:

- Modded APKTool for ICS

(http://xdaforums.com/showthread.php?t=1558171)

- Java JDK

- Windows 7 (I used it in a VM)

- A rooted phone

- Root Explorer

- Notepad++

- 7zip

Setting up:

- Install Java JDK, once that is done extract the contents of APK tools. Place them as close to the root folder as possible, I had them in C:\Android.

- Go to your phone, open up Root Explorer and navigate to /System/Framework and copy framework-res.apk to your SD Card

- Plug your phone in via mass storage mode/mtp and pull the app to the folder you created earlier (C:\Android).

- Open up CMD (command prompt) and type the following:

cd..

cd..

cd Android/

Making sure you use the ".."!

Next type the following command:

apktool if framework-res.apk

This will not decompile the framework-res apk, it is installing the current framework of your rom as they're all different. You will need to repeat this step every time you flash a new rom.

- Back on your phone, navigate to /System/app and copy Contacts.app to your SD Card

- Plug your phone in again and move it to the folder (C:\Android)

Decompiling:

Open terminal up again and type the following:

apktool d Contacts.apk

I'm guessing the d stands for decompile :good:

Editing:

Seeing as we're only editing XML's this isn't going to be that hard, I learnt how to do this in about 10 minutes. In the root folder you should now see a folder called "Contacts". Open that and navigate to /res/layout/ and scroller down to D. There will be several XML's starting with the word dialpad- we want all of those. Open those up in Notepad++.

The Maths:

You'll notice most of the figures are measured in DIP, this stands for density independent pixels, so we need to work out how much to multiply the values by so they look the same on your chosen DPI.

Take the stock density that the dialer works correctly at - 240dpi and divide it by your new density (for me it was 180).

240 / 180 = 1.3

The tedious bit:

Unfortunately you need to change every figure in the XML's starting with the word dialpad, this took me about and hour to do this but it was well worth it. This includes values not ending in DIP such as pp and px. To work out the new figure you need to do the following:

Take the value in the XML, for example 50

Multiply it by the value you got from dividing the old density by the new, mine was 1.3 to get the new value

50 * 1.3 = 65

*EVERY VALUE IN THESE XML's NEEDS TO BE CHANGED!*

Several hours later....:

Once you've done that we need to recompile everything.

- Open up CMD again and type in apktool b Contacts ContactsNew.apk

The b might stand for build, I have no idea, but depending on the speed of your computer/laptop this may take a few seconds/minutes. It took my macbook around 15 seconds to do it. You may get some small error messages, you can also use this to find any problems you made whilst editing.

Assuming it all went well you will see the new apk underneath your old one in the root folder. We can't use this as it doesn't have the proper signature that is needed for it to work. Therefore we will use 7zip to take the new files and drop them into the old apk.

- Open up 7zip and locate ContactsNew.apk (the one we just recompiled)

- Navigate to res/layout/ and drag all the files starting with dialler to a safe location, such as the desktop

- Go back to and open up Contacts.apk (the old one you pulled from your phone)

- Navigate to res/layout/ and drop all the files you just removed in here

- Close down everything as we don't really need it anymore

Installing:

Copy Contacts.apk to your SD Card overwriting the old one if it's still there and disconnect your phone safely. Open up root explorer and navigate to your SD card, copy Contacts.apk to /System/

*DO NOT COPY IT INTO SYSTEM/APP JUST YET*

Long press the apk and select permissions, they need to look like this:

Once you've done that long press and move it to /System/app overwriting the old one.

Reboot!

The dialer should now be the correct size, hoped this helped!