[HTC Sensation] boxygreg1982:
This guide is basically for anyone who cooks ROMs and wants to add default widgets to any of the screens rather than the widgets HTC puts on the screens. Also if you remove some widgets from your ROM you will be left with blank screens so you can use those screens to add other widgets that are still in the ROM.

Cooking a ROM can be and is a nice experience and very educational too. After about a

year of cooking my own ROMs I decided to do what any other developer would do, learn

by trial and error and that is how I came by one my best discoveries so far, that is

where and how to place widgets in your Android ROM when you are cooking it. It is very

simple when you realise how simple it is. I don't know if anyone has it figured out

but after searching these forums for about 6 months nothing came up.

Right, let's get down and dirty with this. Here are the tools I used (anyone who cooks

ROMs should probably have them):

dsixda's kitchen - to decompile and recompile the ROMs

notepad++ - to edit various (text) files

7zip - to unzip archived files

apktool - to decompile and recompile apks

any ROM/update.zip -

other tools - will add these when they come up ;)

Files to edit

-WORKING_******_******\system\customize\MNS\default.xml

-******widget\res\xml\***.xml

-******widget\AndroidManifest.xml

Install apktool and use it to decompress the apks for the widgets you need.

Anyway, hoping your computer is set up to use dsixda's kitchen, unpack your rom using

dsixda's kitchen (the kitchen) and navigate to

C:\cygwin\home\%user%\kitchen\%WORKING_******_******%\system\customize\MNS

Make a back up of and open default.xml with notepad++ and scroll down about half way

down till you get to

<function name="1_fx_widgets">

and that is where the widget placement begins. An example is

Next is to get the apk of the widget you want to use. In this case I used the clock widget which is

HtcClock3DWidget.apk. Use apktool to decompile it (7zip will unpack it but the xmls won't show up

properly in Notepad++). Go into the the decompressed folder 'htcclock3dwidget' (Windows ignores

and lowercase letters) and open 'AndroidManifest.xml'. The file should be as follows:

In default.xml from the (working_folder)\system\customise\mns\ the default clock widget

settings are:

This is for the large default clock in HTC Sense which occupies half the screen. I decided to

go for the new clock which takes up one line at the top of the screen. Right, to edit it to get

the new clock to come up when I cook my rom in the main homescreen which is screen 3 (the

fourth screen from the far left) (the screen counting starts from 0) I need "package_name",

"widget_name", "provider_name" and "span_y".

For "package_name" this is found in 'AndroidManifest.xml' in the decompiled 'htcclock3dwidget'

folder. It is found in one of the first lines

as 'package' after 'android:versionName' so the "package_name" is

'com.htc.clock3dwidget'

For "widget_name" it is a little tricky. Navigate to 'htcclock3dwidget\res\xml' and open 'clock_widget.xml'

in Notepad++. The file looks like this (it is more or less this file, lol):

In my case I want to use the smaller newer clock (but any can do depending on which clock you want

to use) which is found on this line:

The name of the clock widget I want to use is found after 'rosie:name' which is ".ClockWeather_4x1".

So for "widget_name" I use "package_name"+'rosie:name' which makes it

'com.htc.clock3dwidget.ClockWeather_4x1'

For 'provider_name' that's a bit more difficult but after trial and error I found that it is

found in 'AndroidManifest.xml' of the clock widget on the line

so 'provider_name' is 'android:name' before 'android:exported' which is

'com.htc.clock3dwidget.ClockWidgetProvider'

This becomes

'cell_x' and 'cell_y' remain untouched because I want it at the top of the screen starting

from the left (you place it where you want using cell_x and cell_y). 'span_x' stays at '4'

(because it occupies 4 cells going to the left) but 'span_y' becomes '1' because it occupies

1 cell going down. The clock widget settings section finally becomes

And that's just for the clock widget. The format is more or less the same for the other widgets. By the way, if you mess up the widget won't show but the widget itself won't be affected so you can manually add it. You will notice there are settings for other widgets that don't show up on any of the screens.

Oh, I think the process works the same for all phones as long as they have HTC Sense. If anyone has any questions please please please feel free to ask. We are all here to learn. I added bookmarks widget to replace friendstream widget which I don't need and re-added weather widget to first the first screen, shifted navigation widget and fellow widgets to last screen and added htc notes widget to their screen. The power is in your hands. As I said before, I couldn't find the information I needed anywhere so I had to hunt it down in the files mentioned above using my hunch and I found it. Whatever you want or need the answers are out there, you just need to find them

I have attached some screenshots. You might notice there's nothing special to them because you can change them after installing your ROM but that's how my screens look when I install my ROM so I don't have to change them anymore.

Many many thanks go to

football

mike1986

robocik, capychimp

baadnewz

dsixda

hawke84

faux123, sebastianfm

apktool guy ;)

and many others from back in the days of wm2003