[GUIDE] T-mobile theme engine for the faint at heart (non-linux users)

Search This thread

djdarkknight96

Inactive Recognized Themer
Nov 2, 2009
16,839
46,977
Springfield
www.designrifts.com
Would you be able to provide a link to the code? And what do you mean by having problems with playstore apps?
I'm gonna try and make a template so everyone can see the code but decompiling the apk's will give the codes.

Playstore apps I can't redirect layouts and smali...CM12 I can. Unless you email the developer to do so. Or edit the apk to take theme edits.

Sent from my BlakKat CM11 powered OnePlus One "BACON"
 

93Akkord

Senior Member
Sep 23, 2008
676
643
Coral Springs, FL
github.com
I'm gonna try and make a template so everyone can see the code but decompiling the apk's will give the codes.

Playstore apps I can't redirect layouts and smali...CM12 I can. Unless you email the developer to do so. Or edit the apk to take theme edits.

Sent from my BlakKat CM11 powered OnePlus One "BACON"

Ohh.. you're talking about layouts.. Gotcha.

I heard the Theme Chooser is gonna change again in CM12. You think that our Play Store app themes will carry over or will we have to redo those as well?

And while I'm at it, why would my switch buttons be oval and not circle? The switch files aren't even .9.png files, so I'm confused lol.

72YQjEo.png
 

djdarkknight96

Inactive Recognized Themer
Nov 2, 2009
16,839
46,977
Springfield
www.designrifts.com
Ohh.. you're talking about layouts.. Gotcha.

I heard the Theme Chooser is gonna change again in CM12. You think that our Play Store app themes will carry over or will we have to redo those as well?

And while I'm at it, why would my switch buttons be oval and not circle? The switch files aren't even .9.png files, so I'm confused lol.

72YQjEo.png
Well it's possible only because of the new style system. Will have to look closer once CM12 gets more polished. Too many things changing right now too mess with it.

In the switches you need to adjust the switch padding in settings. Thyrus showed me a few tricks to fix mine. Look in my BlakKat lite free theme and see what I did.

Sent from my BlakKat CM11 powered OnePlus One "BACON"
 

93Akkord

Senior Member
Sep 23, 2008
676
643
Coral Springs, FL
github.com
Well it's possible only because of the new style system. Will have to look closer once CM12 gets more polished. Too many things changing right now too mess with it.

In the switches you need to adjust the switch padding in settings. Thyrus showed me a few tricks to fix mine. Look in my BlakKat lite free theme and see what I did.

Sent from my BlakKat CM11 powered OnePlus One "BACON"

Hmmm.. that's what I did with mine. Use another theme as an example. Yet mines and oval and theirs is a circle lol. I'll check yours out when I get home.
 

rush25

Senior Member
Nov 12, 2011
3,359
5,039
25
Mumbai
Yeah that was a CM call, they also blocked strings, array...etc for security. Just gotta be creative and get around it the best we can. I'll be submitting theme chooser code on lollipop. Found a great tool to submit code to gerrit using Windows "finally" so system apps we won't have to worry. Just playstore apps.

Sent from my BlakKat CM11 powered OnePlus One "BACON"
tell me also that tool :)
 

93Akkord

Senior Member
Sep 23, 2008
676
643
Coral Springs, FL
github.com
I'm trying to add items to a style for the first time but nothing is working. I'm working with Chrome at the moment. The style below, if changed to Theme.Holo, changes the background to black, but does not effect the text.

Style is in values-v17
Code:
<style name="ThemeWithActionBar" parent="@android:style/Theme.Holo.Light" />

Since I've been having a hard time finding the color for the text, I decided to try and change the background color. This is what I have right now:

Code:
<style name="ThemeWithActionBar" parent="@android:style/Theme.Holo.Light">
	<item name="android:colorBackground">@color/settings_background</item>
	<item name="android:colorBackgroundCacheHint">@color/settings_background</item>
	<item name="android:colorForegroundInverse">@color/settings_background</item>
</style>

I'm at a lost as to where I can just change the background color.
 

djdarkknight96

Inactive Recognized Themer
Nov 2, 2009
16,839
46,977
Springfield
www.designrifts.com
I'm trying to add items to a style for the first time but nothing is working. I'm working with Chrome at the moment. The style below, if changed to Theme.Holo, changes the background to black, but does not effect the text.

Style is in values-v17
Code:
<style name="ThemeWithActionBar" parent="@android:style/Theme.Holo.Light" />

Since I've been having a hard time finding the color for the text, I decided to try and change the background color. This is what I have right now:

Code:
<style name="ThemeWithActionBar" parent="@android:style/Theme.Holo.Light">
<item name="android:colorBackground">@color/settings_background</item>
<item name="android:colorBackgroundCacheHint">@color/settings_background</item>
<item name="android:colorForegroundInverse">@color/settings_background</item>
</style>

I'm at a lost as to where I can just change the background color.
Your issue is Chrome has a great deal of smali land layouts bg's going to android:color/white and smali hex.

Before I add any app so I know if I can invert it is theme the actual apk first. See what's changing and from where. Otherwise you can waste hours on something in layouts.

I have chrome inverted with TeamBlackOut and I know it's not gonna be perfect.

Sent from my BlakKat CM11 powered OnePlus One "BACON"
 

93Akkord

Senior Member
Sep 23, 2008
676
643
Coral Springs, FL
github.com
Your issue is Chrome has a great deal of smali land layouts bg's going to android:color/white and smali hex.

Before I add any app so I know if I can invert it is theme the actual apk first. See what's changing and from where. Otherwise you can waste hours on something in layouts.

I have chrome inverted with TeamBlackOut and I know it's not gonna be perfect.

Sent from my BlakKat CM11 powered OnePlus One "BACON"

But since I was able to change the background color to black by change the parent to Theme.Holo, doesn't that mean the background color is taken from styles?
 

djdarkknight96

Inactive Recognized Themer
Nov 2, 2009
16,839
46,977
Springfield
www.designrifts.com
But since I was able to change the background color to black by change the parent to Theme.Holo, doesn't that mean the background color is taken from styles?
I had a typo, I was trying to say text and bg. You can try doing the attributes in styles but you might have odd effects having two values for it. Also I can't see what bg you're speaking of but I know there are bg and text in layouts and smali. So you'll not be able to fully invert it

If you add windowBackground and textColor attributes to styles it might change a few stubborn ones.

Sent from my BlakKat CM11 powered OnePlus One "BACON"
 

93Akkord

Senior Member
Sep 23, 2008
676
643
Coral Springs, FL
github.com
I had a typo, I was trying to say text and bg. You can try doing the attributes in styles but you might have odd effects having two values for it. Also I can't see what bg you're speaking of but I know there are bg and text in layouts and smali. So you'll not be able to fully invert it

If you add windowBackground and textColor attributes to styles it might change a few stubborn ones.

Sent from my BlakKat CM11 powered OnePlus One "BACON"

I'm talking about the background for Chrome's settings. This is a pick of it below when I change that style to Theme.Holo: Link
 

nitinvaid

Senior Member
Mar 7, 2011
6,131
4,804
31
New Delhi
In gmail my theme has problem In tablets
The side drawer is white it's supposed to be black

Sent from my Nexus 5 using XDA Free mobile app
 

Attachments

  • 1417299338563.jpg
    1417299338563.jpg
    24.1 KB · Views: 82

djdarkknight96

Inactive Recognized Themer
Nov 2, 2009
16,839
46,977
Springfield
www.designrifts.com
Is there any solution or Google to blame again lol

Sent from my Nexus 5 using XDA Free mobile app
You can make a modded apk but don't edit anything in values. Will fc the apk I did and it worked but then Gmail updated so I didn't update it yet. Just used existing values and dropped layouts and classes to clean apk.

Sent from my BlakKat CM11 powered OnePlus One "BACON"
 

nitinvaid

Senior Member
Mar 7, 2011
6,131
4,804
31
New Delhi
You can make a modded apk but don't edit anything in values. Will fc the apk I did and it worked but then Gmail updated so I didn't update it yet. Just used existing values and dropped layouts and classes to clean apk.

Sent from my BlakKat CM11 powered OnePlus One "BACON"

I take it as Google to blame again no solution

Sent from my Nexus 5 using XDA Free mobile app
 
  • Like
Reactions: djdarkknight96

Top Liked Posts

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

    This is a guide I put together to make themes for the T-Mobile theme engine based mostly on what i've figured out by digging into haxzamatic's awesome template.

    This does not require you to be on linux or whatever.

    This is mainly a temporary guide till an Eclipse template for the engine is released, or for those who dont want to use eclipse, etc.

    Requirements:
    -You should know how to decompile/recompile/sign apk files.
    -You should know some basic xml editing and theming.
    -basic terminal commands
    -You must install the framework for apktool, navigate to the folder containing framework-res.apk and execute -
    apktool if framework-res.apk


    GUIDE:

    1. Get the compiled Templatebread from here: http://bit.ly/hdEWsf

    2. Decompile it with apktool or whatever you use.

    3. Open the AndroidManifest.xml

    4. Change the names according to your theme. Here's my manifest for my NTSense theme:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest android:hasCode="false" android:versionCode="2" android:versionName="1.1" android:installLocation="internalOnly" package="com.nhnt11.theme.ntsense"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
        <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />
        <application android:label="@string/theme_name" android:icon="@drawable/icon">
            <activity android:label="@string/theme_name" android:name="com.tmobile.theme.Foo" />
        </application>
        <theme pluto:themeId="NTSense" pluto:styleId="@style/NTSense" pluto:name="@string/theme_name" pluto:preview="\@drawable/preview" pluto:author="@string/author" pluto:copyright="@string/copyright" pluto:wallpaperImage="@drawable/wallpaper" pluto:styleName="@string/style_appearance_name" pluto:ringtoneName="Standard" pluto:ringtoneFileName="media/audio/ringtones/Standard.mp3" pluto:notificationRingtoneName="Subtle" pluto:notificationRingtoneFileName="media/audio/notifications/Subtle.mp3" />
    </manifest>

    Note that the template xml file has "pluto:name="\@string/theme_name" - you need to remove this backslash, its a typo. it should be just "@string/theme_name" Should not be needed using latest version of apktool.

    More detail about stuff in the manifest in 2nd post.

    5. Open /res/values/strings.xml. Edit to match your theme. Here's mine again:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <resources>
        <string name="app_name">NTSense Theme</string>
        <string name="theme_name">NTSense</string>
        <string name="style_appearance_name">NTSense</string>
        <string name="author">nhnt11</string>
        <string name="copyright">nhnt11</string>
    </resources>

    6. Same for /res/values/styles.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <resources>
        <style name="NTSense" parent="@android:style/Theme" />
    </resources>

    NOTE: the name of your style must be the same as the pluto:styleID in the manifest!!!

    7. Now, if you are making a theme from scratch, go ahead and just edit the images already in the hdpi folder. compile and sign. done. But, read on anyway because i explain how the theme engine works below.

    If you want to port a theme, here's what to do:

    First, go ahead and delete all the drawable folders. Now, copy your THEMED drawable folders into the directory. You now have to add the following to your theme:
    /res/drawable-_dpi/preview.png (prefarably hdpi I guess) (I suggest that you DO NOT remove the backslash in the manifest as different locations of preview.png do not work on different screen sized devices. RETAIN the backslash!! Your theme will not have a preview, but this is a small trade off to get themes working if you're not on linux.)
    /res/drawable/wallpaper.png (this can be in drawable-_dpi for different screen res. too)
    /res/drawable-_dpi/icon.png.
    More detail on those in the second post.

    8. Now go to /res/xml - there are a ton of xml's here. Open redirections.xml.
    Here, there are entries for specifying which XML redirects which app. Add entries like so:

    <package-redirections android:name="<app package name here>"
    android:minSdkVersion="7"
    android:resource="@xml/your_xml_file(without '.xml' at the end)" />

    You have now specified that you want resources in <app> to be redirected based on what's in your_xml_file. Where and what is this your_xml_file and how do you add/modify it? That's what the rest of the xml's in the res/xml folder are.

    The rest of these xmls are the heart of the theme engine. How they work is, when android asks for an image or other resource, they come in and switch that resource for your themed one. So its sort of like a proxy server.

    Each xml contains the redirections for an app.
    For example, redirections to framework-res.apk are in android.xml, and SystemUI is in com_android_systemui.xml
    Delete files corresponding to apps you have not themed (for consistency, you might also want to delete the corresponding entry in redirections.xml. If you don't know how, just leave it). You can also add apps by using the convention, <package name>.xml where dots in the package name are separated by underscores, ie. your_package_name.xml for your.package.name

    Package names of apps can be found in their respective AndroidManifest.xml's after decompiling. See 2nd post for more detail.

    To redirect files, for eg. title_bar_portrait.9.png, just add the item to the systemui xml like so:

    Code:
    <item name="drawable/title_bar_portrait">@drawable/title_bar_portrait</item>

    Note: To make it easy to add hundreds of drawables, I've written a little xml generator - here

    Here, the "name" part tells the theme engine WHAT you're replacing.
    the part inside the item tag ("@drawable/title_..... in this case") tells it WHAT to replace it with.

    In all android packages, the @ sign means that you are referring to a resource in the package. Also, you can refer to a general system-wide resource by using @android:<whatever>

    for example, you can replace the above title_bar_portrait with statusbar_background thats already in the android framework like so:

    Code:
    <item name="drawable/title_bar_portrait">@android:drawable/statusbar_background</item>

    After the @ symbol, you have to specify the type of resource. in this case, "drawable".

    Note that because the @ symbol refers to something INSIDE your package, you SHOULD NOT use it in the item name="<blablabla>" part.

    See Variables in the second post for more detail.

    Back to the xmls.

    Pretty much all images are ALREADY entered in the xml. Just do a find and replace and get rid of all the "frameworks_res_" and "com_android_systemui_"
    for eg, it already has <item name="drawable/title_bar_portrait">@drawable/com_android_systemui_title_bar_portrait</item>, so you need to get rid of the "com_android_systemui_" part.

    Actually the professional/clean way to do it would be to rename all of your files to include "package_to_which_it_belongs_" at the front of the filename for better organisation. if you have the time and patience, do it this way!!!!

    9. Delete the /res/values/public.xml. Its useless and annoying while compiling. It will be regenerated while compiling.

    10. Try to compile the apk. you will probably get errors, because although all the resources are listed in the android.xml (or whatever) you deleted the HDPI folder so many might be missing! it will print what is missing when you compile though, so just go ahead and delete those lines.

    11. you can also re-map styles, colors, drawables, etc.. for eg. battery percentage, add this to android.xml after putting the required battery xml in res/drawable:

    <item name="drawable/stat_sys_battery">@drawable/stat_sys_battery</item>

    also for a color, just add it to /res/values/colors.xml and then in android.xml, add

    <item name="color/[name of color]">@color/[name of your color]</item>

    See variables in the second post for more info.

    12. Sign your compiled apk, and install it! If all goes well you will be able to apply and see the changes after you reboot.

    Hope this helped!
    42
    More detail

    Stuff in the Manifest
    The manifest contains several general properties of your app file.
    The following are a few which are referenced here.
    • To change the ringtone: Just put your desired ringtones/notification sound in /assets/media/audio/<Ringtones/Notifications> To prevent your theme from changing the ringtones, delete the corresponding lines from AndroidManifest.xml. I'm sure you can figure out which lines to delete. Also, you can remove the /assets folder, unless you have some other asset in it. (in which case just delete the ringtone buried inside as mentioned above)
    • Your theme's wallpaper is set to /res/drawable/wallpaper.png. Again, remove the required line from AndroidManifest.xml to make sure you dont mess up your users'wallpapers.
    • Your theme's theme chooser preview is set to /res/drawable/preview.png. (NEW - I suggest that you DO NOT remove the backslash from the manifest! (see first post))
    • The icon of your theme's apk file is set to /res/drawable-_dpi/icon.png. You should have an icon for at least one screen-size (preferably hdpi), but its nice to have it for all three.

    Variables

    This is to help those who don't have dev experience. In android packages, wherever you see an "@" symbol, the part following it will refer to a variable. A variable is basically a name given to refer to a resource for convenient use.
    Here are a few types of variables you should know about (note that the explanations may not apply to the theme chooser, but are general):
    1. drawable
    2. color
    3. style
    4. string
    5. dimen

    1. Drawables - Drawbles are, well, drawable. These are resources which android can draw. That includes your theme images, wallpaper, preview, and also stuff like the battery percentage xml's, progress bar xml's etc.

    1. Colors - Colors are colors!! Duh! LOL :). Anyway, in /res/values/colors.xml you will find an editable list of colors. Say you use green a lot in your theme. Instead of typing "#ff00ff00" everywhere, you can simply define a color called "green" here, by adding the following line:

    Code:
    <color name="green">#ff00ff00</color>

    Now, you can substitute "@color/green" wherever you want to use green.

    3. Styles - these are a little advanced. They allow you to define a set of attributes and apply the entire set to different components.

    Here's an example style:

    Code:
    <style name="mytext" parent="@android:style/TextAppearance.Small">
         <item name="android:textColor">#ffff0000</item>
    </style>

    Let's break this down -
    First of all, we're naming this style "mytext".
    We're saying that its parent is "@android:style/TextAppearance.Small".
    This means, that it automatically inherits ALL the properties of the android system style, "TextAppearance.Small" which can be found in the styles.xml in framework-res/res/values.

    Now, we're adding an item with the android attribute, "textColor". There are many attributes to choose from, you can look in the attrs.xml in framework-res/res/values. (Note that an attribute may not be applicable to every situation)

    Next we're giving the text color a value - in this case, red.

    Now, this style can be applied anywhere to get red text in the normal system font size for small text.

    Here's an example of how to use styles: post 88.

    4. Strings - Strings let you make references to text. Maybe you have your theme name everywhere, and its really long. Maybe your theme name is "supercalifragilisticexpialidocious". Well, you dont want to type that every time. So you can add the following to /res/values/strings.xml:
    Code:
    <string name="myname">supercalifragilisticexpialidocious</string>
    Now, wherever you want to use the word "supercalifragilisticexpialidocious", just substitute it with "@string/myname". And it will use whatever you defined for "myname" there.

    5. Dimensions - These store values for sizes and so on. For example, its an easy way to remember a custom text size that you need a lot. Add the following to "/res/values/dimens.xml" (this does not exist by default)
    Code:
    <dimen name="mysize">33.4sp</dimen>
    This will allow you to use the font size 33.4 by substituting "@dimen/mysize" wherever you want. For sizes in pixels, use "____.__dip" instead of "sp".

    Comments
    Comments are useful little dev tools. Comments basically let a developer (but they're useful to themers too) make comments in the code. Basically, the syntax of a comment (more on that in just a bit) tells the compiler to ignore that line(s). A side effect is that you can "comment" parts of your code - which means that you are marking it as a comment - which are not used (or not yet ready to be used), before compiling and releasing, while retaining the old code for future reference.

    How to make a comment in xml files:

    Simply surround the code you want to comment with "<!-- ......... -->.
    The "<!--" part tells the compiler where a comment starts, and "-->" tells it where the comment ends.

    More stuff will come here as I think of it.
    27
    try using com.android.calendar.CalendarApplication, but keep in mind that CAPS in app name were disallowing to theme them, this is not literally package name that uses CAPS so it can be not a real matter

    I compiled a Windows aapt that does allow the use of uppercase characters a while back. You can download it here:

    http://d-h.st/DBi

    Just replace the current aapt.exe with my compiled version and voila, you can compile with uppercase characters in xml filenames ;)

    Sent with my Samsung Galaxy S2 HD LTE
    14
    I was able to change the keyboard text predictions color as well using the color variable. But changing the text color in any layout xml is tricky and I just can't figure out which variable to use.


    OK, I figured out how to change notification/status bar text colors using styles, I was making a mistake with the attributes all this time.

    Add the following to your styles.xml -

    Code:
        <style name="TextAppearance.StatusBar" parent="@android:style/Theme">
            <item name="android:textSize">14.0sp</item>
            <item name="android:textStyle">normal</item>
            <item name="android:textColor">#ffffffff</item>
        </style>
        <style name="TextAppearance.StatusBar.EventContent" parent="@style/TextAppearance.StatusBar">
            <item name="android:textSize">14.0sp</item>
            <item name="android:textColor">#ff000000</item>
        </style>
        <style name="TextAppearance.StatusBar.EventContent.Title" parent="@style/TextAppearance.StatusBar.EventContent">
            <item name="android:textSize">16.0sp</item>
            <item name="android:textStyle">bold</item>
            <item name="android:textColor">#ff000000</item>
        </style>

    Then you can edit the textColor values to your liking.

    The first one is the status bar itself, second one is notification descriptions, third one is notification titles.

    Then add the following to android.xml:

    Code:
        <item name="style/TextAppearance.StatusBar">@style/TextAppearance.StatusBar</item>
        <item name="style/TextAppearance.StatusBar.EventContent">@style/TextAppearance.StatusBar.EventContent</item>
        <item name="style/TextAppearance.StatusBar.EventContent.Title">@style/TextAppearance.StatusBar.EventContent.Title</item>

    and you should be all set.
    10
    I'm not a themer and I have no right to post in this thread but I just want to thank all of you for your hard work.

    I can only imagine the frustrations (and also the pleasures) of working with a new theme engine.

    Though it may not seem so most of the time we do appreciate the work you all do. Thank you.