[Guide] Porting CM10/.1 themes to XTheme

Search This thread

dully79

Senior Member
Apr 29, 2010
2,845
3,395
res/drawable
droidcandy.weebly.com
2lw9khx.jpg


2vsnew6.jpg

Want to port CM11 themes? Go here:
CMX- Port CM11 themes in one click.



I will update the information whenever time allows.
Please feel free to contribute or discuss.

In this first post I'm going to try and explain what XTheme and the theme apk's are and how they work. Why? Because you'll have a better understanding of the workings, this will hopefully enable better self sufficiency.
In the second post i'll describe how to set up an environment to port themes and the process of how to port CM 10 themes to XTheme.

I'm going to assume you know nothing about anything to try and cover everything. I myself don't know everything, but what i do know I will try to share.
I'm going to try and keep this as basic as possible so anyone with no knowledge can follow along.

There are already some brilliant guides out there that will help if you read them, so i will link to them instead of regurgitating info from them.

Knowledge is power!


azg2c.jpg

You can find the XTheme thread here containing install instructions, compatible devices and more.

Basically it performs in a similar manner to the theme chooser engine for CM based ROM's... but for ROM bases other than just CM. Until now-18/04/13, the theme chooser engine was restricted to CM based ROM's. XTheme makes it possible to theme stock ROM's.


avt0yt.jpg

The theme chooser engine allows you to choose a theme and apply it whilst your device is turned on without overwriting your stock images (requires a reboot to see full changes).
This is opposed to a different method of theming, zip flashing or Metamorphing. These methods overwrites either whole apk's or just the relevant images depending on the method you use.

The beauty of the theme chooser is if you decide to change theme or remove it, there is no fallout from the theme that was applied, so all the images are returned back to stock. This isn't really possible through Metamorph or zip flashing unless you use VRTheme or the Universal theme zip which creates a backup. Even so i've found this doesn't work 100%. And restoring your original images through Metamorph and zip flashing can be a painful and tiresome task.

The theme chooser works by redirecting images from inside a theme apk, provided that the relevant images and redirection are present.
If the images or redirections are not present for battery icons for example, then the battery icons will not be themed.
A simple and clean method to theme.


11azy8p.jpg

Now you know how the engine works we'll talk about the theme apk.

Within the apk is a folder named "res", this contains all the images and xml files that is used within the theme.

Inside the "res" directory are a number folders. Depending on the theme you are porting/creating, some folders will not be used. The folders are mainly self explanatory and these include:


  • anim ~Controls animations, e.g. screen fades, rotations etc.
  • color ~xmls control colors used in the theme.
  • drawable ~Contains xmls that control drawables.
  • drawable-*dpi ~Contains theme images and possibly xml's.
  • layout ~Contains xml's that controls the layout values of elements in the theme.
  • mipmap-*dpi ~Houses "ic_launcher" icons.
  • values ~Contains xmls including strings, styles, drawables which we will discuss later.
  • xml ~Contains the redirection xmls. This is where the magic happens.
You can find more in depth details here:
http://developer.android.com/guide/topics/resources/providing-resources.html

If you are unsure where to house elements when adding to your theme, simply look inside the original apk.
For example if i want to theme the icon of Gmail, i would extract the Gmail apk and search for the location of the launcher icon. This is located in mipmap-*dpi, so i would add it to the mipmap-*dpi directory in my theme with the relevant redirections.


e6eflj.jpg

The redirections xml diverts the original package resources to the theme resources.

Here's a little workflow for changing the Gmail launcher icon.

This is achieved by adding the relevant syntax to the redirection.xml like so:
Code:
<?xml version="1.0" encoding="utf-8"?>
<theme-redirections
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
    [COLOR=Red]<package-redirections android:name="[COLOR=RoyalBlue]com.google.android.gm[/COLOR]" android:resource="@xml/[COLOR=SeaGreen]com_google_android_gm[/COLOR]" android:minSdkVersion="16" />[/COLOR]    
</theme-redirections>
I have highlighted the package redirection above to break it down.

  • Red= Package redirection syntax.
  • Blue= Original package name. Found in the "AndroidManifest"
  • Green= Redirection package name. you can call this anything but i strongly suggest you stick with the original and change "." to "_" as above.
This has told the engine to divert "com.google.android.gm" (Gmail.apk) to use the resources defined in "com_google_android_gm".xml in the theme xml folder.


Now we need to create an xml inside the xml folder named "com_google_android_gm".
Within this xml we add the correct syntax for the resources to be used:


Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    [COLOR=Red]<item name="[COLOR=Blue]mipmap/ic_launcher_mail[/COLOR]">@[COLOR=SeaGreen]mipmap/com_google_android_gm_ic_launcher_mail[/COLOR]</item>[/COLOR]
</resources>
  • Red= Resource redirection syntax.
  • Blue= Original directory and resource
  • Green= Redirection directory and resource
This is telling the engine to display "com_google_android_gm_ic_launcher_mail".png located in the mipmap-*dpi directory within the theme apk.
Now we add the "com_google_android_gm_ic_launcher_mail".png into the mipmap-*dpi directory to complete the redirection process.

You can see why i suggest to keep the redirection package name the same. it keeps a consistency that's easy to follow.
 
Last edited:

dully79

Senior Member
Apr 29, 2010
2,845
3,395
res/drawable
droidcandy.weebly.com
2lu5fus.jpg


Time Taken:
Setting up 10 minutes
Porting 10 minutes

Difficulty:
jrcn6v.jpg




24fjino.jpg


Post any other threads here and i will add them to the above list.



9vfq7d.jpg

Now we know the basics of how the engine and redirections work we can start creating/porting some themes.

We need to gather some tools for the process:

  • Java Link
  • ApkManager/Multitool Link
  • CM10 theme to port Take your pick.
  • SampleTheme.apk Link at bottom of the page.
  • Notepad++ Link
  • 7zip Link
  • Weapon of choice- i chose a beverage with alcoholic content. Link


Java.
Download, install and add bin path to your environment variables.

Windows 7.

  1. Select Computer from the Start menu
  2. Choose System Properties from the context menu
  3. Click Advanced system settings > Advanced tab
  4. Click on Environment Variables, under System Variables, click "new".
  5. In the "variable name" field enter JAVA_HOME
  6. In the "variable value" field enter the "bin" location from the java folder.
    My location is "C:\Program Files\Java\jre7\bin"
  7. Reboot.
  8. Open a cmd window and type java. If you added the path correctly you will receive an help menu. If not try to add the path again.

For more help see below or use Google.
http://www.java.com/en/download/help/path.xml

ApkManager/Multitool.

Extract and read the "README"
You can also follow instructions here:
http://forum.xda-developers.com/showthread.php?t=1310151


2r3fdj5.jpg


Alternative method. Thanks pier10.

Firstly let me say. If you do not have a redirections.xml in the CM theme xml folder you will need to create one.
See this post for details.


Once we have our environment setup we can get started.

XTheme creator ruqqq has described how to port CM themes in his thread but ill try to expand it.
http://forum.xda-developers.com/showpost.php?p=40428425&postcount=2

1 .Run the setup.bat and select option 3 to create directories.
2. Place your CM10 and SampleTheme.apk's in "place-apk-here-for-modding". Sample theme link. CM10 theme link.
3. Run script.bat and choose option 24 to set project.
4. Select your CM 10 theme apk and choose option 9 to decompile.
5. Repeat the process with the sample theme
6. Your now presented with 2 output folders in "projects" with the same name as the apk.
7. Enter "projects/SampleTheme.apk" and delete the "res" folder.
8. Goto the CM10 theme in projects and copy the "res" folder across into the SampleTheme.apk folder.
9. Open both "AndroidManifest.xml" with notepad++
10. In the SampleTheme AndroidManifest change
Code:
package="[COLOR=Red]sg.ruqqq.theme.SampleTheme[/COLOR]"
with the package name from the CM10 AndroidManifest. Add an X or Xtheme to the end of the package name to differentiate it from the original.

Code:
package="sg.ruqqq.theme.SampleTheme"
Becomes
Code:
package="com.vicino.theme.honeycombl.xtheme"
Or
Code:
package="com.vicino.theme.honeycomb.x"

We can also reflect the change in res/values/strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">HoneycombTheme</string>
    <string name="theme_name">HoneycombTheme</string>
    <string name="style_appearance_name">HoneycombTheme</string>
    <string name="author">vicino</string>
    <string name="copyright">vicino</string>
</resources>
Becomes
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">HoneycombTheme X</string>
    <string name="theme_name">HoneycombTheme X</string>
    <string name="style_appearance_name">HoneycombTheme</string>
    <string name="author">vicino</string>
    <string name="copyright">vicino</string>
</resources>
11. Check If the theme contains a redirections.xml (res/xml/redirections.xml), if it doesn't you must create one. See the post above headed "redirections.xml" orsee this post for details on editing. You should have a line of code for each package xml file in the xml folder.
This applies to every ROM. If the theme does not contain a redirections.xml it will not redirect resources.
Delete any unused lines of code.

If you are using a "stock" ROM, example TouchWiz(Samsung), Sense(HTC), Semc(Sony), open up "android.xml" in res/xml and add redirections for your OEM images.
For Sony based ROM's you can find my redirections below. For other ROM's you will have to create them or find them
http://forum.xda-developers.com/showpost.php?p=40024969&postcount=5

TIP:
My redirections syntax refer to framework images as "framework_res", if the theme you are porting uses "frameworks_res" for example follow this:

  • Open up the android xml with NotePad ++.
  • Click the search tab at the top and select replace.
  • In the field "Find what" enter @drawable/framework_res.
  • In the field "Replace with" enter @drawable/frameworks_res.
  • Click replace all, save and close.

12. Compile the project by selecting 12. When prompted select option 2.
13. You will recieve a "unsignedSampleTheme.apk" in the "place-apk-here-for-modding" folder. Select option 13 to sign the apk.
14. You now have a "signedSampleTheme.apk" in "place-apk-here-for-modding", you can rename this to the CM10 theme name.
15. Place the apk on your device, install, apply and reboot.


v336uh.jpg

@ruqqq for the XTheme engine.
CM team for the Theme chooser engine.
All the authors of the guides and posts.
@MrDSL for helping me out with Theme Chooser.
@mcsqwizzys98, @Rycon33, @josephnero, @peetr_ and many others over on the Xperia T forum (sorry if i forgot anyone).
@Brut.all, @iBotPeaches, @JesusFreke, @Daneshm90, and @raziel23x for apktool, smali/ baksmali, apkManager/multiTool,
@rovo89 and @Tungstwenty for making this possible with Xposed framework.
@vicino for using Honeycomb theme as an example.
Everyone else who they credited.


2dhts9i.jpg


Q.Why does the ported theme not look 100% as the original theme?
A.

There are 2 reason for this. Firstly, as stated in the previous post, styles.xml is not working for XThemeEngine. Hence, the ported themes would not work 100%. For better success, port a theme which is closer to Holo styles (dark background, bright text). Second reason, which is the most common reason, is that the theme is made for CM10. CM10 is very close to AOSP while your device which is running stock rom only retain some parts of AOSP. The theme need to be properly ported (analyze your stock rom frameworks and redirect the proper files in your ported theme etc.) to fully support your device.
Q. My theme is not recognized.
A. Make sure you have permissions in the android.manifest.xml.
Code:
<uses-permission android:name="sg.ruqqq.XThemeEngine.permission.SYSTEM_THEME" />
Q. Nothing is themed!?.
A. You must have a "redirections.xml" and package.xml's in the "res/xml" folder


If you plan on releasing any ported themes then ask the author of the theme for permission and give credits and link back to their thread. Not only is this good community manners, it's XDA rules.

XDA rule 12:


12. Using the work of others.

If you are developing something that is based on the work of another Member, you MUST first seek their permission, and you must give credit to the member whose work you used. If a dispute occurs about who developed / created a piece of work, first try to settle the matter by private message and NOT in open forum. If this fails then you may contact a moderator with clear evidence that the work was created by you.

Convincing evidence will result in copied work being removed. If there is no clear evidence you created the work then in the spirit of sharing all work will remain posted on the forums.

As an addition, developers have the right to hold exclusivity over their work for as long as it is deemed necessary by the dev or freely share it. However, if the work is claimed as exclusive, it must remain as such. No selective sharing will be allowed (ie allowing certain people to use it and not others). Should the dev decide to start sharing the work with others, the work automatically becomes fair game for all to use.

In regards to permissions, same rules remain for this but if permission was already given, unless there is a very valid reason, it cannot be revoked (same applies to major updates on the work). Under that same premise, permissions cannot be denied unless the work is exclusive or under severe circumstances.

In plain English: If you want to keep your work exclusive, go for it. However, if you are going to share your work, do it fairly.

These rules apply to all software posted on XDA (including but not limited to ROMs, RUUs, apps, games, kernels, themes, icons, etc) unless that software comes with a license that waives these rules.
 
Last edited:

Rycon33

Senior Member
Apr 28, 2011
3,217
2,130
Xiaomi Poco F3
very nice guide dully:good:

it's very comprehensible:)

i'd like to add some redirections for Xperia(coz Sony always do some funny funny things :D)

at android.xml:
- for screenshot dialog image
Code:
    <item name="drawable/semc_ic_dialog_screenshot">@drawable/frameworks_res_ic_lock_screenshot</item>

at com_android_systemui.xml:
- for data H+
Code:
    <item name="drawable/stat_sys_data_connected_h_plus">@drawable/com_android_systemui_stat_sys_data_connected_hp</item>
    <item name="drawable/stat_sys_data_fully_connected_h_plus">@drawable/com_android_systemui_stat_sys_data_fully_connected_hp</item>
 

Rycon33

Senior Member
Apr 28, 2011
3,217
2,130
Xiaomi Poco F3
Rycon and his hplus icon;)

Sent from my LT30p using Tapatalk 4 Beta

hahaha, true mate, as you know i'm mostly on mobile:D

i'll add some more later, those i can remember

EDIT: Another option for ApkManager is TickleMyAndroid tool for de/recompiling, signing apks.

EDIT2: If you want to have a nice Sony accent theme that can blend well to any ported themes, try to mod an existing Sony accent theme. I personally used white accent(ccffffff) so the default toggles, panel clock, etc won't look out of place when using any ported XTheme theme.
 
Last edited:

Drockk_Xm

Senior Member
Feb 21, 2012
497
308
Dhaka
i port a theme flowing your guide
Bt when i click apply its shows failed please help
i m using xtheme engine beta5
only i skip step 10 is it mandatory?
 

Drockk_Xm

Senior Member
Feb 21, 2012
497
308
Dhaka
Only if your using an OEM ROM and want the theme to work fully on your device.

Can you post your AndroidManifest.xml or post the contents and wrap code tags around it, thanks.

AndroidManifest.xml
PHP:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:hasCode="false" package="com.gekn.theme.Sense5.xtheme"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
    <uses-permission android:name="sg.ruqqq.XThemeEngine.permission.SYSTEM_THEME" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" />
</manifest>
 
  • Like
Reactions: dully79

dully79

Senior Member
Apr 29, 2010
2,845
3,395
res/drawable
droidcandy.weebly.com
AndroidManifest.xml
PHP:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:hasCode="false" package="com.gekn.theme.Sense5.xtheme"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
    <uses-permission android:name="sg.ruqqq.XThemeEngine.permission.SYSTEM_THEME" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" />
</manifest>

Ok your manifest is fine, can you send me your apk or link to the original?
 
  • Like
Reactions: Drockk_Xm

dully79

Senior Member
Apr 29, 2010
2,845
3,395
res/drawable
droidcandy.weebly.com
Last edited:
  • Like
Reactions: Drockk_Xm

MrDSL

Senior Member
Nov 17, 2006
7,456
2,598
Now that I have my Optimus pro g and have been working with this more I gotta say its more frustrating then anything..

Metamorph using zipthemer from the market seems like a better alternative.

Stuff that should work and clearly works in other areas just randomly doesn't work for no known reason.

Very fustrating..
 

dully79

Senior Member
Apr 29, 2010
2,845
3,395
res/drawable
droidcandy.weebly.com
Now that I have my Optimus pro g and have been working with this more I gotta say its more frustrating then anything..

Metamorph using zipthemer from the market seems like a better alternative.

Stuff that should work and clearly works in other areas just randomly doesn't work for no known reason.

Very fustrating..

Without a doubt. Now you know why I feel like I'm banging my head against a wall.
You definitely need to hide anything that is fragile and within arms reach when messing with xtheme.
 

harisaduelite

Senior Member
Feb 21, 2013
118
30
Kansas City
There is no redirections.xml in res/xml.
Edit: After looking at it more that theme isnt very well constructed.
None of the images have package names designated to them, so it's a bit of a free for all inside res/drawable-*dpi.

here is my apk link bro
http://d-h.st/9fQ
I have added redirections. Xml as well n added permissions as well then wat is d problem

Sent from my Galaxy GT-I9500 using xda premium
 

cartmenicus

Senior Member
Nov 27, 2011
2,954
1,972
24
British columbia
here is my apk link bro
http://d-h.st/9fQ
I have added redirections. Xml as well n added permissions as well then wat is d problem

Sent from my Galaxy GT-I9500 using xda premium

Why don't you read the quide and figure it out like most people this honestly isn't really that hard at all you make redirections delete the public file and make sure yo add device specific redirections in android XML and your done-_-

Sent from my LT30p using Tapatalk 4 Beta
 
  • Like
Reactions: dully79

dully79

Senior Member
Apr 29, 2010
2,845
3,395
res/drawable
droidcandy.weebly.com
here is my apk link bro
http://d-h.st/9fQ
I have added redirections. Xml as well n added permissions as well then wat is d problem

Sent from my Galaxy GT-I9500 using xda premium

You've quoted a post that WASN'T directed at you. It was for Drockk. And ive told you, your AndroidManifest is messed up. Use the one from the SampleTheme.apk just like the guide describes and i guarantee it will work.
 
  • Like
Reactions: cartmenicus

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    2lu5fus.jpg


    Time Taken:
    Setting up 10 minutes
    Porting 10 minutes

    Difficulty:
    jrcn6v.jpg




    24fjino.jpg


    Post any other threads here and i will add them to the above list.



    9vfq7d.jpg

    Now we know the basics of how the engine and redirections work we can start creating/porting some themes.

    We need to gather some tools for the process:

    • Java Link
    • ApkManager/Multitool Link
    • CM10 theme to port Take your pick.
    • SampleTheme.apk Link at bottom of the page.
    • Notepad++ Link
    • 7zip Link
    • Weapon of choice- i chose a beverage with alcoholic content. Link


    Java.
    Download, install and add bin path to your environment variables.

    Windows 7.

    1. Select Computer from the Start menu
    2. Choose System Properties from the context menu
    3. Click Advanced system settings > Advanced tab
    4. Click on Environment Variables, under System Variables, click "new".
    5. In the "variable name" field enter JAVA_HOME
    6. In the "variable value" field enter the "bin" location from the java folder.
      My location is "C:\Program Files\Java\jre7\bin"
    7. Reboot.
    8. Open a cmd window and type java. If you added the path correctly you will receive an help menu. If not try to add the path again.

    For more help see below or use Google.
    http://www.java.com/en/download/help/path.xml

    ApkManager/Multitool.

    Extract and read the "README"
    You can also follow instructions here:
    http://forum.xda-developers.com/showthread.php?t=1310151


    2r3fdj5.jpg


    Alternative method. Thanks pier10.

    Firstly let me say. If you do not have a redirections.xml in the CM theme xml folder you will need to create one.
    See this post for details.


    Once we have our environment setup we can get started.

    XTheme creator ruqqq has described how to port CM themes in his thread but ill try to expand it.
    http://forum.xda-developers.com/showpost.php?p=40428425&postcount=2

    1 .Run the setup.bat and select option 3 to create directories.
    2. Place your CM10 and SampleTheme.apk's in "place-apk-here-for-modding". Sample theme link. CM10 theme link.
    3. Run script.bat and choose option 24 to set project.
    4. Select your CM 10 theme apk and choose option 9 to decompile.
    5. Repeat the process with the sample theme
    6. Your now presented with 2 output folders in "projects" with the same name as the apk.
    7. Enter "projects/SampleTheme.apk" and delete the "res" folder.
    8. Goto the CM10 theme in projects and copy the "res" folder across into the SampleTheme.apk folder.
    9. Open both "AndroidManifest.xml" with notepad++
    10. In the SampleTheme AndroidManifest change
    Code:
    package="[COLOR=Red]sg.ruqqq.theme.SampleTheme[/COLOR]"
    with the package name from the CM10 AndroidManifest. Add an X or Xtheme to the end of the package name to differentiate it from the original.

    Code:
    package="sg.ruqqq.theme.SampleTheme"
    Becomes
    Code:
    package="com.vicino.theme.honeycombl.xtheme"
    Or
    Code:
    package="com.vicino.theme.honeycomb.x"

    We can also reflect the change in res/values/strings.xml
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="app_name">HoneycombTheme</string>
        <string name="theme_name">HoneycombTheme</string>
        <string name="style_appearance_name">HoneycombTheme</string>
        <string name="author">vicino</string>
        <string name="copyright">vicino</string>
    </resources>
    Becomes
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="app_name">HoneycombTheme X</string>
        <string name="theme_name">HoneycombTheme X</string>
        <string name="style_appearance_name">HoneycombTheme</string>
        <string name="author">vicino</string>
        <string name="copyright">vicino</string>
    </resources>
    11. Check If the theme contains a redirections.xml (res/xml/redirections.xml), if it doesn't you must create one. See the post above headed "redirections.xml" orsee this post for details on editing. You should have a line of code for each package xml file in the xml folder.
    This applies to every ROM. If the theme does not contain a redirections.xml it will not redirect resources.
    Delete any unused lines of code.

    If you are using a "stock" ROM, example TouchWiz(Samsung), Sense(HTC), Semc(Sony), open up "android.xml" in res/xml and add redirections for your OEM images.
    For Sony based ROM's you can find my redirections below. For other ROM's you will have to create them or find them
    http://forum.xda-developers.com/showpost.php?p=40024969&postcount=5

    TIP:
    My redirections syntax refer to framework images as "framework_res", if the theme you are porting uses "frameworks_res" for example follow this:

    • Open up the android xml with NotePad ++.
    • Click the search tab at the top and select replace.
    • In the field "Find what" enter @drawable/framework_res.
    • In the field "Replace with" enter @drawable/frameworks_res.
    • Click replace all, save and close.

    12. Compile the project by selecting 12. When prompted select option 2.
    13. You will recieve a "unsignedSampleTheme.apk" in the "place-apk-here-for-modding" folder. Select option 13 to sign the apk.
    14. You now have a "signedSampleTheme.apk" in "place-apk-here-for-modding", you can rename this to the CM10 theme name.
    15. Place the apk on your device, install, apply and reboot.


    v336uh.jpg

    @ruqqq for the XTheme engine.
    CM team for the Theme chooser engine.
    All the authors of the guides and posts.
    @MrDSL for helping me out with Theme Chooser.
    @mcsqwizzys98, @Rycon33, @josephnero, @peetr_ and many others over on the Xperia T forum (sorry if i forgot anyone).
    @Brut.all, @iBotPeaches, @JesusFreke, @Daneshm90, and @raziel23x for apktool, smali/ baksmali, apkManager/multiTool,
    @rovo89 and @Tungstwenty for making this possible with Xposed framework.
    @vicino for using Honeycomb theme as an example.
    Everyone else who they credited.


    2dhts9i.jpg


    Q.Why does the ported theme not look 100% as the original theme?
    A.

    There are 2 reason for this. Firstly, as stated in the previous post, styles.xml is not working for XThemeEngine. Hence, the ported themes would not work 100%. For better success, port a theme which is closer to Holo styles (dark background, bright text). Second reason, which is the most common reason, is that the theme is made for CM10. CM10 is very close to AOSP while your device which is running stock rom only retain some parts of AOSP. The theme need to be properly ported (analyze your stock rom frameworks and redirect the proper files in your ported theme etc.) to fully support your device.
    Q. My theme is not recognized.
    A. Make sure you have permissions in the android.manifest.xml.
    Code:
    <uses-permission android:name="sg.ruqqq.XThemeEngine.permission.SYSTEM_THEME" />
    Q. Nothing is themed!?.
    A. You must have a "redirections.xml" and package.xml's in the "res/xml" folder


    If you plan on releasing any ported themes then ask the author of the theme for permission and give credits and link back to their thread. Not only is this good community manners, it's XDA rules.

    XDA rule 12:


    12. Using the work of others.

    If you are developing something that is based on the work of another Member, you MUST first seek their permission, and you must give credit to the member whose work you used. If a dispute occurs about who developed / created a piece of work, first try to settle the matter by private message and NOT in open forum. If this fails then you may contact a moderator with clear evidence that the work was created by you.

    Convincing evidence will result in copied work being removed. If there is no clear evidence you created the work then in the spirit of sharing all work will remain posted on the forums.

    As an addition, developers have the right to hold exclusivity over their work for as long as it is deemed necessary by the dev or freely share it. However, if the work is claimed as exclusive, it must remain as such. No selective sharing will be allowed (ie allowing certain people to use it and not others). Should the dev decide to start sharing the work with others, the work automatically becomes fair game for all to use.

    In regards to permissions, same rules remain for this but if permission was already given, unless there is a very valid reason, it cannot be revoked (same applies to major updates on the work). Under that same premise, permissions cannot be denied unless the work is exclusive or under severe circumstances.

    In plain English: If you want to keep your work exclusive, go for it. However, if you are going to share your work, do it fairly.

    These rules apply to all software posted on XDA (including but not limited to ROMs, RUUs, apps, games, kernels, themes, icons, etc) unless that software comes with a license that waives these rules.
    21
    2lw9khx.jpg


    2vsnew6.jpg

    Want to port CM11 themes? Go here:
    CMX- Port CM11 themes in one click.



    I will update the information whenever time allows.
    Please feel free to contribute or discuss.

    In this first post I'm going to try and explain what XTheme and the theme apk's are and how they work. Why? Because you'll have a better understanding of the workings, this will hopefully enable better self sufficiency.
    In the second post i'll describe how to set up an environment to port themes and the process of how to port CM 10 themes to XTheme.

    I'm going to assume you know nothing about anything to try and cover everything. I myself don't know everything, but what i do know I will try to share.
    I'm going to try and keep this as basic as possible so anyone with no knowledge can follow along.

    There are already some brilliant guides out there that will help if you read them, so i will link to them instead of regurgitating info from them.

    Knowledge is power!


    azg2c.jpg

    You can find the XTheme thread here containing install instructions, compatible devices and more.

    Basically it performs in a similar manner to the theme chooser engine for CM based ROM's... but for ROM bases other than just CM. Until now-18/04/13, the theme chooser engine was restricted to CM based ROM's. XTheme makes it possible to theme stock ROM's.


    avt0yt.jpg

    The theme chooser engine allows you to choose a theme and apply it whilst your device is turned on without overwriting your stock images (requires a reboot to see full changes).
    This is opposed to a different method of theming, zip flashing or Metamorphing. These methods overwrites either whole apk's or just the relevant images depending on the method you use.

    The beauty of the theme chooser is if you decide to change theme or remove it, there is no fallout from the theme that was applied, so all the images are returned back to stock. This isn't really possible through Metamorph or zip flashing unless you use VRTheme or the Universal theme zip which creates a backup. Even so i've found this doesn't work 100%. And restoring your original images through Metamorph and zip flashing can be a painful and tiresome task.

    The theme chooser works by redirecting images from inside a theme apk, provided that the relevant images and redirection are present.
    If the images or redirections are not present for battery icons for example, then the battery icons will not be themed.
    A simple and clean method to theme.


    11azy8p.jpg

    Now you know how the engine works we'll talk about the theme apk.

    Within the apk is a folder named "res", this contains all the images and xml files that is used within the theme.

    Inside the "res" directory are a number folders. Depending on the theme you are porting/creating, some folders will not be used. The folders are mainly self explanatory and these include:


    • anim ~Controls animations, e.g. screen fades, rotations etc.
    • color ~xmls control colors used in the theme.
    • drawable ~Contains xmls that control drawables.
    • drawable-*dpi ~Contains theme images and possibly xml's.
    • layout ~Contains xml's that controls the layout values of elements in the theme.
    • mipmap-*dpi ~Houses "ic_launcher" icons.
    • values ~Contains xmls including strings, styles, drawables which we will discuss later.
    • xml ~Contains the redirection xmls. This is where the magic happens.
    You can find more in depth details here:
    http://developer.android.com/guide/topics/resources/providing-resources.html

    If you are unsure where to house elements when adding to your theme, simply look inside the original apk.
    For example if i want to theme the icon of Gmail, i would extract the Gmail apk and search for the location of the launcher icon. This is located in mipmap-*dpi, so i would add it to the mipmap-*dpi directory in my theme with the relevant redirections.


    e6eflj.jpg

    The redirections xml diverts the original package resources to the theme resources.

    Here's a little workflow for changing the Gmail launcher icon.

    This is achieved by adding the relevant syntax to the redirection.xml like so:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <theme-redirections
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
        [COLOR=Red]<package-redirections android:name="[COLOR=RoyalBlue]com.google.android.gm[/COLOR]" android:resource="@xml/[COLOR=SeaGreen]com_google_android_gm[/COLOR]" android:minSdkVersion="16" />[/COLOR]    
    </theme-redirections>
    I have highlighted the package redirection above to break it down.

    • Red= Package redirection syntax.
    • Blue= Original package name. Found in the "AndroidManifest"
    • Green= Redirection package name. you can call this anything but i strongly suggest you stick with the original and change "." to "_" as above.
    This has told the engine to divert "com.google.android.gm" (Gmail.apk) to use the resources defined in "com_google_android_gm".xml in the theme xml folder.


    Now we need to create an xml inside the xml folder named "com_google_android_gm".
    Within this xml we add the correct syntax for the resources to be used:


    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        [COLOR=Red]<item name="[COLOR=Blue]mipmap/ic_launcher_mail[/COLOR]">@[COLOR=SeaGreen]mipmap/com_google_android_gm_ic_launcher_mail[/COLOR]</item>[/COLOR]
    </resources>
    • Red= Resource redirection syntax.
    • Blue= Original directory and resource
    • Green= Redirection directory and resource
    This is telling the engine to display "com_google_android_gm_ic_launcher_mail".png located in the mipmap-*dpi directory within the theme apk.
    Now we add the "com_google_android_gm_ic_launcher_mail".png into the mipmap-*dpi directory to complete the redirection process.

    You can see why i suggest to keep the redirection package name the same. it keeps a consistency that's easy to follow.
    7
    2mcd9ox.jpg



    Thanks to @vicino, as i used his "Honeycomb Lite Theme" as an example.


    5
    Touchwiz xtheme redirection

    For those who want to port themes and would like add support for touchwiz, here is the xml's.

    https://www.dropbox.com/s/ea69n9nauu1hfob/android_xtheme.xml
    https://www.dropbox.com/s/5yfrcxrc8kmepk0/com_android_systemui_xtheme.xml


    ------------
    @dully79
    Why don't you ask mod to move this thread to android themes sub forum?
    5

    Dude, your missing all redirections other than android, you need to add them or you wont see much of a change.

    and youve got a stray tag element also:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <resource-redirections
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
        [COLOR="red"]<item />[/COLOR]
        <package-redirections android:name="android" android:resource="@xml/android" android:minSdkVersion="14" />
    </resource-redirections>

    It should look like this:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <theme-redirections
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
        <package-redirections android:name="android" android:resource="@xml/android" android:minSdkVersion="15" />
    </theme-redirections>

    If your unsure, just rip open an existing theme and compare. Its the best way to self teach and understand what people are doing without the language barrier.

    And full credit for trying. It's nice to see people get off their backside and try something for themselves.:good::)