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

Search This thread

scheichuwe

Senior Member
Sep 23, 2009
473
270
happy place
Yes, sorry for not making clear:
The apk compiles fine but cannot be installed. That's what I meant, remove preview.png from drawable-hdpi, compile your apk and you can install and apply it.
Without the message that your apk isn't compiled correctly...

Hope you get it, it's too early and my english is a bit rusty.
 
Last edited:
  • Like
Reactions: sonnysekhon

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
That's strange, for me it doesn't apply EXCEPT if its in drawable-hdpi. and my theme is ldpi, so i kept the drawable hdpi folder only for the preview. Wonder why the inconsistency...
 

sonnysekhon

Inactive Recognized Themer
Aug 15, 2010
4,166
5,479
Vancouver
Can you also please shed some light on the public.xml in values? What needs to be changed there. I am editing the xmls in the xml folder by using the actual names of the images without the com*** prefix.
 

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
As i mention in the OP, you can delete the public.xml. It will be generated while compiling anyway. If you leave it, you will have problems removing unwanted images. I dont want to go into too much detail, but like i said, just delete it. not needed.

If you notice, when you decompile your own apk, it will be there good as new.
 
  • Like
Reactions: sonnysekhon

sonnysekhon

Inactive Recognized Themer
Aug 15, 2010
4,166
5,479
Vancouver
Thanks a lot, blind me, I missed that part.

EDIT: Thanks to you, got most of the theme working. Some images however, show up as themed as well as unthemed in some places. For example the USB debugging icon shows up as themed in the status bar but unthemed in the notification menu, even though they both use the same image. Same for some popups etc. Any ideas? Also, I can't get the progress_horizontal.xml to work.

In android.xml, I used:

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

and put the xml in the drawable folder. It's weird because the battery % works and those xmls are included in the same places.

Maybe this isn't the right thread for these questions, but if you can help, it would be much appreciated.
 
Last edited:

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
EDIT: Thanks to you, got most of the theme working. Some images however, show up as themed as well as unthemed in some places. For example the USB debugging icon shows up as themed in the status bar but unthemed in the notification menu, even though they both use the same image. Same for some popups etc. Any ideas? Also, I can't get the progress_horizontal.xml to work.

In android.xml, I used:

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

and put the xml in the drawable folder. It's weird because the battery % works and those xmls are included in the same places.

Maybe this isn't the right thread for these questions, but if you can help, it would be much appreciated.

Reboot. Should solve the notification thing and HOPEFULLY the progress bars.

And feel free to ask for help :D


Sent from my HTC Wildfire using XDA App
 
  • Like
Reactions: sonnysekhon

sonnysekhon

Inactive Recognized Themer
Aug 15, 2010
4,166
5,479
Vancouver
Reboot. Should solve the notification thing and HOPEFULLY the progress bars.

And feel free to ask for help :D


Sent from my HTC Wildfire using XDA App

Thanks :), but I rebooted a bunch or times. It fixes some issues but not all. The entire lock-screen is unthemed. The power menu (with the reboot options etc) is unthemed, even the buttons and highlights on that menu are unthemed even though in other places, where the same images are used, are themed.

Also, is there a way to include xmls from the layout folder? For example, status_bar_latest_event_content.xml to change the color of the notifications text.

In Android.xml, I tried:

<item name="layout/status_bar_latest_event_content">@layout/status_bar_latest_event_content</item>

bot no luck.
 

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
Theme chooser doesn't support lockscreen theming yet unfortunately. Same goes for system dialogs.

About the layout stuff, I've been wanting to try that myself. Too bad it doesnt work :(

Edit : actually I was trying styles to get menu text to be black, but theme chooser threw a "deep redirect error" in logcat. See if its throwing anything for the layout. I need to do more research...

Sent from my HTC Wildfire using XDA App
 
Last edited:

sonnysekhon

Inactive Recognized Themer
Aug 15, 2010
4,166
5,479
Vancouver
Theme chooser doesn't support lockscreen theming yet unfortunately. Sale goes for system dialogs.

About the layout stuff, I've been wanting to try that myself. Too bad it doesnt work :(

Edit : actually I was trying styles to get menu text to be black, but theme chooser threw a "deep redirect error" in logcat. See if its throwing anything for the layout. I need to do more research...

Sent from my HTC Wildfire using XDA App

Thanks, that explains it. The progress_horizontal works, just not in volume popup and media volume popup.

Also I get this message when applying the theme: This device is missing assets for your device's screen size. I apply it anyway and it works fine. Any ideas?

In your caller screen, is your call answer jog dial a little out of place? The call decline dial is fine.

Once again, I really appreciate all your help.
 

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
Well my theme doesn't change the phone sliders.... so I can't tell you right away. Ill try tomorrow and see, its getting late right now and I wanna sleep :)

Sent from my HTC Wildfire using XDA App
 

sonnysekhon

Inactive Recognized Themer
Aug 15, 2010
4,166
5,479
Vancouver
Well my theme doesn't change the phone sliders.... so I can't tell you right away. Ill try tomorrow and see, its getting late right now and I wanna sleep :)

Sent from my HTC Wildfire using XDA App

Got it fixed :). Removed all the lockscreen stuff from Android.xml, I guess it was interfering with the caller screen dials in some way.

Any idea about the screen resolution error when trying to apply the theme? Thanks.
 

CondemnedSoul

Retired Recognized Developer
Apr 19, 2010
4,233
1,996
Phoenix, AZ
I'm getting the Theme error that it was not compiled correctly now. All I changed was was to remove the \'s in android.xml "\@drawable/preview" and so forth to get the preview and name to show in Theme Chooser which worked perfectly for that but now i'm getting the improperly compiled error when trying to apply the theme. Any suggestions? :confused:
 

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
The theme rresolution thing is a bug in the theme chooser, it says that for all themes.

And as for the not compiled thing, try moving preview.png from drawable-_dpi to just drawable.

Sent from my HTC Wildfire using XDA App
 

CondemnedSoul

Retired Recognized Developer
Apr 19, 2010
4,233
1,996
Phoenix, AZ
The theme rresolution thing is a bug in the theme chooser, it says that for all themes.

And as for the not compiled thing, try moving preview.png from drawable-_dpi to just drawable.

Sent from my HTC Wildfire using XDA App

Already tried that too :confused: The preview.png is only in drawable at this point and still getting the same improperly compiled error. I think I'm gonna try starting over from the start and see if maybe I just missed something... Lol... Should the icon.png only be in drawable also? I haven't tried that yet. I think I've tried just about everything else I can think of besides that.
 

nhnt11

Senior Member
Sep 16, 2010
1,376
1,116
Bangalore
This is very strange.... it applied fine on my phone and I have the gauge battery icon and its all working great. Ill take a look inside the apk a little later, kind of right now.

Sent from my HTC Wildfire using XDA App
 

CondemnedSoul

Retired Recognized Developer
Apr 19, 2010
4,233
1,996
Phoenix, AZ
This is very strange.... it applied fine on my phone and I have the gauge battery icon and its all working great. Ill take a look inside the apk a little later, kind of right now.

Sent from my HTC Wildfire using XDA App

:confused: That is strange... Here is what I get when I try to apply it on mine lol. At least I know it works somewhere then lol :rolleyes: Take your time bro. I'm getting ready to crash for the night myself. Thanks again for the help.

5478270784_4effb23c59.jpg
 

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.