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

Search This thread

Stericson

Retired Senior Mod / Retired Senior RD
Nov 10, 2008
1,203
417
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
 

Attachments

  • ResourceTypes.zip
    14.2 KB · Views: 3,947
Last edited:

Stericson

Retired Senior Mod / Retired Senior RD
Nov 10, 2008
1,203
417
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

Retired Senior Mod / Retired Senior RD
Nov 10, 2008
1,203
417
Bump....I have added a screenshot of the customized loickscreen I made.

Stericson
 

brandenk

Senior Member
Aug 11, 2007
1,147
83
San Diego
Stericson is the man! :D

Looks like my donation is going to good use, I will have to send some more beer money your way.
 

Stericson

Retired Senior Mod / Retired Senior RD
Nov 10, 2008
1,203
417
Bump....another update. check it out....sowwy no pics.

Stericson
 

dthadamaja

Senior Member
Feb 10, 2008
227
9
no fair! stericson is gonna win.....ahahah im not even gonna bother trying to compete in the contest. these changes alone should grant him an easy victory 8(
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
no fair! stericson is gonna win.....ahahah im not even gonna bother trying to compete in the contest. these changes alone should grant him an easy victory 8(

I was thinking the same thing...but he is going to be creating the theme in ADP1.1, if that is the case that is our handicap, the majority of XDA uses RC30-RC33. So it makes it an advantage for us...

besides Stericson is old news..he is the grandfather of themes,,,muahah let the trash talking begin!

Oh and don't tell him i said he was old news =X hahaha
 

Stericson

Retired Senior Mod / Retired Senior RD
Nov 10, 2008
1,203
417
I think maybe I could muster up something for rc33.....after all.....I am the wise grandfather of themes, remember?
 

bhain3s

Member
Nov 7, 2008
29
4
thats it Im gettin root just for this...I've been waiting to make a theme with a black status bar...

and I will win this contest or watever it is
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    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
    1
    I have a feeling I know who is gonna win this competition!

    Great work! Im so excited, damn competition. :mad::p:D