[TUT] How To Port Colorizable Function [24/10/2013]

Search This thread

BDFreak

Senior Member
Jan 20, 2013
428
2,027
Mymensingh
Hi, guys...

Many user keep PM'ing me how to port colorizable function.
So I decide to do a simple guide for them.
Make sure you have a basic knowledge on how to compile/decompile .jar files.

Here you will find two types of tutorial.
First one is the simplest way and second one is the best way.


The Simplest Way :

  • Download Simplest.zip file from attachment
  • Decompile your framework.jar
  • Navigate to [framework.jar]\smali
  • Copy and replace all folders and files from Simplest.zip
  • Recompile your framework.jar


The Best Way :

  • Download Best.zip file from attachment
  • Decompile framework.jar
  • Navigate to [framework.jar]\smali\android\graphics\drawable
  • Copy the files from Best.zip
  • Navigate to [framework.jar]\smali\android\graphics\drawable\Drawable.smali
  • Search for new-instance v2, Lorg/xmlpull/v1/XmlPullParserException;
  • Add the red lines only

    .line 863
    .end local v0 #drawable:Landroid/graphics/drawable/Drawable;
    :cond_e
    const-string v2, "colorizable"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_10

    .line 862
    new-instance v0, Landroid/graphics/drawable/ColorizableDrawable;

    invoke-direct {v0}, Landroid/graphics/drawable/ColorizableDrawable;-><init>()V

    .line 863
    .restart local v0 #drawable:Landroid/graphics/drawable/Drawable;
    goto/16 :goto_0

    .line 869
    .end local v0 #drawable:Landroid/graphics/drawable/Drawable;
    :cond_10

    new-instance v2, Lorg/xmlpull/v1/XmlPullParserException;

    new-instance v3, Ljava/lang/StringBuilder;


    Colorixable_Tut_1.jpg

  • Save the file
  • Navigate to [framework.jar]\smali\com\android\internal\R$styleable.smali
  • Search for .field public static final ColorDrawable_color:I = 0x0
  • Add the red lines only

    .field public static final ColorDrawable_color:I = 0x0

    .field public static final ColorizableDrawable:[I = null

    .field public static final ColorizableDrawable_color:I = 0x1

    .field public static final ColorizableDrawable_drawable:I = 0x0


    .field public static final CompoundButton:[I = null


    Colorixable_Tut_2.jpg

  • Search for sput-object v0, Lcom/android/internal/R$styleable;->ColorDrawable:[I
  • Add the red lines only

    sput-object v0, Lcom/android/internal/R$styleable;->ColorDrawable:[I

    new-array v0, v4, [I

    fill-array-data v0, :array_9d

    sput-object v0, Lcom/android/internal/R$styleable;->ColorizableDrawable:[I


    .line 30543


    Colorixable_Tut_3.jpg

  • Search for sput-object v0, Lcom/android/internal/R$styleable;->WindowAnimation:[I
  • Add the red line only

    sput-object v0, Lcom/android/internal/R$styleable;->WindowAnimation:[I

    return-void

    .line 21653
    nop

    :array_0
    .array-data 0x4


    Colorixable_Tut_4.jpg

  • Search for .method public constructor <init>()V
  • Add the red lines only

    [/I].end array-data

    :array_9d
    .array-data 0x4
    0x99t 0x1t 0x1t 0x1t
    0xa5t 0x1t 0x1t 0x1t
    .end array-data

    .end method

    .method public constructor <init>()V[/I]

    Colorixable_Tut_5.jpg

  • Save the file
  • Recompile your framework.jar


Please Note :

  • Take backup before doing anything.
  • Use Notepad++ to edit files.
  • Don't forget to save the file after editing.
  • If you use ApkTool to decompile framework.jar then your path will be [framework.jar]\classout instead of [framework.jar]\smali
  • Please read the tutorial properly befor editing files.
 

Attachments

  • Simplest.zip
    30.7 KB · Views: 175
  • Best.zip
    3.8 KB · Views: 212

BDFreak

Senior Member
Jan 20, 2013
428
2,027
Mymensingh
[TUT] How To Use Colorizable Function

Here I will teach you how to use this colorizable function.

I will color the power menu tab.
For this we have to edit framework-res.apk, here we go...


  • Decompile your framework-res.apk
  • Navigate to [framework-res.apk]\res\drawable-hdpi
  • Search for tab_selected_holo.9.png, open with any photo editor and change the blue part to white
  • Save tab_selected_holo.9.png as tab_selected_holo_colored.9.png name and put it in [framework-res.apk]\res\drawable-hdpi folder
  • Navigate to [framework-res.apk]\res\drawable
  • Search for silent_mode_indicator.xml and open it in any text editor
  • Change



    to



    Colorixable_Tut_6.jpg

  • Save the file
  • Creat a file with name silent_mode_indicator_colored.xml and open it in any text editor
  • Copy and paste these line in that file




    Colorixable_Tut_7.jpg

  • Green marked text is the name of that png file which will be colored.
  • Blue marked text is the color code. That tab_selected_holo_colored.9.png will be colored by this color.
  • #00000000 means it will be colored according to the color of SemcGenericUxpRes.apk. You can put here any other color code of your choice if you don't want to change color according to the color of SemcGenericUxpRes.apk.
  • Save the file and put it in [framework-res.apk]\res\drawable folder
  • Recompile your framework-res.apk


Thanks:

 
Last edited:

xfreakers

Member
Oct 2, 2013
31
19
Jakarta
@BDFreak can you give a tutorial of make animation of checkbox and radiobutton ?

---------- Post added at 08:27 AM ---------- Previous post was at 08:27 AM ----------

[/COLOR @BDFreak can you give a tutorial of make animation of checkbox and radiobutton ?
 

BDFreak

Senior Member
Jan 20, 2013
428
2,027
Mymensingh

BDFreak

Senior Member
Jan 20, 2013
428
2,027
Mymensingh
@BDFreak

I mean the Titles in the Settings App not the divider.

Changing the Color of the Setting App Titles According to the Theme.

Decompile Settings.apk then findout that title related xml and put "@com.sonyericsson.uxp:color/semc_theme_accent_color" instead of color code.

PS : This thread is about how to port colorizable function in framework.jar.
 

Jeka_Osokin

Senior Member
Jun 25, 2012
272
166
Irbit
How to colorizable text in framework-res.apk?
If i colorize text i get bootloop! I add line in apktool.yml
 
Last edited:

BDFreak

Senior Member
Jan 20, 2013
428
2,027
Mymensingh
Please guys,
Read the thread title properly.

This thread is for colorizable function. Text color changing isn't related to it.

Colorizable Function colored image files only.

Please don't go off-topic or do spamming.
Keep the thread clean...
 

MicQo

Senior Member
Oct 14, 2012
99
62
Snina
becode.sk
don't work for me :( do not compile back the .dex file
see here:
Code:
C:\Users\MicQo\Desktop\Android Tools\smali baksmali>java -Xmx512M -jar smali.jar
 classout -o classes_new.dex
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[34
,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[35
,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[34
,15] mismatched input '"orig"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[36
,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[38,4] Error for inp
ut '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[39,4] Error for inp
ut '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[38,15] mismatched i
nput '"state"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[11
0,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[11
1,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[11
0,15] mismatched input '"x0"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[12
2,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[12
3,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[12
2,15] mismatched input '"x0"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[23
3,4] Error for input '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable$ColorizableState.smali[23
3,15] mismatched input '"res"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable.smali[58,4] Error for inp
ut '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[59,4] Error for inp
ut '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[58,15] mismatched i
nput '"x0"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable.smali[60,4] Error for inp
ut '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[73,4] Error for inp
ut '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[73,15] mismatched i
nput '"canvas"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable.smali[200,4] Error for in
put '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[200,15] mismatched
input '"padding"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable.smali[217,4] Error for in
put '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[218,4] Error for in
put '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[217,15] mismatched
input '"r"' expecting END_METHOD_DIRECTIVE
classout\android\graphics\drawable\ColorizableDrawable.smali[219,4] Error for in
put '.parameter': Invalid directive
classout\android\graphics\drawable\ColorizableDrawable.smali[227,4] missing EOF
at '.prologue'
 
Last edited:

Jeka_Osokin

Senior Member
Jun 25, 2012
272
166
Irbit
Please guys,
Read the thread title properly.

This thread is for colorizable function. Text color changing isn't related to it.

Colorizable Function colored image files only.

Please don't go off-topic or do spamming.
Keep the thread clean...

Can you make a tutorial how to port checkable function?
Sorry if i ask not 1 time...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    Hi, guys...

    Many user keep PM'ing me how to port colorizable function.
    So I decide to do a simple guide for them.
    Make sure you have a basic knowledge on how to compile/decompile .jar files.

    Here you will find two types of tutorial.
    First one is the simplest way and second one is the best way.


    The Simplest Way :

    • Download Simplest.zip file from attachment
    • Decompile your framework.jar
    • Navigate to [framework.jar]\smali
    • Copy and replace all folders and files from Simplest.zip
    • Recompile your framework.jar


    The Best Way :

    • Download Best.zip file from attachment
    • Decompile framework.jar
    • Navigate to [framework.jar]\smali\android\graphics\drawable
    • Copy the files from Best.zip
    • Navigate to [framework.jar]\smali\android\graphics\drawable\Drawable.smali
    • Search for new-instance v2, Lorg/xmlpull/v1/XmlPullParserException;
    • Add the red lines only

      .line 863
      .end local v0 #drawable:Landroid/graphics/drawable/Drawable;
      :cond_e
      const-string v2, "colorizable"

      invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

      move-result v2

      if-eqz v2, :cond_10

      .line 862
      new-instance v0, Landroid/graphics/drawable/ColorizableDrawable;

      invoke-direct {v0}, Landroid/graphics/drawable/ColorizableDrawable;-><init>()V

      .line 863
      .restart local v0 #drawable:Landroid/graphics/drawable/Drawable;
      goto/16 :goto_0

      .line 869
      .end local v0 #drawable:Landroid/graphics/drawable/Drawable;
      :cond_10

      new-instance v2, Lorg/xmlpull/v1/XmlPullParserException;

      new-instance v3, Ljava/lang/StringBuilder;


      Colorixable_Tut_1.jpg

    • Save the file
    • Navigate to [framework.jar]\smali\com\android\internal\R$styleable.smali
    • Search for .field public static final ColorDrawable_color:I = 0x0
    • Add the red lines only

      .field public static final ColorDrawable_color:I = 0x0

      .field public static final ColorizableDrawable:[I = null

      .field public static final ColorizableDrawable_color:I = 0x1

      .field public static final ColorizableDrawable_drawable:I = 0x0


      .field public static final CompoundButton:[I = null


      Colorixable_Tut_2.jpg

    • Search for sput-object v0, Lcom/android/internal/R$styleable;->ColorDrawable:[I
    • Add the red lines only

      sput-object v0, Lcom/android/internal/R$styleable;->ColorDrawable:[I

      new-array v0, v4, [I

      fill-array-data v0, :array_9d

      sput-object v0, Lcom/android/internal/R$styleable;->ColorizableDrawable:[I


      .line 30543


      Colorixable_Tut_3.jpg

    • Search for sput-object v0, Lcom/android/internal/R$styleable;->WindowAnimation:[I
    • Add the red line only

      sput-object v0, Lcom/android/internal/R$styleable;->WindowAnimation:[I

      return-void

      .line 21653
      nop

      :array_0
      .array-data 0x4


      Colorixable_Tut_4.jpg

    • Search for .method public constructor <init>()V
    • Add the red lines only

      [/I].end array-data

      :array_9d
      .array-data 0x4
      0x99t 0x1t 0x1t 0x1t
      0xa5t 0x1t 0x1t 0x1t
      .end array-data

      .end method

      .method public constructor <init>()V[/I]

      Colorixable_Tut_5.jpg

    • Save the file
    • Recompile your framework.jar


    Please Note :

    • Take backup before doing anything.
    • Use Notepad++ to edit files.
    • Don't forget to save the file after editing.
    • If you use ApkTool to decompile framework.jar then your path will be [framework.jar]\classout instead of [framework.jar]\smali
    • Please read the tutorial properly befor editing files.
    8
    [TUT] How To Use Colorizable Function

    Here I will teach you how to use this colorizable function.

    I will color the power menu tab.
    For this we have to edit framework-res.apk, here we go...


    • Decompile your framework-res.apk
    • Navigate to [framework-res.apk]\res\drawable-hdpi
    • Search for tab_selected_holo.9.png, open with any photo editor and change the blue part to white
    • Save tab_selected_holo.9.png as tab_selected_holo_colored.9.png name and put it in [framework-res.apk]\res\drawable-hdpi folder
    • Navigate to [framework-res.apk]\res\drawable
    • Search for silent_mode_indicator.xml and open it in any text editor
    • Change



      to



      Colorixable_Tut_6.jpg

    • Save the file
    • Creat a file with name silent_mode_indicator_colored.xml and open it in any text editor
    • Copy and paste these line in that file




      Colorixable_Tut_7.jpg

    • Green marked text is the name of that png file which will be colored.
    • Blue marked text is the color code. That tab_selected_holo_colored.9.png will be colored by this color.
    • #00000000 means it will be colored according to the color of SemcGenericUxpRes.apk. You can put here any other color code of your choice if you don't want to change color according to the color of SemcGenericUxpRes.apk.
    • Save the file and put it in [framework-res.apk]\res\drawable folder
    • Recompile your framework-res.apk


    Thanks:

    2
    @BDFreak

    I mean the Titles in the Settings App not the divider.

    Changing the Color of the Setting App Titles According to the Theme.

    Decompile Settings.apk then findout that title related xml and put "@com.sonyericsson.uxp:color/semc_theme_accent_color" instead of color code.

    PS : This thread is about how to port colorizable function in framework.jar.
    1
    If needed...
    1
    Great bro :) finally you have posted it :good: it is really helpful