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.
- [Guide]T-mobile theme engine.
- [Tool]XML generator.
- [Guide]How to theme CM10.1.
- CM 10 theme mega thread.
- [How to] XMLGenerator and .bat script
Knowledge is power!
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.
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.
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.
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.
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:
<?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="com.google.android.gm" android:resource="@xml/com_google_android_gm" android:minSdkVersion="16" /> </theme-redirections>
- 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.
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:
<?xml version="1.0" encoding="utf-8"?> <resources> <item name="mipmap/ic_launcher_mail">@mipmap/com_google_android_gm_ic_launcher_mail</item> </resources>
- Red= Resource redirection syntax.
- Blue= Original directory and resource
- Green= Redirection directory and resource
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.