Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,780,028 Members 37,981 Now Online
XDA Developers Android and Mobile Development Forum

XML Edits How to [ Updated \ 07/24/09 ]

Tip us?
 
Stericson
Old
(Last edited by Stericson; 4th August 2009 at 06:07 AM.)
#1  
Stericson's Avatar
Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming - OP
Thanks Meter 380
Posts: 1,193
Join Date: Nov 2008
Default XML Edits How to [ Updated \ 07/24/09 ]

I will be adding information to help people complete XML hacks here, however, This is not a simple thing to do!
This is not something you just fall into. Sure, I can tell you what to change for certain effects but you wont learn anything. So other then taking what somebody has done and using it yourself I will not give direct directions on how to create certain effects.

I will help you learn but I will not do it for you.

The first thing to go over is what you will need.
Download Textpad, and HXD. Look on Google for these, consider it homework.

You no longer need to download the source for a reference.
You can find the entire source here: http://www.netmite.com/android/mydroid/
I use it as a reference all the time when I'm on windows.

I have uploaded a file called resourcetypes/h that contains alot of information in it about how things are translated to binary, in fact everything I will document below was retrieved from that file.

Keep in mind that Android looks at things in bits when compiling this code into hex. And since in hex all we deal with are bytes we need to do some quick math.

In every byte (00) there are 8 bits When you see something in the code like this: uint16_t size; That is android talking about 16 bits which in hex is 2 bytes because every byte is equal to 8 bits.

Got it? Good...
Lets take a look at some code!

Code:
   // Number of bytes in this structure.
    uint16_t size;
This means the first two bytes reference how many bytes are in this structure. Specifically speaking, for the most part everything we will deal with here is five bytes long. So the first values in hex would be 05 00 if there were five bytes in this structure...

Code:
    // Always set to 0.
    uint8_t res0;
This means the next byte will always be zero, since its 8 bits its only one byte. Which would look like this in hex 00 So combined with what we have above we should see 05 00 00

Code:
       
    // Type of the data value.
    enum {
enum in this case means that the next byte will be one of the following values depending on what it is we are translating to binary.

Code:
        // Contains no data.
        TYPE_NULL = 0x00,

Means this byte should be 00 and the byte after it holds no data... So the structure would be 05 00 00 00 ... so far....

Code:
        // The 'data' holds a ResTable_ref, a reference to another resource
        // table entry.
        TYPE_REFERENCE = 0x01,
Means the byte(s) after this byte 01 holds a pointer to a resource, which could be an image or any other type of resource stored with Resources.arsc. So combined with what we have above we should see 05 00 00 01

Code:
        // The 'data' holds an attribute resource identifier.
        TYPE_ATTRIBUTE = 0x02,
Means the byte(s) after this byte 02 points to an attribute in the resources.arsc. So combined with what we have above we should see 05 00 00 02

Code:
        // The 'data' holds an index into the containing resource table's
        // global value string pool.
        TYPE_STRING = 0x03,
Means the byte(s) after this byte 03 points to a string in the string table of resources.arsc. So combined with what we have above we should see 05 00 00 03

Code:
        // The 'data' holds a single-precision floating point number.
        TYPE_FLOAT = 0x04,
Means the byte(s) after this byte 04 Holds a floating point number...
So combined with what we have above we should see 05 00 00 04

Code:
        // The 'data' holds a complex number encoding a dimension value,
        // such as "100in".
        TYPE_DIMENSION = 0x05,
Means the byte(s) after this byte 05 holds the value of dimension...a lot of times this can be a vlaue for a height or a width of an object, such as an image. So combined with what we have above we should see 05 00 00 05

Code:
        // The 'data' holds a complex number encoding a fraction of a
        // container.
        TYPE_FRACTION = 0x06,
Means the byte(s) after this byte 06 holds a complex number encoding a fraction of a container. So combined with what we have above we should see 05 00 00 06

Code:
        // Beginning of integer flavors...
        TYPE_FIRST_INT = 0x10,

        // The 'data' is a raw integer value of the form n..n.
        TYPE_INT_DEC = 0x10,
        // The 'data' is a raw integer value of the form 0xn..n.
        TYPE_INT_HEX = 0x11,
        // The 'data' is either 0 or 1, for input "false" or "true" respectively.
        TYPE_INT_BOOLEAN = 0x12,
Same rules apply here...I dont think I have to keep explaining them all....

Code:
        // Beginning of color integer flavors...
        TYPE_FIRST_COLOR_INT = 0x1c,

        // The 'data' is a raw integer value of the form #aarrggbb.
        TYPE_INT_COLOR_ARGB8 = 0x1c,
        // The 'data' is a raw integer value of the form #rrggbb.
        TYPE_INT_COLOR_RGB8 = 0x1d,
        // The 'data' is a raw integer value of the form #argb.
        TYPE_INT_COLOR_ARGB4 = 0x1e,
        // The 'data' is a raw integer value of the form #rgb.
        TYPE_INT_COLOR_RGB4 = 0x1f,

        // ...end of integer flavors.
        TYPE_LAST_COLOR_INT = 0x1f,

        // ...end of integer flavors.
        TYPE_LAST_INT = 0x1f
    };
Means the byte(s) after this byte holds a color value. If the 4th byte is 1C Then the bytes afterwards will define a color value that is in the format #FFFFFFFF transparency, red, green, blue.

If the byte is 1E Then the bytes following will represent a color value in the format #FFF Red, green, blue.

HOWEVER, one thing important to know here is that regardless of the format of the color value whether it be RGB or AARRGGBB Android will convert it to hex and it will appear as FF FF FF FF

Code:
    uint8_t dataType;
This is where the FIFTH byte gets added, whatever it may be...it will be one of the values listed above.


I will add more stuff later. The file posted below has everything I've added and more....If you want to know more...open that files up and read it...study it...

Stericson
Attached Files
File Type: zip ResourceTypes.zip - [Click for QR Code] (14.2 KB, 3482 views)
The Following 8 Users Say Thank You to Stericson For This Useful Post: [ Click to Expand ]
 
Geo411m
Old
#2  
Geo411m's Avatar
Recognized Developer
Thanks Meter 533
Posts: 941
Join Date: Jan 2009
Location: Newington CT

 
DONATE TO ME
Thanks for this, I'm sure these files will come in handy. Again thanks for all your hard work.
 
manup456
Old
#3  
manup456's Avatar
Recognized Themer
Thanks Meter 366
Posts: 3,007
Join Date: Dec 2008
Location: Danbury

 
DONATE TO ME
Thanks bro great work keep it up!!!!!!
 
JackD3ath
Old
#4  
JackD3ath's Avatar
Senior Member
Thanks Meter 9
Posts: 420
Join Date: Jan 2009
Location: Satellite Beach, Florida
Wickedly Awesome, you guys go beyond the expected! Thanx to Stericson and JF!!
That is the exact theme i am looking for. No apps tab, black status bar, just wicked!
T-Mobile G2
Asus Nexus 7 Paranoid Android + Trinity Kernel
 
jdwme
Old
(Last edited by jdwme; 4th February 2009 at 03:17 PM.)
#5  
jdwme's Avatar
Senior Member
Thanks Meter 0
Posts: 462
Join Date: Apr 2008
Location: Houston
nevermind, I should have read through it more
 
Meltus
Old
#6  
Meltus's Avatar
Senior Member
Thanks Meter 998
Posts: 1,909
Join Date: Jan 2009
Location: Manchester

 
DONATE TO ME
thanks for this, looks excellent!!
only problem is the red-clock didn't work and now i have no clock at all.
god knows how i ****ed this up :P
 
Stericson
Old
#7  
Stericson's Avatar
Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming - OP
Thanks Meter 380
Posts: 1,193
Join Date: Nov 2008
Well, if you read my post all the way, you would have read that I specifically said that the clock wouldn't work right now.

And you do have a clock it's just blending with the status bar.

Stericson
 
Stericson
Old
#8  
Stericson's Avatar
Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming - OP
Thanks Meter 380
Posts: 1,193
Join Date: Nov 2008
Bump....I have added a screenshot of the customized loickscreen I made.

Stericson
 
TruTechGeek
Old
#9  
TruTechGeek's Avatar
Senior Member
Thanks Meter 12
Posts: 234
Join Date: Jan 2009
Location: Los Angeles
how did you make that lock screen?
 
jdwme
Old
#10  
jdwme's Avatar
Senior Member
Thanks Meter 0
Posts: 462
Join Date: Apr 2008
Location: Houston
looking good man!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes