FORUMS
Remove All Ads from XDA

[Guide] [Miui] Introductory Guide To Theming! [Updated 11/14/11]

2,240 posts
Thanks Meter: 2,817
 
By hockeyfamily737, Senior Member on 12th November 2011, 01:54 AM
Post Reply Email Thread
An Introductory Guide To Theming Miui

Much like CM7’s theme chooser, Miui has it’s own powerful theme engine. If you’ve ever wanted to create your own theme or have a theme that you like, but want to make some personalized changes; then this guide’s for you. This guide is intended as a supplement to Team D3rp’s thread; [Guide][Reference] An Intro to Themeing. Please keep all questions, comments, and suggestions in this thread Miui related also feel free to hit us up at #miuithemes on the IRC. General theme questions, image editing questions, xml editing questions, or anything of that nature should be asked in the afore mentioned thread. Before we begin it’s necessary to thank scott951 and bigrushdog for there past, present, and future work on this rom. In addition, thanks to toastcfh & Cayniarb for they’re work on the AOSP kernel, to bliind for his ongoing IRC support, tips & tricks, and lastly thank you to Team D3rp (il Duce, ranger61878, thoughtlesskyle, vanessaem, dkdude36, jdeloach, and pstevep), all the old HeroC guys, the many talented themers, and everyone else on XDA and IRC who continue to advance my knowledge of the Android Operating System.

To begin your adventure into the world of Miui theming you will need some tools, listed below:

  • 7zip or similar archiving program
  • gimp or another image editor of your liking
  • Root Explorer (or your prefered file manager with root access)
  • Patience, patience, patience
  • Time, time, time
  • A willingness to bork your theme over and over again until you’re satisfied with how it looks
  • Recommended knowledge of adb and/or Android Commander- not required but may save you the time of having to restore a nand.
Table Of Contents: for your convenience in finding specific areas of help.
Lesson 1: File Structure
Lesson 2: Beginning Your Theme
Lesson 3: Lockscreens
Lesson 4: Changing Icons
Lesson 5: SystemUI

Lesson 1-File Structure

Before you can actually theme anything, you need to learn and understand the basic file structure used by Miui. Themes are compressed into zip files with a .mtz extension and are applied by the Miui theme engine at “run time”, meaning you can change almost any aspect of your theme on the fly, without a reboot. Download my intro.mtzfor use along with this guide. This is the default Miui theme with a simple lockscreen included that you will have to edit (It works but you will have to edit it per my instructions for it to look good), and a generic android boot animation / boot audio file. If you currently have a theme that you are generally happy with and would prefer to edit that more to your liking, you may do so by opening the Miui theme engine, select customize, scroll down to the bottom of the page and select “Backup Theme” After the backup finishes running, navigate to /sdcard/Miui/theme/backup and move the “backup.mtz” to your computer. Now let’s extract our .mtz and have a look at what’s inside. Right click on the intro.mtz, select 7zip from the popup window, and then select extract. Now navigate to the extracted intro.mtz folder and have a look inside. You should see the following:
“boots” folder
“preview” folder
“ringtones” folder
“wallpaper” folder
“com.android.launcher” zip file
“description” xml file
“icons” zip file
“lockscreen” zip file
The folders can be opened as any normal non-compressed document folder, the zip files (although their extensions are nonconventional can be extracted with 7zip, and the xml file can be edited with notepad ++.

Lesson 2 – Beginning Your Theme

  • Decide what you want your theme to be called and create a new folder for it somewhere that’s easily accessible.
  • Open up the description xml with notepad ++ and edit it to reflect your theme name on this line: <title>Default</title> (Change default to the name of your theme), edit this line: <author>MIUI</author> (Change MIUI to your name), and edit this line: <version>1.0</version> (from 1.0 to whatever version # you would like to call your theme). Save your changes and move the document to your newly created theme folder.
  • Now, if you so desire, in your theme folder create a sub-folder entitled “boots”. Place any boot animation & boot audio files in there that you would like to use, and make sure they are named correctly (bootanimation.zip & bootaudio.mp3).
  • Create a “preview” sub-folder next. This is where you’ll put screenies of your theme as you continue to develop it. Make a note of the file names and sizes in our original preview folder, also if you look you’ll see that some of the photo’s are jpegs and some are pngs. I’m not sure as though it matters, but I’ve developed a habit of keeping the extensions the same.
  • Now you can create an optional “ringtones” subfolder and assign rintones, notifications, and alarm sounds, by default when applying your theme. Use any mp3 you like so long as the files are named alarm.mp3, notification.mp3, and ringtone.mp3.
  • Create a “wallpaper” sub-folder within your theme folder next. This will be the home of your theme’s default wallpapers. Again look back at the intro.mtz and notice the size of the wallpapers in that folder and the file names. When you put your jpegs in this folder make sure they are named exactly default_lock_wallpaper & default_wallpaper.
Congratulations, you’re now on your way to making your own custom theme. Now that we have the simplest things covered and out of the way, we can really start to dig in and do some theming!

Lesson 3 – Lockscreens

Skipping over icons for a moment, lets jump to the lockscreen. As you know by now our Evo 3D’s QHD displays don’t play nice with a lot of lockscreens. So lets have a look at what we can do to fix some lockscreens. Please keep in mind that depending on which lockscreen you want to use they will require varying degrees of changes to work properly. The lockscreen I included with the intro.mtz functions, but looks terrible so now we’re going to fix it.






  • Extract the “lockscreen” file that you downloaded. Inside you’ll see an advance folder.
  • Open the advance folder. This is where the lockscreen magic happens. In this folder are all of the lockscreen png’s and the manifest.xml
  • Let’s start with the png’s.
-Resize bg to 540X854
-Resize bottom to 540X178
-Resize bottom_batterylow to 540X178
-Resize bottom_batterylow_light to 540X240
-Resize charging_bg to 540X178
-Resize charging_bg_mask to 540X178
-Resize status_bar to 540X40
-Resize time_bg to 540X107







Feel free at this time to edit and/or replace any of the png’s in here, as you see fit, but be sure to keep the icon names correct and watch out for the .9png’s (there are none in this lockscreen, but if you’re using a different one beware).
  • Now that the png’s have been fixed let’s have a look at the manifest.xml, shall we? Our images are all the proper size, but if we loaded the lockscreen now the icons and text would all be shifted to the left of the screen. In addition to making positional adjustments in this file we can change font sizes, font colors, time & date format, even which apps the lockscreen will launch. Go ahead and open that xml file now with notepad ++.
  • Find the two lines that begin with <DateTime. On these lines you can change the x & y locations to get the proper spacing from the edge of the screen. (x is the horizontal plane, y is vertical x0,y0 being the top left corner of the screen). You can change the text color (#FFFFFFFF) to whatever you like, the font size (size="22"), and the date format (format="EEEE, MMM d")
  • Now, work your way down through the xml file making any adjustments you want to make to text sizes, colors, and the necessary x shifts to get your lock screen lined up and centered. If by chance you get stumped, compare your manifest.xml with my manifest_edited.xml.
*hint, I usually use a pencil and paper to draw out the screen, then calculate how big of a left margin I want, add the image widths, to figure how big of a change to make. For example x20 + 480 png width=500 (leaving a margin of 40 on the right). Now if I change to x30 + 480 png width = 510 (leaving me a margin of 30 on both sides).
  • Once you’re done editing the .xml save it (keeping the original of course to refer back to)
  • Back out of the advance folder now and right click on it. Select 7zip from your popup window and “add to archive”. When prompted, save as “lockscreen.File”, set your file type as .zip and save your lockscreen to your theme folder. After it saves delete the .File from the name. Windows will prompt you that this may make the file unusable, click ok.
  • Navigate to your theme folder and select all of the contents inside of it (boots, preview, etc…). After selecting all of your theme components, right click again, select 7zip, and add to archive. Save your theme as “whatever_name”.mtz again choosing .zip as the file type.
  • Place your newly created theme on your sd card in /sdcard/MIUI/theme
  • Apply your theme and enjoy. If you’re happy with your lockscreen take a screenie to add to your preview folder when you make your next edits. Remember if you do something that breaks your lockscreen you can unlock by pressing back & volume up, or you can use adb to delete lockscreen from /data/system/theme and push a good lockscreen back.
Lesson 4 – Changing Icons



Changing your desktop and folder icons is a great way to enhance your theme. Miui’s theme manager makes this a relatively simple process. You can edit the default system icons with your image editor, or take your favorite icon collection and resize them to 90 X 90 pixels if you wish to keep the default Miui icon size. Lets begin!
  • Navigate to your intro.mtz and use 7zip again to extract the icon.File
  • Inside your extracted icon folder you’ll find all of the icons for the default system apps.
  • Changing system app icons
  • Find the icon that you want to replace in the folder. Let’s use the browser for example.
  • Find the icon you want to replace it with and rename that icon to com.android.browser
  • Copy your new browser icon into the icon folder, overwriting the existing one.
  • Adding icons for user installed apps is a little more involved but worth the extra time to make your theme complete. Here is where it’s handy to have Root Explorer.
  • Let’s say we want to add an icon for dropbox
  • To do this we need to know the process name. There’s a couple of ways we can figure this out. Since every app installed creates a data folder we can use Root Explorer to look in /data/data for the package name of dropbox.
  • If the package name didn’t jump out at you, don’t worry there’s another way to do this. Again using Root Explorer navigate to /data/app and find the dropbox apk, long press on in and select “extract all”, navigate to /sdcard/extracted and open up the extracted dropbox apk. Now tap the AndroidManifext.xml file, which should open up a text document and the very first line should give you the manifest package name.
  • By now you should know that the package name for dropbox is com.dropbox.android
  • Find the dropbox icon you want to use.
  • Rename the icon to com.dropbox.android
  • Drop the icon into your icon folder.
  • Repeat these steps for all of the icons which you want to replace.
  • Once you are finished replacing and / or adding icons, from within the icon folder, select all, then right click, select 7zip, and add to archive.
  • When the 7zip popup screen appears, save them as icons.File
  • Delete the .File extension
  • Move your zipped icons file to your theme folder.
  • Zip your themes folder up as a .mtz and apply it to your phone the same as you did after you finished your lockscreen.
  • Again, if you are happy with your icons take a couple of screenshots for your preview folder.
One last side note in regards to icons. You may notice some apps such as google + install additional icons to your homescreen (G+ Messenger). I have not figured out the image naming trick yet for these icons to display from the theme, but I’m working on it. For the time being I extracted my G+ Messenger and replaced the icon in the /res/drawable-hdpi folder, but I am searching for the correct way of doing this and will update accordingly once it’s figured out.

Lesson 5 – SystemUI



Now, we're going to add a whole new element to our theme. We're going to create a SystemUI zip in our theme mtz. Examples of some things that we can change in SystemUI are notification bar icons (signal, battery, gps etc), Statusbar back ground, and the various tabs you see in your drop down expanded notification page. Let's begin.
  • Create a working folder somewhere easily accessible on your computer (I like to work from my desktop)
  • Inside of your working folder, create a subfolder named "res"
  • download my theme_values_SysUI.xml, place it in your working folder (not in the "res" subfolder), and rename it to theme_values.xml.
  • Now you will need a SystemUI.apk from Miui. You can either unzip the rom on your computer and move the .apk to a convenient location of your choosing, or you can use adb to pull the SystemUI.apk from your phone. It's located in /system/app.
  • Now that you have your SystemUI.apk, using 7zip, extract it.
  • Open up your extracted apk and navigate to the "res" folder. Copy the "drawable-hdpi" folder and the "raw" folder and move them to the working folder on your desktop, placing inside of the "res" subfolder you created earlier.
  • Begining with the "drawable-hdpi" folder, use your image editor to make any .png adjustments that you want incorporated into your theme, or replace the png files as you see fit. Be sure to maintain the nomenclature of the images if you opt to replace them. Beware of editing .9.png's as they cannot be edited in a conventional fashion. If you need help editing .9.png's there are several methods and guides around xda. Or ask in [Guide][Reference] An Intro to Themeing.
  • When you're finished with the drawable-hdpi folder move to the raw folder. This is where your battery icons are located, contrary to Sense and CM7 roms. You'll notice that there are not 200 little battery png's but 3 large png's with all of the images put together in a sort of battery collage. To assemble a battery collage, take your individual battery pngs and resize them to 38 X 38. For graphical and charge indicators, you will now need to create a new image sized at 152 X 190, copy and paste your individual png's into the large image so that you have 5 rows each with 4 png's. Follow the same procedure for making a % png, except that you'll be using 10 rows of 10 images, so your png size should be 380 X 380.
  • When you're done with all of your images, open up the theme_values.xml with notepad ++ and make any color edits that you see fit. Please note, that these color changes will have minimal impact on the look of your theme. Most of the color changes of your system will not happen here. These are default values for only a handfull of apps.
  • When you're finished editing the xml save it and close it.
  • Finally select your theme_values.xml and your "res" folder and right click your mouse, select 7zip, and add to archive. In the 7zip popup window name your file com.android.systemui (no additional extension here, make sure it does not say zip at the end....just: com.android.systemui)
  • After the folder is compressed and zipped, move it to your theme folder and zip your theme up as a .mtz as you have been doing right along. Apply theme to your phone and enjoy.
To Be Continued…..Next update will be for Framework-res or launcher depending on my upcoming amount of free time!!!
The Following 15 Users Say Thank You to hockeyfamily737 For This Useful Post: [ View ] Gift hockeyfamily737 Ad-Free
 
 
12th November 2011, 01:55 AM |#2  
hockeyfamily737's Avatar
OP Senior Member
Flag Connecticut
Thanks Meter: 2,817
 
Donate to Me
More
Additional Information: Tips, Tricks, & Links
Advanced Lockscreens - Tips and Tricks

Thanks il Duce for these links:

Lockscreen 2.0 Reference

General Miui Tips & Tricks
The Following 3 Users Say Thank You to hockeyfamily737 For This Useful Post: [ View ] Gift hockeyfamily737 Ad-Free
12th November 2011, 01:55 AM |#3  
hockeyfamily737's Avatar
OP Senior Member
Flag Connecticut
Thanks Meter: 2,817
 
Donate to Me
More
I wasn't born rich, I'm good lookin' instead!!
The Following 3 Users Say Thank You to hockeyfamily737 For This Useful Post: [ View ] Gift hockeyfamily737 Ad-Free
12th November 2011, 01:57 AM |#4  
jayharper08's Avatar
Senior Moderator - The Troll Whisperer
Flag The Dirty
Thanks Meter: 9,650
 
More
Great job Hockey!! Love how everything is coming together!

Added to the OP in the one stop shop also.

Edit: This is really thorough. Very nice indeed.....
The Following User Says Thank You to jayharper08 For This Useful Post: [ View ] Gift jayharper08 Ad-Free
12th November 2011, 02:00 AM |#5  
jdeloach's Avatar
Senior Member
Flag Alabama
Thanks Meter: 2,320
 
Donate to Me
More
Awesome work

Sent from my PG86100 using xda premium
The Following User Says Thank You to jdeloach For This Useful Post: [ View ] Gift jdeloach Ad-Free
12th November 2011, 02:20 AM |#6  
scott951's Avatar
Senior Member
Flag Portland
Thanks Meter: 2,534
 
Donate to Me
More
Place holder for me
The Following User Says Thank You to scott951 For This Useful Post: [ View ] Gift scott951 Ad-Free
knowledge561
12th November 2011, 02:22 AM |#7  
Guest
Thanks Meter: 0
 
More
Is that all we do to the manifest because I really want that Evoluer slider to unlock my phone.

Temari x Shikamaru
12th November 2011, 02:23 AM |#8  
hockeyfamily737's Avatar
OP Senior Member
Flag Connecticut
Thanks Meter: 2,817
 
Donate to Me
More
Quote:
Originally Posted by scott951

Place holder for me

Thank you sir, for providing us with a rom worthy of the time it takes to do all of this!......No disrespect intended to any of the other developers who's roms I also use, but I've fallen head over heels for Miui
12th November 2011, 02:24 AM |#9  
hockeyfamily737's Avatar
OP Senior Member
Flag Connecticut
Thanks Meter: 2,817
 
Donate to Me
More
Quote:
Originally Posted by knowledge561

Is that all we do to the manifest because I really want that Evoluer slider to unlock my phone.

Temari x Shikamaru

Well, there's a lot you can do with the manifest xml, but to make them work properly yeah....It's just resizing the png's and shifting the x & y values accordingly for our screen size. I'm downloading the lockscreen you're trying to use now.
12th November 2011, 02:30 AM |#10  
vanessaem's Avatar
Developer Committee / Senior Moderator / Recognized Themer - The Flame Tamer
Flag Missouri City
Thanks Meter: 13,639
 
Donate to Me
More
Thanks for this.
knowledge561
12th November 2011, 02:33 AM |#11  
Guest
Thanks Meter: 0
 
More
Quote:
Originally Posted by hockeyfamily737

Well, there's a lot you can do with the manifest xml, but to make them work properly yeah....It's just resizing the png's and shifting the x & y values accordingly for our screen size. I'm downloading the lockscreen you're trying to use now.

Thanks because im Stumped!!!! If you manage to hook it up do you think you can throw in that green charging light? And when its not charging it turns blue when you touch it? Check out "ikun" to understand the lockscreen.

Temari x Shikamaru
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes