This Guide will help you to add any application/options to Settings.apk. Well earlier My friend @sandy7 published a guide on how to add various options in Settings. So this extended guide will provide you the necessary knowledge on how to get resources about any app which needed to be added in Settings to include it as an option.
Requirements:
Any Tool that can Decompile & Recompile with it's requirements
Notepad++
1. How to add options/apps in main/general settings :
To add an app in Settings we need some resources of the app. This resources can be found by decompiling the app which we want to add & look for those in AndroidManifest.xml
Now, to add an app we need this resources to be added:
*android:targetPackage - the unique & original package name of the app
*android:action - the On click event of an app & it finds the activity of the app
*android:targetClass - the class which is called on calling Onclick action which opens the app when it is clicked
*android:title - the entry of the app in header & also in strings.xml
*android:icon - the icon which will be displayed for the app entry
Notes: android:targetClass, android:targetPackage & android:action can be found in AndroidManifest of the app. For some apps android:targetClass is not given directly. So it should be searched to find. I will tell you how to do that. android:title & android:icon can be written as per user.
As I explained a bit about the resources I will now move onto the main guide. I will take an app from playstore named "Rom Toolbox" as example & describe the ongoing process
i. 1st we need to decompile the Rom toolbox app & find the resources in AndroidManifest.xml
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
as we can see from the picture that I marked the android:targetPackage & android:targetClass. The target package is easy to find. Sometimes target class is also given directly. If it's not given directly like this app we will find it by searching for it in the lines which starts with <activity. Now if there's more than one activity search for the activity that matches with the target package to some extent. & one more thing I should make you clear about. In some apps you will find android:targetClass will just be a one word phrase. Like if we take Serajr's SystemUI Preference as example you will see that android:targetClass is ".SystemUIPreferencesActivity". In those cases we need to add the whole android:targetPackage before targetClass. For Serajr's SystemUI preference the android:targetPackage="com.serajr.systemui.preferences". So the android:targetClass="com.serajr.systemui.preferences.SystemUIPreferencesActivity".
So here for Rom Toolbox app we find
Code:
android:targetPackage="com.jrummy.liberty.toolbox"
android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity"
android:action="android.intent.action.MAIN"
android:action doesn't always needed to be found, you can always use "android.intent.action.MAIN" as the on click event
ii. Now decompile Settings.xml & go to res\xml & open settings_header.xml with notepad++. Now chose a place where you want to make the entry. If we want to add the app under advanced settings then we need to create a header 1st. We also need to create an android:title & android:icon entry for the app. So this will be the entry in settings_header
Code:
</header>
<header android:title="@string/header_category_advanced" />
<header android:icon="@drawable/ic_settings_rom" android:title="@string/rom_toolbox">
<intent android:targetPackage="com.jrummy.liberty.toolbox" android:action="android.intent.action.MAIN" android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity" />
The 1st header is for the advanced settings header. We need to make an entry of the same name in strings.xml.
The 2nd header is for the app & icon. We need to write the exact entry as title in strings.xml like I wrote "rom_toolbox". You can write anything as title just make sure it matches the app itself so that you can find it easily. So the settings_header will look like this
Now save it
iii. Now go to res\values & open strings.xml. We need to create two strings here. One for the advanced settings & another for the app. We already chose the string name for header as "header_category_advanced" & "rom_toolbox" for the Rom Toolbox app. So the entries in strings.xml will be
Code:
<string name="header_category_advanced">ADVANCED SETTINGS</string>
<string name="rom_toolbox">ROM Toolbox</string>
You can write anything where I wrote "ADVANCED SETTINGS" & "ROM Toolbox" It depends on you what you would like to see in settings as header.
So the strings.xml should be like this
Now save it.
iv. Now we need to place a png for the app in drawable folder with the name "ic_settings_rom" as it is given in the header of android:icon. Depending on your settings you either should have drawable hdpi or drawable mdpi folder. On my case I have drawable hdpi folder. 1st we need to look at the resolutions of the pngs which starts with ic_settings name. Well generally for drawable hdpi it is 48x48 & for drawable mdpi it is 32x32. So we need to resize the png in any of this resolutions depending on our drawable folder. You can take the png from the original app & resize it. In my case I resized it in 48x48 & placed it in drawable-hdpi folder.
v. Now you are ready to recompile again. Then try your newly modified settings. I will post a screenshot of mine
2. How to add options/apps in sub settings for example in display settings :
Here I will take On-screen-buttons app for an example in the ongoing process. We will add it in display_settings. Now, we need an extra resource called android:key when we want to add any app in sub settings. android:key is the keystore when the app is extracted using any app tool when created by the developer. As we cannot find the original android:key of the app, we will enter a value as android:key & give it's reference in the ids.xml
i. 1st decompile the On screen button app & search for resources in AndroidManifest.xml.
So we find android:targetPackage="cn.kyle.gn.NavBar" & as only one line here starts with <activity it is really easy to find android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity". android:action="com.android.intent.MAIN" even if it is not written in the manifest.
Now we need to make android:title which can be anything,we just need to refer it into strings.xml, android:key can be anything, we need to refer it in ids.xml & another entry is optional here which is android:summary which is the sub-header of the app. I give you my example what I have written as values of those resources
Code:
android:title="navienable_title"
android:key="on_screen"
android:summary="on_screen_summary"
Now as we fixed every resource & their values we will put the entry in res\xml in display_settings.xml. The entry will look like this
Code:
<PreferenceScreen android:title="@string/navienable_title" android:key="on_screen" android:summary="@string/on_screen_summary">
<intent android:targetPackage="cn.kyle.gn.NavBar" android:action="android.intent.action.MAIN" android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity" />
</PreferenceScreen>
The display_settings will look like this
Now save it
ii. Now go to res/values & open strings.xml. We need to make two entries here. One for the android:title="@string/navienable_title" & another for the android:summary="@string/on_screen_summary". Now we make the entries
Code:
<string name="navienable_title">On-Screen-Buttons</string>
<string name="on_screen_summary">Enable/Disable On-Screen-Buttons</string>
as I said before you can write anything inside >......</string> it depends on you what text you would like to be seen
The screenshot from strings.xml
Now save it.
iii. Now go to res\values\ids.xml & open it. We need to make an entry for the entry we made in display_settings as android:key. So the entry will be with the same value
Code:
<item type="id" name="on_screen">false</item>
So the ids.xml should be like this
Save it & recompile your edited Settings.apk. Here is a screenshot of the Settings I edited
2. How to add headers in Settings/about to display Developer Name & Rom Name :
i. Decompile Settings.apk & go to res\xml & open device_info_settings.xml. Now choose a place where you want to show your Rom Name & Developer name. The entries you need here are similar with the one's that already exist in the xml. So you can copy one line of entry & press enter then paste it & you can edit it to make the new entries. We need android:title & android:summary which will be shown in strings.xml. We need android:key which you can keep same as android:title to eliminate difficulties, but we don't need an entry in ids.xml this time as it is not an app for which we are making the entry for. Last of all we need a style entry which will be the same as others. So I will write my Rom name & developer name under Kernel_version entry here. The entries will be
Code:
<Preference android:title="@string/rom_header" android:key="rom_header" android:summary="@string/rom_name" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/author_header" android:key="author_header" android:summary="@string/author_name" style="?android:preferenceInformationStyle" />
The device_info_settings.xml will look like this
Now save it.
ii. Now go to res\values\strings.xml to make the entries here. We need two entries for the Rom Name, one is for "@string/rom_header" & another for "@string/rom_name". Same we need for Devloper name, one entry for "@string/author_header" & another for "@string/author_name". So the entries will be
Code:
<string name="rom_header">Rom Name</string>
<string name="rom_name">X Rom</string>
<string name="author_header">Developed By</string>
<string name="author_name">Saqib Nazm</string>
I give my Rom name as "X Rom" for example. You can type anything as you like on rom_name & author_name
The strings.xml should look like this
Now save it & recompile. Enjoy your freshly made new Settings.apk. Here is a screenshot about how it looks
.........................................................................................................................................
At the end I want to say, I will try to explain it more by adding more examples so that you can add anything. Kindly give me credits for my work If it helps you in anyway possible. Like I am gonna give credits to those respective people for whom I could share this guide to you.
Credits:
Neroyoung - for always helping me & clearing my ideas
jerrytan93 - for helping me alot whenever I need him
gagan.u20 - for always saving me if I get stuck somewhere
singh_dd93 - for giving me a clear idea on some resources
sandy7 - who doesn't know his thread from where everyone can learn
Nice one.. now everyone can start to develop their own ROM..
jerrytan93 said:
Nice one.. now everyone can start to develop their own ROM..
Click to expand...
Click to collapse
hehe thanks man & your help is highly appreciated :good:
@saqib nazm
i think u should add this also
after adding an app to settings u dont want that app to show up on launcher ..
so u can hide it by editing Androidmanifest.xml
by delete the red marked line
Code:
<activity android:label="@string/app_name" android:name=".GalleryActivity" android:taskAffinity="android.task.pictures" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
[B][COLOR="red"]<category android:name="android.intent.category.LAUNCHER" />[/COLOR][/B]
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
sandy7 said:
@saqib nazm
i think u should add this also
after adding an app to settings u dont want that app to show up on launcher ..
so u can hide it by editing Androidmanifest.xml
by delete the red marked line
Code:
<activity android:label="@string/app_name" android:name=".GalleryActivity" android:taskAffinity="android.task.pictures" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
[B][COLOR="red"]<category android:name="android.intent.category.LAUNCHER" />[/COLOR][/B]
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
Click to expand...
Click to collapse
yeah sure I wanted to,but then thought it doesn't work for every app.like it gives fc on 1st case then if applied later it works Now as you wrote it in the 1st page I think I don't need to add it OP anymore if you change the title of your post :angel:
saqib nazm said:
yeah sure I wanted to,but then thought it doesn't work for every app.like it gives fc on 1st case then if applied later it works Now as you wrote it in the 1st page I think I don't need to add it OP anymore if you change the title of your post :angel:
Click to expand...
Click to collapse
It works for every app.
Just set it for the main activity from
Code:
<activity android:label="@string/app_name" android:name=".GalleryActivity" android:taskAffinity="android.task.pictures" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
to
Code:
<activity android:label="@string/app_name" android:name=".GalleryActivity" android:taskAffinity="android.task.pictures" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
cheers,
jan+
jader13254 said:
It works for every app.
Just set it for the main activity from
cheers,
jan+
Click to expand...
Click to collapse
thanks jader :good: I didn't know that. So it's good to know that now from you
awesomeness.. people like you make people like us who are learning easy to understand things.. thanks bro..
Sent from my HTC Explorer A310e using xda app-developers app
Nice tutor m8 ! Thanx 4 ur aW£s0m€ work !!
Sent from my E15i using xda premium
how would i?
saqib nazm
Click to expand...
Click to collapse
how would i Add a another menu Below the Development menu , because i do want to Add a Credits menu
ps is it posible to add a rom control menu with the sony white balance app, navigation bar, font changer or/and a dpi changer
Envious_Data said:
how would i Add a another menu Below the Development menu , because i do want to Add a Credits menu
ps is it posible to add a rom control menu with the sony white balance app, navigation bar, font changer or/and a dpi changer
Click to expand...
Click to collapse
so you want to add a credit option in settings?& when you click on it what do you want it to do? sony white balance is not yet ported perfectly to our devices & also there is no font changer in our phone (or is it an app?) how to add dpi changer is given in other thread by sandy7.
I am trying to remove some items from settings on my Zelly Cream ROM. Now, I have deleted relevant info from settings_headers.xml and strings.xml, but, when I try to compile with apktool, it gives me an error (see attachment)
I wonder if you could help me. Thank you for your guide.
here
saqib nazm said:
so you want to add a credit option in settings?& when you click on it what do you want it to do? sony white balance is not yet ported perfectly to our devices & also there is no font changer in our phone (or is it an app?) how to add dpi changer is given in other thread by sandy7.
Click to expand...
Click to collapse
Credits > open up just like About Device menu
ROM controll > list of Things , dpi changer etc
other info > i dont mind apps that dont show up, so a dpi chaneger app that opens when clicked for example
important info > i admit i am still learning this
masteriori said:
I am trying to remove some items from settings on my Zelly Cream ROM. Now, I have deleted relevant info from settings_headers.xml and strings.xml, but, when I try to compile with apktool, it gives me an error (see attachment)
I wonder if you could help me. Thank you for your guide.
Click to expand...
Click to collapse
I think you need to update your aapt
Envious_Data said:
Credits > open up just like About Device menu
ROM controll > list of Things , dpi changer etc
other info > i dont mind apps that dont show up, so a dpi chaneger app that opens when clicked for example
important info > i admit i am still learning this
Click to expand...
Click to collapse
if you want to open a credits menu when clicking on it you need to write a whole new .xml file in the xml folder. & about the other rom control thing,you can just give your header & add the apps you want to add. Like the way is shown in the tutorial. Again if you want to open a sub menu when clicking on Rom control that will contain list of things like dpi changer you need to write a new xml file. So if you are willing to take so much let me know I will try to guide you though I haven't yet tried myself that way
saqib nazm said:
I think you need to update your aapt
Click to expand...
Click to collapse
What is an aapt? I don't have the SDK installed,using just apktool which I have been able to decompile APKs with. Also, I have been able to compile APKs using the same setup.
Thanks for your help
masteriori said:
What is an aapt? I don't have the SDK installed,using just apktool which I have been able to decompile APKs with. Also, I have been able to compile APKs using the same setup.
Thanks for your help
Click to expand...
Click to collapse
try with apk multi tool. & make sure you install the proper framework files first
example
could you give me a simplified example with coloured codes
red=changable
ps thank you
Envious_Data said:
could you give me a simplified example with coloured codes
red=changable
ps thank you
Click to expand...
Click to collapse
I will give you a conceptual idea about what I mean in some days,but I have to prepare that for you 1st.please be patient for some days as I am a bit busy with a rom update & everyday life.
Does it work to remove some items from settings??? I`m interested in it, too!
I´m a newbie so sorry for my stupid question:
What do i need exactly for using the apk multi-tool ? Which steps i have to make before i can adjust my settings ...
Thank you for help and patience with a newbie ...:good:
Hi, I want to ask about making sub menu. For example make power management menu, sub menu are battery, cpu control. How ?
Sent from my LT25i using xda premium
Related
Team Xposed at it again with another mod for all of you. This time it is transparent notification pulldowns. "Sharing is caring."
Step 1: Decompile SystemUI.apk with apktool, apk manager, or baksmali.
Step 2: Navigate to \com\android\systemui\statusbar\StatusBarService.smali
Step 3: Open StatusBarService.smali in Notepad++ or any other qualified text editor.
NOTE: Notepad and Wordpad will not edit the file properly.
Step 4: Search for:
Code:
.local v7, view:Lcom/android/systemui/statusbar/StatusBarView;
Look below at:
Code:
const/4 v1, 0x2
Replace 0x2 with -0x3
Next, search for:
Code:
.line 1797
Directly below, look for:
Code:
const/4 v5, 0x2
Replace 0x2 with -0x3
Step 5: Save and close the file.
Step 6: Navigate to \res\layout\status_bar_tracking.xml
Step 7: Open status_bar_tracking.xml in qualified text editor.
Step 8: Replace the 2 instances of "list_item_background" with "status_bar_background"
Step 9: Look for:
Code:
<LinearLayout android:orientation="horizontal" android:background="#ff000000"
Replace #ff000000 with #00000000
Step 10: Save and close file.
Step 11: Grab the existing status_bar_background.png from \res\drawable-hdpi\status_bar_background.png
Step 12: Edit it with your photo editor of choice and add your transparency.
Step 13: Save the file, and replace status_bar_background.png in \res\drawable-hdpi\status_bar_background.png with the one you just edited.
Step 14: Recompile SystemUI and flash it to your phone from recovery.
End result:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
NOTE: You may notice that the entire thing is transparent, and that the text is black. If this is not to your liking, you can make items appear white (or any other color) by looking at this line:
Code:
<View android:id="@id/tab_header"
This is the second of the lines that you changed to status_bar_background in Step 8. Change that back to list_item_background to get your white item list back while still maintaining a transparent background.
To change text color, look for this line:
Code:
<TextView android:textSize="@com.htc:dimen/list_primary_m" android:textStyle="bold" android:textColor="#ff000000"
Look for #ff000000 and change that to your desired color. The same applies to quicksettings, which is a line below.
Great tutorial. I have one question, how do you get the Notification text from black to white.
I highlighted the exact text I am referring to in the attachment.
scrosler said:
Great tutorial. I have one question, how do you get the Notification text from black to white.
I highlighted the exact text I am referring to in the attachment.
Click to expand...
Click to collapse
NOTE: You may notice that the entire thing is transparent, and that the text is black. If this is not to your liking, you can make items appear white (or any other color) by looking at this line:
Code:
<View android:id="@id/tab_header"
This is the second of the lines that you changed to status_bar_background in Step 8. Change that back to list_item_background to get your white item list back while still maintaining a transparent background.
To change text color, look for this line:
Code:
<TextView android:textSize="@com.htc:dimen/list_primary_m" android:textStyle="bold" android:textColor="#ff000000"
[code]
Look for #ff000000 and change that to your desired color. The same applies to quicksettings, which is a line below.
theimpaler747 said:
NOTE: You may notice that the entire thing is transparent, and that the text is black. If this is not to your liking, you can make items appear white (or any other color) by looking at this line:
Code:
<View android:id="@id/tab_header"
This is the second of the lines that you changed to status_bar_background in Step 8. Change that back to list_item_background to get your white item list back while still maintaining a transparent background.
To change text color, look for this line:
Code:
<TextView android:textSize="@com.htc:dimen/list_primary_m" android:textStyle="bold" android:textColor="#ff000000"
[code]
Look for #ff000000 and change that to your desired color. The same applies to quicksettings, which is a line below.[/QUOTE]
I tried that and its still not white. Could you try it and see if it works?
EDIT: Even took a sys UI that has white text and replaced the entire file and its still not white. Could there be a smali edit or am I just going crazy?
Click to expand...
Click to collapse
scrosler said:
I tried that and its still not white. Could you try it and see if it works?
EDIT: Even took a sys UI that has white text and replaced the entire file and its still not white. Could there be a smali edit or am I just going crazy?
Click to expand...
Click to collapse
Oops.... The text font color is probably located in layout or values folder under ids or public.xml
freeza said:
Oops.... The text font color is probably located in layout or values folder under ids or public.xml
Click to expand...
Click to collapse
Been looking for it all night... lol
I knew that I didn't misread your post! Thanks for confirming that before I went crazy, lol
There are a few changes that need to be made. If you want all transparent background then there are text color edits that need to be made in three or four systemui xmls, download provider.apk and download provider ui .apk. also a text change in framework. This is a good thread. I'll type up something coherent when I get home to add to it.
Sent from my PG86100 using xda premium
for white text color on transparent background
this is just adding to what freeza has already written
decompile systemui. go to res/values/colors
<color name="white">#ffffffff</color>
<color name="black">#ffffffff</color>
<color name="half_white">#7fffffff</color>
<color name="half_black">#7fffffff</color>
<color name="primary_text_color">#ffffffff</color>
<color name="secondary_text_color">#ffffffff</color>
this is what you want
then to res/values/drawables
<item type="drawable" name="notification_header_text_color">#ffffffff</item>
<item type="drawable" name="notification_number_text_color">#ffffffff</item>
<item type="drawable" name="list_item_background">#00000000</item>
<item type="drawable" name="list_item_background_gray">#00000000</item>
this is what you want
go to res/colors/bright_text_dark_focused
make sure all colors are ffffffff
go to res/color/list_item_primary_text and change ff888888 to ffffffff
go to res/color/list_item_secondary_text and change ffb8b8b8 to ffffffff
also cant remember if this was covered but status_bar_item_background_normal.9 needs to be made transparent.
go to res/layout/status_bar
where you see this and it appears twice
android:textAppearance="@android:style/TextAppearance.StatusBar.Icon
change to android:textColor="#ffffffff"
where you see this and it appears twice
android:textAppearance="@android:style/TextAppearance.StatusBar.Ticker"
change to android:textColor="#ffffffff"
also any textcolor in the xml in html should be android:textColor="#ffffffff"
go to status_bar_expanded
make sure all android:textColor= is ffffffff we do not need to change the style
android:textAppearance="@style/TextAppearance.StatusBar.Title"
because we have already referenced this in values/drawables
i status_bar_icon there is one text color reference. make sure it is white
in status_bar_tracking as i believe was mentioned change text color values from ff000000 to ffffffff
decompile framework-res
go to res/layout/status_bar_latest_event_content
change all text color from ff000000 to ffffffff
go to res/drawable-hdpi and make status_bar_item_app_background_normal.9 transparent
do the same with
status_bar_item_background_normal.9
decompile DownloadProvider.apk
go to res/layout/status_bar_ongoing_event_progress_bar
change all ff000000 to ffffffff
decompile DownloadProviderUI.apk
go to res/layout/download_list_item
where you see
android:textAppearance="?android:textAppearanceSmall"
make
android:textAppearance="?android:textAppearanceSmall" android:textColor="#ffffffff"
there are five instances of this. you are adding a text color value after the refernced text appearence. make sure your syntax and spacing are right
go to res/layout/list_group_header
where you see
android:textAppearance="?android:textAppearanceMedium"
add at the end as before
android:textAppearance="?android:textAppearanceMedium" android:textColor="#ffffffff"
that is it
Cool thing about this is you can now easily change the color to blue or cyan or red much more easily. You can open the whole res folder by highlighting res and an xml like the manifest. I use notepad ++. Then under search/ replace look for ffffffff and change with whatever color value you want. BAM instant color change!
example with blue text
fernando sor said:
for white text color on transparent background
Click to expand...
Click to collapse
You sir are the BOMB!
This was what I was looking for. I was changing line by line to see what woudl happen but eventually gave up and modded someone else mod... To get it the way I want.
This is getting save in favorites for next time!
Thanks!
scrosler said:
You sir are the BOMB!
This was what I was looking for. I was changing line by line to see what woudl happen but eventually gave up and modded someone else mod... To get it the way I want.
This is getting save in favorites for next time!
Thanks!
Click to expand...
Click to collapse
thanks ! you can even go further into framework/res/values/styles and com.htc.resources but i found that these changes cover most notifications
Pulled the SystemUI.apk from my phone and when I decompiled with Apktool I receive this.....any ideas what is the problem?
Did you install the framework to decompile with. You need to use the -t (framework) command. Make a folder in your sdk/tools folder and name it, "framework" I named mine "234" then place framework-res.apk and com.htc.resources.apk in that folder and in Adb type "apktool if (your framework-res) 234 (or what ever you named the folder)" and then type "apktool if (your resources) 234 (folder name)" and then to properly decompile type "apktool d -t 234 (folder name) .APK. Try that.
Sent from my PG86100 using xda premium
fernando sor said:
thanks ! you can even go further into framework/res/values/styles and com.htc.resources but i found that these changes cover most notifications
Click to expand...
Click to collapse
To add to your changes, I also had to change text in the voicemail apk. Mostly in res/ layout/in about 5 notificaton .xmlsIll write the exact changes when I get to a computer
Sent from my PG86100 using xda premium
steal25 said:
Did you install the framework to decompile with. You need to use the -t (framework) command. Make a folder in your sdk/tools folder and name it, "framework" I named mine "234" then place framework-res.apk and com.htc.resources.apk in that folder and in Adb type "apktool install (your framework-res) if 234 (or what ever you named the folder)" and then type "apktool install (your resources) if 234 (folder name)" and then to properly decompile type "apktool d -t 234 (folder name) .APK. Try that.
I did not install the framework initially. Followed your directions but received errors once I tried compiling the apk. I think maybe I used the wrong adb command to install framework even though it said successfully installed. Could you provide me with additional detail, step by step.
Click to expand...
Click to collapse
HackDPlanet said:
steal25 said:
Did you install the framework to decompile with. You need to use the -t (framework) command. Make a folder in your sdk/tools folder and name it, "framework" I named mine "234" then place framework-res.apk and com.htc.resources.apk in that folder and in Adb type "apktool install (your framework-res) if 234 (or what ever you named the folder)" and then type "apktool install (your resources) if 234 (folder name)" and then to properly decompile type "apktool d -t 234 (folder name) .APK. Try that.
I did not install the framework initially. Followed your directions but received errors once I tried compiling the apk. I think maybe I used the wrong adb command to install framework even though it said successfully installed. Could you provide me with additional detail, step by step.
Click to expand...
Click to collapse
in your apk folder place the framework-res.apk and your com.htc.resources.
in command window navigate to your apktool folder and type <apktool if framework-res.apk> hit enter
then type <apktool if com.htc.resources.apk> hit enter.
that simple
Click to expand...
Click to collapse
fernando sor said:
HackDPlanet said:
in your apk folder place the framework-res.apk and your com.htc.resources.
in command window navigate to your apktool folder and type <apktool if framework-res.apk> hit enter
then type <apktool if com.htc.resources.apk> hit enter.
that simple
Click to expand...
Click to collapse
I did exactly that and was able to decompile the .apk successfully. I received errors when I attempted to compile and recreate the apk.
Click to expand...
Click to collapse
HackDPlanet said:
fernando sor said:
I did exactly that and was able to decompile the .apk successfully. I received errors when I attempted to compile and recreate the apk.
Click to expand...
Click to collapse
That would be what you edited then. Whats the error?
Sent from my PG86100 using xda premium
Click to expand...
Click to collapse
fernando sor said:
HackDPlanet said:
That would be what you edited then. Whats the error?
Sent from my PG86100 using xda premium
Click to expand...
Click to collapse
Check out the image of the cmd prompt.
Click to expand...
Click to collapse
HackDPlanet said:
fernando sor said:
Check out the image of the cmd prompt.
Click to expand...
Click to collapse
if youlook at apktools error log it is pointing you to status_bar_tracking
it looks look you have a color value after text size. you cant do that.
Click to expand...
Click to collapse
if your adding a text color the line should read < android:textColor="#ffffffff">
i just used white as an example
HOW TO THEME SAMSUNG ROMS (GALAXY 3 MAYBE OTHERS)
Hello guys. I have had many requests to do this so here it is.
Let' s just get started.
NOTE : - THIS GUIDE CONTAINS VARIOUS METHODS WHICH I PERSONALLY USE TO THEME. THERE ARE SOME OTHER DIFFERENT WAYS IN WHICH YOU CAN DO THIS.
WHAT ALL YOU NEED TO THEME??
APK Manager 5.0.2 : - Will be used for decompiling/compiling frameworks. Please don' t use the new version APKMulti-Tool 1.0.1 for now..
APKTool : - This you need to place in your \windows\ folder.
Java SDK : - This is necessary for the decompiling/compiling process. Also required in many patches for frameworks.
GIMP : - This is the image editing software which we are going to use to edit/resize PNGs.
Android SDK : - Again not of much use in this guide but always good to have for learning.
WinRAR : - This will be used for opening the APKs for adding PNGs after editing.
Notepad++ : - This we will use for opening the various XML/smali files for editing code.
Unedited base framework : - Its necessary that its unedited because it may lead to errors(like error compiling .9.PNGs)
Hex Colours : - You' ll need hex colour values for using them in various XMLs. This here is a nice website for that.
Lots of patience : - Now this skill you have to develop on your own.
HOW TO SETUP EVERYTHING FOR MAKING/PORTING THEME??
1) Download APK Manager 5.0.2(Not APK Multi Tool 1.0.1) from the above mentioned link. Extract the contents to any of your drives.
2) Download APKTool (Main program as well as the dependancies for you respective OS). Extract both the .tars contents to :\windows\.
3) Download the latest version (7u2 currently) of JDK(Java SDK) from the site mentioned above and install it.
4) GIMP, Notepad++ : - Download from above mentioned site and install them.
5) WinRAR : - I guess you should be able to get this on your own.
6) Unedited base framework : - If you already have then good. If you don' t then please download from above link.
7) Android SDK : - Download either the zip or .exe from above mentioned site and set it up accordingly. (Note : - This step can be skipped)
CHECK WHETHER THE FRAMEWORK YOU HAVE IS COMPILE-ABLE (UNEDITED) OR NOT.
Before starting, always check. For this, place the framework-res.apk in \apkmanager\place-apk-here-for-modding\. Now start the script. Select Option 22(Set current project) and then select the project. Then select Option 9(Decompile apk). Let it decompile. After that, select Option 11(Compile apk). Select "YES" for "Whether it is system app". Select "YES" for "Whether you want to include original files". Let it compile.
If the compilation process goes smoothly without any errors, then you have the correct(unedited) framework which can be used for theming.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
EDITING VARIOUS XMLS : -
For information purpose, if you want to know what is an XML, then here is a nice read.
Decompile first : -
Place your framework-res.apk(should not be renamed after decompiling, so please rename before only) in the folder place-apk-here-for-modding. Start up script and decompile it(option 9). After decompiling, goto Projects folder. You will find your decompiled framework there.
Similarly, using the above method, decompile your twframework-res.apk(should not be renamed after decompiling, so please rename before only).
If you are porting a theme, then decompile the framework-res.apk and twframeowrk-res.apk from the theme to be ported also.
1) Editing Notification colour in notification drawer.
Files to be edited : - status_bar_latest_content_event.xml in \projects\framework_name\res\layout\.
* Goto \projects\framework_name\res\layout\.
* Open status_bar_latest_content_event in Notepad++.
* You will find 3 lines for editing the colour of the notifications.
1) android:id="@id/title". This is the title of the notification
2) android:id="@id/text". This is the description of the notification.
3) android:id="@id/time". This is the time of the notification
*Edit HEX value for "android:textColor" instance for the 3 above lines as per your likings. Or if you are porting from a theme, then just open the same XML file(i.e. status_bar_latest_content_event) of theme which you are porting in Notepad++ and copy paste the various HEX values to XML in your framework.
2) Colour of horizontal progress bars : -
Files to be edited : - progress_horizhontal.xml in \projects\framework_name\res\drawables\.
* Goto \projects\framework_name\res\drawables\.
* Open progress_horizontal in notepad++.
* The progress bar uses 3 colours to set the colour which goes from top to bottom. You have to set three colors: start, end and middle.
1) <item android:id="@id/background"> is for the unused part of the progress bar.
2) <item android:id="@id/progress"> is for the used part of the progress bar.
* Edit all the HEX values as per you linkings. Or if you are porting from another theme, then just open the same XML file(i.e. status_bar_latest_content_event) of theme which you are porting in Notepad++ and copy paste the various HEX values to XML in your framework.
3) Changing secondary font colour : -
Files to be edited : - zzz_tw_secondary_text_sub.xml in \projects\framework_name\res\color\
* Goto \projects\framework_name\res\color\.
* Open zzz_tw_secondary_text_sub.xml in notepad++.
* Look for the following instance,
Code:
<item android:state_window_focused="false" android:color="#HEXCOLOR_VALUE" />
<item android:color="#HEXCOLOR_VALUE" />
* Replace the HEXCOLOR_VALUE that is already there with the one of your choice.
* Note : - The default colour is blue in Samsung ROMs. Hex value #FF81BEE1.
4) Setting menu text colour to white in menus for black background : -
Files to be edited : - styles.xml in \projects\framework_name\res\values\.
* Goto \projects\framework_name\res\values.
* Open styles.xml in notepad++.
* Press CTRL+F and search for "TextAppearance.Widget.IconMenu.Item".
* The searched part will be like as shown in the following : -
Code:
<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">
<item name="textColor">[B]?textColorPrimaryInverse[/B]</item>
</style>
**Change the above code to as shown below : -
Code:
<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">
<item name="textColor">[B]@color/bright_foreground_dark[/B]</item>
</style>
* Then for text colour in "MORE" menu lists, press CTRL+F and search for "Theme.ExpandedMenu".
* The searched part will be as shown in the following : -
Code:
<style name="Theme.ExpandedMenu" parent="@style/Theme">
<item name="listViewStyle">@style/Widget.ListView.Menu</item>
<item name="windowAnimationStyle">@style/Animation.OptionsPanel</item>
<item name="background">@null</item>
<item name="itemTextAppearance">[B]?textAppearanceLargeInverse[/B]</item>
<style>
** Change the above code to as shown below : -
Code:
<style name="Theme.ExpandedMenu" parent="@style/Theme">
<item name="listViewStyle">@style/Widget.ListView.Menu</item>
<item name="windowAnimationStyle">@style/Animation.OptionsPanel</item>
<item name="background">@null</item>
<item name="itemTextAppearance">[B]?textAppearanceLarge[/B]</item>
<style>
5) Adding 1 percent battery mod to theme : -
Files to be edited : - stat_sys_battery.xml and stat_sys_batery_charge.xml in \projects\framework_name\res\drawable\.
* Goto \projects\framework_name\res\deawable\.
* Open stat_sys_battery.xml in notepad++. If there are no drawable values for 1% batterymod PNGs then, delete everything in that XML and copy paste the following code : -
Code:
[URL="http://pastebin.com/qRMqS2sy"]Click here for the pastebin data[/URL].
* Now open stat_sys_battery_charge.xml in notepad++. Check if there are drawable values for 1% battery mod. If there isn' t, then delete everything in that XML and add the following link : -
Code:
[URL="http://pastebin.com/pUxknPci"]Click here for the pastebin data[/URL].
6) Provider, Carrier, Ongoing-Title, Notifications-Title, Clear-Button, noNotificationsTitle : -
Files to be edited : - status_bar_expanded.xml in \projects\twframe_name\res\layout\
* Goto \projects\twframe_name\res\layout\.
* Open status_bar_expanded.xml in notepad++.
* Search for the lines : -
1) android:id="@id/plmnLabel". This is the Carrier name.
2) android:id="@id/spnLabel". This is the Provider name.
3) android:id="@id/ongoingTitle". This is the Ongoing-Title.
4) android:id="@id/latestTitle". This is the Notifications-Title.
5) android:id="@id/clear_all_button". This is the text of the Clear-Button.
6) android:id="@id/noNotificationsTitle". This is the text when no notification is displayed
* For each of the IDs above, there will be attribute android:textColor="<HEX_VALUE>". Edit the hex value as per your requirement. Or if you are porting from another theme, then just open the same XML file(i.e. status_bar_expanded) of theme which you are porting in Notepad++ and copy paste the various HEX values to XML in your framework.
7) Colour of the text when the text fiels is selected : -
Files to be edited : - styles.xml in \projects\framework_name\res\values\.
* Goto \projects\framework_name\res\values\.
* Open styles.xml in notepad++.
* Press CTRL+F and search for "<style name="TextAppearance">". There you will find "textColorHighlight" attribute just below.
* Change the HEX value for the attribute as per your requirement.
HOW TO COMPILE THE .APK BACK
Well here comes the big part. The part which usually causes the problems. You should consider the following points for this. The compilation process will go smoothly only if : -
You have not resized, replaced any .9.PNGs in the decompiled framework. If you want to you will have to do as I have described below in second post or else you will get compile errors. Lots of them.
You have not added any extra lines in XMLs which redirect to the PNGs(drawables) in the framework. If you have, make sure you have added the extra PNG to the framework as well.
**HOW TO COMPILE USING APKMANAGER : -
After you have made all the necessary edits to the framework, open up the script again.
Select option 22 and the select the project which you want to compile.
Then select option 19(Compression level for APKs) and select 0 for that.
You should see the compression level and the name of the project displayed above in the first line of the window.
After all that, select option 11(Compile APK). Select "Y" when it asks if its system APK. Select "Y" if it asks to include original files from APK or not.
Let it build the APK. If it builds successfully, then the most difficult part is finished.
[*]Minimize the script for a while. You will see a new folder named as "keep". Go to this folder and delete all the XMLs and the PNGs that you have edited. Don' t worry about the XMLs that you had edited in "values" folder. And also delete "resource.arsc" from the keep folder (Only if you have edited XMLs).
After you have done all that, maximize the script and press enter. Let it compile.
You will see your new compiled APK in the folder "place-apk-here-for-modding" in the form of unsigned<FILE_NAME>.
THIS WILL BE CONTINUED. STILL SOME MORE LEFT.
THEMING RELATED WITH PNGs
1) Popups :-
Figure 2.1
Present in : - framework_name\res\drawables-mdpi\
Name of the PNGs are : -
popup_bottom_bright.9.png
popup_bottom_dark.9.png
popup_bottom_medium.9.png
popup_center.dark.9.png
popup_center_medium.9.png
popup_full_bright.9.png
popup_top_bright.9.png
popup_top_dark.9.png
Please note that these are .9.PNGs. And they need to be .9.PNGs only. Normal PNGs will not work.
How to port from another ROM : - These .9.PNGs don' t require porting usually. Just take it from the theme you are trying to port and place it in your \res\drawable-mdpi\ folder using WinRAR.
Note : - This is to be done after you have completed editing and compiling the APK. Using WinRAR.
2) Backgrounds of menus : -
Figure 2.2
Present in : - framework_name\res\drawable-mdpi : -
Name of the PNGs are : -
menu_background.9.png : - This the background for one grid element.
menu_background_fill_parent_width.9.png : - This is the background of the whole grid element.
menu_more_bg.9.png : - The background of the menus when you select "More" menu.
menu_separator.9.png : - The separators(grid lines) between the various menus.
Please note that these are .9.PNGs. And they need to be .9.PNGs only. Normal PNGs will not work.
How to port from another ROM : - These .9.PNGs don' t require porting usually. Just take it from the theme you are trying to port and place it in your \res\drawable-mdpi\ folder using WinRAR.
Note : - This is to be done after you have completed editing and compiling the APK. Using WinRAR.
3) Notification bar and notification background(All related PNGs) : -
Figure 2.3
First six PNGs present in : - framework_name\res\drawable-ldpi except divider_horizontal_bright which is in framework_name\res\drawable-mdpi.
Last six PNGs present in : - twframe_name\res\drawable-ldpi or drawable-mdpi.
Names of the PNGs are : -
statusbar_background.9.png : - Can be a normal or a .9.PNG. Preferably a .9. As its black in most themes, no need to port. But if you want to you will have to follow method described below(Give me some time for the method).
status_bar_item_background_normal.9.png : - Background of the notifications on statusbar in idle condition. If you want to you will have to follow method described below.
status_bar_item_background_pressed.9.png : - Background of the notifications on the statusbar when the notification is selected. If you want to you will have to follow method described below.
divider_horizontal_bright.9.png : - The line which divides the notifications. Can be copied directly from the theme to be ported.
stat_sys_battery_[XX] : - These are the battery PNGs during normal use. Where [XX] refers to number between 0 and 100.
stat_sys_battery_chargeanim[XX] : - These are the battery charging PNGs. Here [XX] refers to a number between 0 and 100.
Other status bar PNGs : - All of them are of the form stat_sys_[X]_[Y]. By looking at the PNG itself you can identify which is for what.
quick_panel_music_bg.9.png : - This PNG is in twframework-res.apk\drawable-mdpi. This is the PNG for the music quick panel in the notification drawer. If you want to port this PNG from other theme then you will have to follow method described below.
quick_panel_list_bg_01.9.png : - This PNG is in twframework-res.apk\drawable-mdpi. This is the background for the titles such as "Ongoing", "NoNotifications", etc. It is a .9.PNG. Can be directly resized and used.
Quick panel icons : - These PNGs are in twframework-res.apk\drawable-ldpi. These are of the form quick_panel_icon_[NAME]_on/off. Are normal PNGs. Can be resized directly and placed in APK using WinRAR.
status_bar_header_background_01 : - This is present in twframework-res.apk\drawable-ldpi. This is the background for the quick panel. Is a normal PNG. Can be resized directly and placed in APK using WinRAR.
Unused notification drawer area : - The unused area in the notifications drawer is covered by status_bar_background.9.png.This is present in twframework-res.apk\drawable-ldpi. If porting from a theme, then you will have to use the method described below.
status_bar_close_on : - Present in twframewor-res.apk\drawable-ldpi. This is the PNG which defines the bottom of the notifications drawer.
EDITING/PORTING .9.PNGS
Let' s start off with the basics of what is a .9.PNG. Well there is a nice quick read about it here.
So what is the problem with .9.PNGs?? You will get info about it in my pastebin here.
**HOW TO EDIT (DECOMPILE METHOD) : -
Firstly, if you want to edit properly these PNGs, then you have to do it when the APK is in decompiled form. So decompile APK first.
Also, if you are porting a theme, decompile the APK from that theme also.
I am assuming the name of the PNG to be "btn_default_pressed.9.png". Open btn_default_pressed.9.png from the base theme using GIMP and also open the same PNG from the theme you want to port.
Note the the dimensions of the btn_default_pressed.9.png of our theme and the resize the same PNG from the theme you want to port accordingly.
Notice the borders of the .9.PNG of our base theme. You will notice some black solid lines. Now these are the lines that define the PNG. And these should not be touched or edited.
Now go to the PNG that you resized earlier. Using the rectangular select tool in GIMP, select the area of the PNG excluding the 1 px borders. And then copy it.(Figure 2.4 and 2.5).
Then go to the "btn_default_pressed.9.png" of our framework and then select the same area (i.e. excluding the 1 px borders) and press DELETE. The area will become empty.(Figure 2.6).
Then press CTRL+V(Paste).(Figure 2.6).
Save it. While saving you will be asked to export image. Select "Merge visible layers" and save.
There you have it. 1 PNG ported. Similarly, you can port other .9.PNGs. The important ones. Capish??
Figure 2.4
Figure 2.5
Figure 2.6
Reserved 2.
Finally.. Cool bro... Gonna Learn from this once you add info on smali editing..
Thanks for this tutorial!
akoshun said:
Thanks for this tutorial!
Click to expand...
Click to collapse
There is still lot more to go. Its late here so I will continue tomorrow.
wow man. This is like spoon feeding
Thanks a lot
vikraam said:
wow man. This is like spoon feeding
Thanks a lot
Click to expand...
Click to collapse
Well this will be big I guess. I already ran out of characters in first post.
could u also post wat languages do we need to know to start porting ? like XML etc
good job,i can not waiting to try.
Thread stuck
AacidD said:
could u also post wat languages do we need to know to start porting ? like XML etc
Click to expand...
Click to collapse
Well you don t need much prerequisite. Yeah XML would be good. The basics of it.
dhirend_6d said:
<QUOTE SNIPPED>
Click to expand...
Click to collapse
AWESOME!!
Really nice work, I would never have the patience to do sth. like this.
One thing I noticed in your APK Multitool picture though is, that the compression level is set to 9. That never worked for me while editing system apks, I think it is better to set it to 0.
Ghost In The Ruins said:
Really nice work, I would never have the patience to do sth. like this.
One thing I noticed in your APK Multitool picture though is, that the compression level is set to 9. That never worked for me while editing system apks, I think it is better to set it to 0.
Click to expand...
Click to collapse
Thanks. Actually, it should work though. What I do in the end is extract the resources.arsc from the .apk in the end and then again place it in the .apk using WinRAR with compression level "Store". So only the PNGs remain compressed.
dhirend_6d said:
Thanks. Actually, it should work though. What I do in the end is extract the resources.arsc from the .apk in the end and then again place it in the .apk using WinRAR with compression level "Store". So only the PNGs remain compressed.
Click to expand...
Click to collapse
Never thought of it doing it this way. I usually use different apk tool versions, one for decompiling and one for compiling. Took ages to get it work that way ^^
Compiling really should be the next part of your tutorial, it was always the most frustating thing to me and I imagine newbies might feel the same way.
Anyway, keep up the good work
Hi, I see a different picture in APK Multi-Tool, may be it's the problem of version, right?and can you tell me what's wrong after I selected Option 11?
(Sorry, I can't attach a picture like you...)
Arlisdoder said:
Hi, I see a different picture in APK Multi-Tool, may be it's the problem of version, right?and can you tell me what's wrong after I selected Option 11?
(Sorry, I can't attach a picture like you...)
Click to expand...
Click to collapse
Yep, different version. Something is wrong with your project. Most likely a .9.png is wrong formated. Check your log. There should be dozens of public.xml and language errors. You can ignore these. On top of these there should be the real problem. "*.9.png malformed" or something like this.
Arlisdoder said:
Hi, I see a different picture in APK Multi-Tool, may be it's the problem of version, right?and can you tell me what's wrong after I selected Option 11?
(Sorry, I can't attach a picture like you...)
Click to expand...
Click to collapse
I don t know which version of APKMultitool you are using. That s very different layout. But check the log that is there in APKManager folder. If you could attach the log then maybe I could say what the problem is.
EDIT : - Mot probably it is .9.PNG error as said by GhostInTheRuins above.
OK, now I attach my log and hope you can tell me what problem it is. Thanks.
Schools
2012-12-19 - Post #5 Inspecting the content of an APK
2012-12-19 - Post #6 Understanding .9.PNG or 9-patch PNG
2012-12-19 - Post #7 Let's make our own .9.PNG
2012-12-19 - Post #8 Let's edit an APK
2012-01-13 - Post #12 Keep transparency of PNGs
2013-01-24 - Post #13 Easy but advanced apk-modding
Basic windows tools
The basic windows tools to look inside apk's and learn about it's structures, content and XML's are in this zip.
Mediafire: X10MP_essentials_v3.zip
In the zip you will find:
APK Easy Manager v1.0
APK Edit v0.2
APK Tool 1.5.2 SEMC
Gordons Gate USB driver
Screen Stream
SignApk
Notice: You will also need Java SE Runtime Environment. Download from here, and install first. (The one called JRE)
Gordons Gate USB driver
If you already has rooted your X10M/P you already got the USB driver, and you do not need to install the USB driver. The driver is also installed with SONY PC Companion.
APK Tool 1.5.2 SEMC
Next you need to install the framework files. In the zip is included CM7 and SEMC framework. (If you want to work on CM9 or CM10 you can get the framework-files in any of those ROMs)
Install both framework files in the folder. Open CMD and change dir to the folder with apktool and the framework files.
Then type:
apktool if framework-res.apk
apktool if SemcGenericUxpRes.apk
APK Easy Manager v1.0
This tool will easily decompile most APK's, for easy access to resources and files, incl. XMLs
APK Edit v0.2
This tool will let you extract or inject files and edit existing XMLs.
Notice: Use the Apply button after you do a change to return to root folder. When injecting files, use copy and paste. If you just drag and drop the file wil be moved. Check AndroidManifest.xml after every APPLY, some strings might get changed or corrupted (typically there will be added a / in front of @, just remove the / and save and apply again).
(this is my generel APK-editing tool)
I use Notepad++ for editing XML/SMALI
Screen Stream
Just a very nice tool to make screen shots or video.
SignApk
Just in case you need to sign an APK.
What to do next
Well, just experiment and look inside APKs and get familiar with how they work and where different resources are placed and used by the APK. Slowly you will get more and more curious, read more and more about what ever gets your attention.
Schools and References - thread posts
Links to best posts in this thread
Post #5 Inspecting the content of an APK
Post #6 Understanding .9.PNG or 9-patch PNG
Post #7 Let's make our own .9.PNG
Post #8 Let's edit an APK
Post #12 Keep transparency of PNGs
Post #13 Easy but advanced apk-modding
References - outside forum
Best links to outside XDA forum
....
Reserved for a very usefull content
:cyclops:
Inspecting the content of an APK
The task of inspecting the content of an APK is fairly simple.
If you are only interesting in the graphics (PNGs) you can just rename the extension of an APK to ZIP. Now just extract the ZIP file and you got all the files from the APK. You will not be able to read the XML or SMALI files.
If you want access to everything use APK Easy Manager v1.0 from the essentials pack in post #1 above.
Just drag and drop the APK file into the APK Easy Manager v1.0, select Gingerbread in the dropdown and click Start Decompiling.
The decompiled APK will now be available in the projects folder.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Understanding .9.PNG or 9-patch PNG
Many attempts has been made to make this easy to understand and edit. Most of them ends up with strange sugestions and very complicated procedures.
Well, it's far from that complicated.
The goal of a .9.PNG is to make a graphical object, that's scaleable around a content, like a button with a text in it.
One good example is the buttons to cancel a call.
This button is made up of 5 different .9.PNG one for each state of the button, and are found in the Phone.apk (Phone.apk/res/drawable-mdpi)
btn_in_call_main_disable.9.png
btn_in_call_main_disable_focused.9.png
btn_in_call_main_normal.9.png
btn_in_call_main_pressed.9.png
btn_in_call_main_selected.9.png
They look like this (200% size shown in Pixlr.com/editor)
They all got the size 21x91. And obviously this is not the size of the buttons The actual button size is 64x64.
All around the PNGs is a 1 px border, with a simple information to the handling of the PNG object. The border must be only 100% transparent or 100% black. It's the black pixels that holds the information.
Top and left border tells what part of the PNG that is scalable/stretchable.
Right and buttom border tells what part of the PNG that can hold content, like text or other PNGs (above the buttons contains both text and graphics).
Very simple run down here: http://radleymarx.com/blog/simple-guide-to-9-patch/
Let's put that into words.
The "normal" butten state fades slightly from very dark at the buttom to less dark at the top and has round corners.
Top/left scalable/stretchable
For this button to look good, the corners sould not be stretched and the vertical transition should streach along most of the button. Left black border-line should be as long as possible for this.
For both horizontal and vertical, the corners should stay clear of being stretched.
Right/buttom content
Most of the button should hold content, so lines are here as long as possible but but still with a nice margin to the edges.
Let's make our own .9.PNG
First thing to be aware of is, that resizing a .9.PNG from another APK most likely will make the .9.PNG unusable because the imageeditor might change the total black of the border pixels and the total transparent might get some colour from pixels next to them.
Lets say that we want to make a Hobbit theme, and want the buttons above to look like something Hobbit, like a document.
So we want to change the document into the button, it would be something like this:
First I would just draw the black lines on the full image later we can do the cutting.
As you can see, I don't want stretch on the part where the corner of the document is missing (black line to the left).
Injecting this new button as it is now (no cutting at all) is fine. It does NOT have to be the size of the system-defaults. All 5 buttons just have to be same size.
This is how it looks with the same PNG for all 5 buttons. Not bad considering it took med 5 min to make
Note: The theme I used to test the Hobbit buttons is the Xperia S CM7 Theme. The caller number being close to the buttons is something that is on my list of fixing, and has nothing to do with the buttons.
Come oin newbie themers... let's build our self an XPERIA X10 Hobbit
Let's edit an APK
So I got this very simple app, that just open up a link. APK -> http://db.tt/WzA4QJhp
The APK has a Windows Live icon and just opens up http://mobile.live.com
We want to change the link to http://forum.xda-developers.com/forumdisplay.php?f=723 (this is the forum base for Sony Ericsson XPERIA X10 Mini), and give it a new nice icon.
Start APK Edit v0.2 (se post #1 for download etc) and open the APK-file (always edit in a copy).
App title and icon are changed from the front of the tool. Just write a new name and click the icon to change it. I made this cool icon.
Next we move to the content tab. This windows functions just like any other window, alowing moving og opening files directly.
The first file you see is AndroidManifest.xml
In this apk, it's not that interesting.....
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0" package="[COLOR="Red"]com.live.mobile[/COLOR]"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:label="@string/app_name" android:name=".WindowsLiveMobile">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
..... except for the red text. This is the apk signature, any other apk with the same signature will overwrite each other when installed. So if we want to make another link-APK and have both installed, this needs to be changed - AND ANY REFERENCE TO THIS, INCL PATH REFERENCES com/live/mobile must be changed too INCL the APK folders inside the SMALI folder. We will do this another day :laugh:
For now we will just find the part of the APK where the link is.
Deep inside smali/com/live/mobile are a bunch of smali-files. Our link-string is inside WindowsLiveMobile.smali.
Just open with text-editor (not Wordpad) find the link-string and edit the URL from "http://mobile.live.com" to "http://forum.xda-developers.com/forumdisplay.php?f=723"
Save the file and clik APPLY.
Copy to SD card and install.
This is the result APK http://www.mediafire.com/?v37jtayf7jsow82
Enjoy :good:
A very handy guide to .9.PNG's. Thanks!
Sent from my SK17i using xda premium
Great job!
thanks Emperor.dk for the information
Keep transparency of PNGs
When editing stock apps, everyone at one point will get problems with keeping the transparency of an stock PNG when opening it in an image editor programe on the PC.
Example: Here I have open plate.png from onoffwidgets.apk resources:
It should have been transparent, and editing from here won't do any good.
Solve this by first open it in Pixlr.com/editor and just save it again replacing the original on the PC.
When you open it again in your image editor in the PC, and the transparency works.
Now, enjoy modding and theming
Easy but advanced apk-modding
Cyanogen has made this cool app called CMWallpapers.apk.
You will find the app in a lot of custom ROMs all over XDA, some modded and some not.
In this school we will modify the package id to avoid colission with any preinstalled version and change the content of the app.
See previous schools for how to open an APK and edit content.
Today we are building an Xperia S wallpaper app-pack.
Changing icon and app name
Opening the apk in APK Edit first shows the app icons and name.
To change the icons simply click them and select the one you want from the popup filemanager. I found the original stock icon from WallpaperPicker.apk in the Xperia S stock ROM. It's fine to use the 48x48 for both LDPI and MDPI.
The app and label name is changed to "Xperia S wallpapers".
Notice: This is only the english name. In order to change the name for other languages, we need to change a lot of XML-files. This is done easily using the "replace in all open documents" function in Notepad++.
Navigate to res/ and simply drag and drop all the "value-??" folders into Notepad++, press CTRL+H and replace "CyanogenMod" with "Xperia S" in all open documents (There is one big button to do it in all with one click), and then press CTRL+SHIFT+S to save all documents.
After that click the Apply button in APK Edit.
Changing the package-id
The package id is defined in AndroidManifest.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="10" android:versionName="2.3.7" [COLOR="Red"]package="com.cyanogenmod.CMWallpapers"[/COLOR]
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application android:label="@string/app_name" android:icon="@drawable/cyanogenmod_icon">
<activity android:label="@string/app_label" android:icon="@drawable/cyanogenmod_icon" android:name="wallpaper" android:screenOrientation="nosensor" android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:label="@string/no_wallpaper" android:name="NoWallpaper">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Here we can change "com.cyanogenmod.CMWallpapers" to "com.xperias.wallpapers"
IMPORTANT: When you change the package-id you will have to change alle references in all SMALI-files, and all folder-paths inside the apk, or the app will not work.
Inside the APK exists a folder-path to the SMALI-files:
smali\com\cyanogenmod\CMWallpapers
We must rename the foldes "cyanogenmod" and "CMWallpapers" to match our package-id.
In APK Edit we just navigate to "smali\com\" and rename the folder "cyanogenmod" to "xperias", and then navigate into "xperias" and rename "CMWallpapers" to "wallpapers".
The new folder-path to the SMALI-files will now be:
smali\com\xperias\wallpapers
Next we will open all SMALI-files and change any references to match the new package-id. There are a lot, so again you might use the replace in all open documents function in Notepad++
Save all documents and click the Apply button in APK Edit.
Making wallpaper files
One wallpaperfile consists of two files, the wallpaper itself, and a thumbnail, in the format:
wallpaper.jpg
wallpaper_small.jpg
For this app to work properly, the LDPI resolution should be 427x320, and the thumbnail should be 107x80.
The MDPI resolution should be 640x480, and the thumbnail should be 107x80.
I have prepared all the wallpaperfiles from the stock Xperia S ROM, i had to resize and crop some parts off.
The wallpapers in the stock Xperia S ROM is found in "system\etc\customization\content\com\sonyericsson\wallpaperpicker\wallpapers"
The wallpaper-files has to be placed in "res\drawable-ldpi" and "res\drawable-mdpi"
Place wallpaperfiles inside the APK
First we open the "res\drawable-ldpi" folder, and delete the existing wallpaper files.
Notice: Don't delete the icon-file!
Then we copy the resized/cropped Xperia S wallpaperfiles into the folder and click Apply.
Next we do the same for "res\drawable-mdpi" folder.
Edit arrays.xml
Inside "res\values" folder we got an XML-file with references to all the wallpaper-files. This has to be edited to match our new wallpaper-files.
At the upper part of the XML we got file-reference, this must match the filename without the ".jpg", and at the lower part of the list we got wallpaper discription/name.
Be very carefull when editing XMLs in Windows. You will very easily break the text encode if you copy from 3rd party text-editor into Notepad++. It's better just to type in everything manualy.
Result
After install of the modded app, we get an Xperia S wallpaper choise when pressing the Menu-button and tapping wallpaper.
We also get an option to select no wallpaper. If we want to get rid of this, we need to edit AndroidManifest.xml and remove the red part:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="10" android:versionName="2.3.7" package="com.xperias.wallpapers"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application android:label="@string/app_name" android:icon="@drawable/cyanogenmod_icon">
<activity android:label="@string/app_label" android:icon="@drawable/cyanogenmod_icon" android:name="wallpaper" android:screenOrientation="nosensor" android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
[COLOR="red"] <activity android:label="@string/no_wallpaper" android:name="NoWallpaper">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
[/COLOR] </application>
</manifest>
And now, let me see some weekend mod-projects from all you newbies. I can't wait to se all your cool idears for app modding. I would realy like to see the Sony Ericsson Notes app with Google Tasks sync
Download the finished app here: http://www.mediafire.com/?i5tw3zpbcl86byg
New version here, cleaned up all MDPI, only 537 KB: http://www.mediafire.com/download.php?srhfp05qma86ctb
Awesome guide! I really want to learn something about the android world. Do you have some tools like these, but for linux?
mortadelax said:
Awesome guide! I really want to learn something about the android world. Do you have some tools like these, but for linux?
Click to expand...
Click to collapse
I'm very sure it's even more easy to do Android coding on a Linux system.... but i don't know how to install it, or use it, or play it.
awesome guide! Thanks a lot
Great! Thank a lot
Emperor.dk said:
I'm very sure it's even more easy to do Android coding on a Linux system.... but i don't know how to install it, or use it, or play it.
Click to expand...
Click to collapse
LOOOOL
Did you notice the line @ 4:55; "my phone doesn't take a week to boot"
That song is from a time way before smartphones .. :laugh:
I have been trying to find a way to make ThemeChooser.apk accept multi-theme-packs.
If I add more <THEME> tags into the Androidmanifest.xml then ThemeChooser will read eact of them and show them as seperete themes :good:
Example
Code:
<theme
pluto:themeId="gold"
pluto:styleId="@style/Gold"
pluto:name="@string/theme_name_gold"
pluto:preview="@drawable/preview_gold"
pluto:author="@string/author"
pluto:copyright="@string/copyright"
pluto:wallpaperImage="@drawable/wallpaper_gold"
pluto:styleName="@string/style_appearance_name_gold"
>
[COLOR="Gray"]<meta-data
android:name="com.tmobile.theme.redirections"
android:resource="@xml/redirections_gold"
/>[/COLOR]
</theme>
<theme
pluto:themeId="ruby"
pluto:styleId="@style/Ruby"
pluto:name="@string/theme_name_ruby"
pluto:preview="@drawable/preview_ruby"
pluto:author="@string/author"
pluto:copyright="@string/copyright"
pluto:wallpaperImage="@drawable/wallpaper_ruby"
pluto:styleName="@string/style_appearance_name_ruby"
>
[COLOR="Gray"]<meta-data
android:name="com.tmobile.theme.redirections"
android:resource="@xml/redirections_ruby"
/>[/COLOR]
</theme>
The meta-data tag is not being read or used by ThemeChooser.apk.
It will always just use redirections.xml and not redirections_gold.xml.
This video shows how it looks in ThemeChooser
If we could only get ThemeChooser.apk to use one of the pluto-statements to pick a redirection-XML (other that redirections.xml) it would be possible to combine more themes into one APK.
I see alot of cool possibilities like movie-themes, where most PNGs are the same but for eact main caractor it has different bacgkround or text-colors.
I have decompiled ThemeChooser.apk and read every line in all files.... not a clue how to fix it or make it possible.
If we all put our minds togeather this could be done. :victory:
" This thread will cover various useful guides starting from how to Decompile/Recompile Apk & Jar files. Me & my friend Aneel will provide new guides/tutorial day by day so that you guys can get many handy guidance in one place. Please Suggest us If you need any guide & we will try to post it If we actually can. Also If you find our guides useful then support us my giving feedback, hitting thanks & adding in credits section "
1st Let's start with [How to decompile & recompile with Apk Multitool]:
*Requirements*
Latest Java
Latest JDK+JRE (get everything from http://www.oracle.com/technetwork/java/javase/downloads/index.html)
Apk Multi Tool (Download from attachment)
Steps
1. Unzip Apk Multi Tool into a folder
2. Now run Setup.bat. It will look like this
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
3. Now choose 3. Setup Directories & press enter
4. This will create the folders needed. It will look like this
5. Now place the apk you want to decompile in place-apk-here-for-modding
6. Place a framework-res.apk, SemcGenericUxpRes.apk & SystemUI.apk in other folder. Preferebly it should be from the same package of apk/same apks of a Rom which you placed in the place-apk-here-for-modding folder. If there is no corresponding apks then you can try with other framework & systemUI apks also.
7. Now again run Setup.bat & press enter & choose 2. Installing Framework-Res. It will look like this
8. Now choose option 1 & enter to install framework & again option 4 & enter to install SystemUI
9. Now run Script.bat & press enter to activate various menu. Choose option 9 to decompile the apk. Then press enter. It will look like this
10. Once decompile is complete close the script & go to projects folder
11. Do the necessary changes you want to
12. When editing is done again run Script.bat
13. Choose option 11 to recompile & press enter. It will prompt a message after sometimes, Aside from the signatures....of errors (y/n)
14. Input y & press enter
15. Now after sometimes, it will again ask you to delete everything you have modified from keep folder & also delete resources.arsc if you have modified any xml. Minimize the script, delete the xml(s) you have modified (other than from values folder, it won't appear in keep folder) & also resources.arsc. If you have modified any png (not added) then delete it too. Then press enter when you are ready.
16. Now your new apk is ready. You can find it in place-apk-here-for-modding folder. Note that, your original apk will also be in the same folder with original name. Your modified apk will have System_ attached in the name.
17. Copy it to some other place & rename to original apk name & enjoy.
18. When you want to work on the next project then delete everything from place-apk-here-for-modding & projects folder. Now follow the same steps again from Number 5 of this guide.
[How to decompile & recompile Jar Files]:
*Requirements*
Winrar/7zip
Deodexed Jar files
smali.jar
baksmali.jar (both are in the attachment)
Command Prompt/Terminal
0. Take the classes.dex from jar file by opening it with 7zip/Winrar.
1. Open a new folder in Desktop named suppose "Jar"
2. Place smali.jar & baksmali.jar in the folder
2. Open Command Prompt. On windows type cmd in Run
3. cd to your directory where you have opened the new folder. In my case it is
Code:
C:\Documents and Settings\USER\Desktop\Jar
4. Write
Code:
cd C:\Documents and Settings\USER\Desktop\Jar
& press enter. Note that, on your case the directory will be different from mines. So get the correct directory by going into that directory from C:
5. Now type this to Decompile. Note that, there is a "space" before "classes.dex"
Code:
java -jar baksmali.jar -o classout\ classes.dex
& press enter
6. When Decompiling is done there will a folder named "classout" be placed in Jar folder. Minimize the cmd.
7. Now make the necessary changes inside the classout folder
8. When done,type this to recompile & press enter. Remember, there is a "space" before "new-classes.dex"
Code:
java -Xmx512M -jar smali.jar classout\ -o new-classes.dex
9. When recompiling is done there will be a new file in the folder named "new-classes.dex"
10. Now rename new-classes.dex to classes.dex & put it in the jar file with 7zip/Winrar
..............That's All. Thank You.................
Credits:
@raziel23x for Apk Multitool
@iONEx for teaching me about Apk Multitool when I was a noob
@Hero for Decomping jar files concept
How to Add Any App in Anywhere in Settings
This Guide will help you to add any application/options to Settings.apk. Well earlier My friend @sandy7 published a guide on how to add various options in Settings. So this extended guide will provide you the necessary knowledge on how to get resources about any app which needed to be added in Settings to include it as an option.
Requirements:
Any Tool that can Decompile & Recompile with it's requirements
Notepad++
1. How to add options/apps in main/general settings :
To add an app in Settings we need some resources of the app. This resources can be found by decompiling the app which we want to add & look for those in AndroidManifest.xml
Now, to add an app we need this resources to be added:
*android:targetPackage - the unique & original package name of the app
*android:action - the On click event of an app & it finds the activity of the app
*android:targetClass - the class which is called on calling Onclick action which opens the app when it is clicked
*android:title - the entry of the app in header & also in strings.xml
*android:icon - the icon which will be displayed for the app entry
Notes: android:targetClass, android:targetPackage & android:action can be found in AndroidManifest of the app. For some apps android:targetClass is not given directly. So it should be searched to find. I will tell you how to do that. android:title & android:icon can be written as per user.
As I explained a bit about the resources I will now move onto the main guide. I will take an app from playstore named "Rom Toolbox" as example & describe the ongoing process
i. 1st we need to decompile the Rom toolbox app & find the resources in AndroidManifest.xml
as we can see from the picture that I marked the android:targetPackage & android:targetClass. The target package is easy to find. Sometimes target class is also given directly. If it's not given directly like this app we will find it by searching for it in the lines which starts with <activity. Now if there's more than one activity search for the activity that matches with the target package to some extent. & one more thing I should make you clear about. In some apps you will find android:targetClass will just be a one word phrase. Like if we take Serajr's SystemUI Preference as example you will see that android:targetClass is ".SystemUIPreferencesActivity". In those cases we need to add the whole android:targetPackage before targetClass. For Serajr's SystemUI preference the android:targetPackage="com.serajr.systemui.preferences". So the android:targetClass="com.serajr.systemui.preferences.SystemUIPreferencesActivity".
So here for Rom Toolbox app we find
Code:
android:targetPackage="com.jrummy.liberty.toolbox"
android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity"
android:action="android.intent.action.MAIN"
android:action doesn't always needed to be found, you can always use "android.intent.action.MAIN" as the on click event
ii. Now decompile Settings.xml & go to res\xml & open settings_header.xml with notepad++. Now chose a place where you want to make the entry. If we want to add the app under advanced settings then we need to create a header 1st. We also need to create an android:title & android:icon entry for the app. So this will be the entry in settings_header
Code:
</header>
<header android:title="@string/header_category_advanced" />
<header android:icon="@drawable/ic_settings_rom" android:title="@string/rom_toolbox">
<intent android:targetPackage="com.jrummy.liberty.toolbox" android:action="android.intent.action.MAIN" android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity" />
The 1st header is for the advanced settings header. We need to make an entry of the same name in strings.xml.
The 2nd header is for the app & icon. We need to write the exact entry as title in strings.xml like I wrote "rom_toolbox". You can write anything as title just make sure it matches the app itself so that you can find it easily. So the settings_header will look like this
Now save it
iii. Now go to res\values & open strings.xml. We need to create two strings here. One for the advanced settings & another for the app. We already chose the string name for header as "header_category_advanced" & "rom_toolbox" for the Rom Toolbox app. So the entries in strings.xml will be
Code:
<string name="header_category_advanced">ADVANCED SETTINGS</string>
<string name="rom_toolbox">ROM Toolbox</string>
You can write anything where I wrote "ADVANCED SETTINGS" & "ROM Toolbox" It depends on you what you would like to see in settings as header.
So the strings.xml should be like this
Now save it.
iv. Now we need to place a png for the app in drawable folder with the name "ic_settings_rom" as it is given in the header of android:icon. Depending on your settings you either should have drawable hdpi or drawable mdpi folder. On my case I have drawable hdpi folder. 1st we need to look at the resolutions of the pngs which starts with ic_settings name. Well generally for drawable hdpi it is 48x48 & for drawable mdpi it is 32x32. So we need to resize the png in any of this resolutions depending on our drawable folder. You can take the png from the original app & resize it. In my case I resized it in 48x48 & placed it in drawable-hdpi folder.
v. Now you are ready to recompile again. Then try your newly modified settings. I will post a screenshot of mine
2. How to add options/apps in sub settings for example in display settings :
Here I will take On-screen-buttons app for an example in the ongoing process. We will add it in display_settings. Now, we need an extra resource called android:key when we want to add any app in sub settings. android:key is the keystore when the app is extracted using any app tool when created by the developer. As we cannot find the original android:key of the app, we will enter a value as android:key & give it's reference in the ids.xml
i. 1st decompile the On screen button app & search for resources in AndroidManifest.xml.
So we find android:targetPackage="cn.kyle.gn.NavBar" & as only one line here starts with <activity it is really easy to find android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity". android:action="com.android.intent.MAIN" even if it is not written in the manifest.
Now we need to make android:title which can be anything,we just need to refer it into strings.xml, android:key can be anything, we need to refer it in ids.xml & another entry is optional here which is android:summary which is the sub-header of the app. I give you my example what I have written as values of those resources
Code:
android:title="navienable_title"
android:key="on_screen"
android:summary="on_screen_summary"
Now as we fixed every resource & their values we will put the entry in res\xml in display_settings.xml. The entry will look like this
Code:
<PreferenceScreen android:title="@string/navienable_title" android:key="on_screen" android:summary="@string/on_screen_summary">
<intent android:targetPackage="cn.kyle.gn.NavBar" android:action="android.intent.action.MAIN" android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity" />
</PreferenceScreen>
The display_settings will look like this
Now save it
ii. Now go to res/values & open strings.xml. We need to make two entries here. One for the android:title="@string/navienable_title" & another for the android:summary="@string/on_screen_summary". Now we make the entries
Code:
<string name="navienable_title">On-Screen-Buttons</string>
<string name="on_screen_summary">Enable/Disable On-Screen-Buttons</string>
as I said before you can write anything inside >......</string> it depends on you what text you would like to be seen
The screenshot from strings.xml
Now save it.
iii. Now go to res\values\ids.xml & open it. We need to make an entry for the entry we made in display_settings as android:key. So the entry will be with the same value
Code:
<item type="id" name="on_screen">false</item>
So the ids.xml should be like this
Save it & recompile your edited Settings.apk. Here is a screenshot of the Settings I edited
2. How to add headers in Settings/about to display Developer Name & Rom Name :
i. Decompile Settings.apk & go to res\xml & open device_info_settings.xml. Now choose a place where you want to show your Rom Name & Developer name. The entries you need here are similar with the one's that already exist in the xml. So you can copy one line of entry & press enter then paste it & you can edit it to make the new entries. We need android:title & android:summary which will be shown in strings.xml. We need android:key which you can keep same as android:title to eliminate difficulties, but we don't need an entry in ids.xml this time as it is not an app for which we are making the entry for. Last of all we need a style entry which will be the same as others. So I will write my Rom name & developer name under Kernel_version entry here. The entries will be
Code:
<Preference android:title="@string/rom_header" android:key="rom_header" android:summary="@string/rom_name" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/author_header" android:key="author_header" android:summary="@string/author_name" style="?android:preferenceInformationStyle" />
The device_info_settings.xml will look like this
Now save it.
ii. Now go to res\values\strings.xml to make the entries here. We need two entries for the Rom Name, one is for "@string/rom_header" & another for "@string/rom_name". Same we need for Devloper name, one entry for "@string/author_header" & another for "@string/author_name". So the entries will be
Code:
<string name="rom_header">Rom Name</string>
<string name="rom_name">X Rom</string>
<string name="author_header">Developed By</string>
<string name="author_name">Saqib Nazm</string>
I give my Rom name as "X Rom" for example. You can type anything as you like on rom_name & author_name
The strings.xml should look like this
Now save it & recompile. Enjoy your freshly made new Settings.apk. Here is a screenshot about how it looks
.........................................................................................................................................
At the end I want to say, I will try to explain it more by adding more examples so that you can add anything. Kindly give me credits for my work If it helps you in anyway possible. Like I am gonna give credits to those respective people for whom I could share this guide to you.
Credits:
Neroyoung - for always helping me & clearing my ideas
jerrytan93 - for helping me alot whenever I need him
gagan.u20 - for always saving me if I get stuck somewhere
singh_dd93 - for giving me a clear idea on some resources
sandy7 - who doesn't know his thread from where everyone can learn
A guide how to add OSB for your ROM...!!!
Credits:
1. Attitude.SSJ for the DIY of OSB
2. LoneWanderer for the tut for HDPI devices
3.atticus182 for the beautiful icons of OSB
4. Serajr for the superb system UI mod
5. Tickle Fish for TICKLE MY ANDROID
Click to expand...
Click to collapse
Before we begin ask yourselves a question..!!
1.Do we really need OSB for mdpi devices??
Ans: i feel yes, "PREVENTION IS BETTER THAN CURE" its better we use our touch rather than using the soft keys for such along time and eventually get them busted! :silly:
2. Do we really need to follow this guide to make my own OSB??
Ans: Well it depends on your requirements......
3. will it support ICS, JB and even CM???
Ans: Hell yeah..!! it does work!!! sorry GB users
Click to expand...
Click to collapse
Tools Required:
1.framework-res.apk
2.SystemUI.apk
3.Winrar or 7zip
4.Notepad++
5.Apktool or Apkmanager or Apkmultitool
6.JAVA & JDK already installed in your PC
last but not the least required thing is a fully functioning human brain..!!
STEP1:
Framework Part:
1) Take the framework-res.apk and SystemUI.apk from rom and paste it in "place-apk-here-for-modding" folder in Apktool
2) Decompile the framework-res.apk using
Code:
apktool d framework-res.apk
Click to expand...
Click to collapse
3)Once decompiled you'll obtain a folder "framework-res"
4) Open it ..goto 'res\values' folder...find bools and right click to edit with notepad++ and by using ctrl+f search for
Code:
<bool name="config_showNavigationBar">[COLOR="Red"]false[/COLOR]</bool>
Click to expand...
Click to collapse
5)Rename falseto true...save file.
6) Open 'dimens' file in the same folder res\values and using ctrl+f search for navigation bar height and width and change them to whatever dpi you want and save file
7) Thats it!! compile the framework-res using the code
Code:
apktool b framework-res
Click to expand...
Click to collapse
8)Now you will get the new apk file of framwork-res.apk in the dist folder of framework-res folder if you are using the apktool and for other tools it will be in the respective output folder
9) Now we have to sign the framework-res.apk using any apk signing software or simply use TICKLE MY ANDROID by TICKLE FISH to sign your apk by placing it in the out folder of Tickle my android and sign it by pressing button 15 to sign apk file under theming menu(2)
10)thats it now your rom will have OSB
Note: If you dont want OSB in landscape view also..then type 0.0dip like this... in res\values\dimens
Code:
<dimen name="navigation_bar_height_landscape">0.0dip</dimen>
Click to expand...
Click to collapse
STEP2:
System UI part:
1. using 7zip or winrar OPEN the SystemUI.apk and navigate to res>drawable_mdpi (if drawable_mdpi is not present go to drawable_hdpi) and just drag and drop this folder "drawable_mdpi (or) hdpi"where you are working
2. search for these png files in the folder
Code:
ic_sysbar_back
ic_sysbar_back_ime
ic_sysbar_home
ic_sysbar_menu
ic_sysbar_recent
if they are present thats done if they are not present you'll have to add them into the folder with dimensions of your choice
3. Thats it NOW you have OSB in your ROM
WANT TO ASK ANYTHING???
How do i add them man...??
Well that's very simple go to this page http://forum.xda-developers.com/showthread.php?t=1413582 and download the required OSB styles you want to add to your ROM
but hey this brother who is a Recognized contributor @atticus182 should deserve a THANKS for such beautiful icons
Once downloaded you must re-size the pngs as far as i know for mdpi devices in portrait mode the image should be scaled around width:80px and height:48px (80x48) and in landscape mode width:48px and height:80px (40x80) is recommended
after they are re-sized they should be copy pasted to the folder we dragged and dropped from SystemUI.apk
once they are copy pasted again open SystemUI.apk in 7zip or Winrar and open the res folder and now just drag and drop the folder in which we added the png files and save the compression level to store if asked and now decompile SystemUI.apk and check whether the files which we drag and dropped are present in the res folder and even check for the png files the res>drawable mdpi(or)hdpi folder... if they are present then it is well and good if they arenot present then you have done something wrong post your problem i'll help you out or there are lot of devs here in XDA they'll help
Click to expand...
Click to collapse
STEP3:
CREATING A FLASHABLE ZIP
1) Download Sample.zip but dont extract it..just open the sample provided with winrar...you will see 2 folders META-INF and system.
View attachment 2027370
2) In system there will be two folders framework and app...
Drag the new framework-res.apk to framework folder...
and the SystemUI.apk folder to app..
3) META-INF has info about flashing...goto com..google..android and open update-script file with notepad++...you can edit whatever you want in
ui_print (" ") ...it will be displayed while installing...Save file..
Done your flashable zip is also ready to be flashed using CWM recovery
Feel free to ask questions if you have any coz this tutorila/guide is n-o-o-b friendly :victory: :angel:
P.S add me to your credits if you manage to get OSB working in your rom using this GUIDE/TUT
Dont ever forget to Click :good:button
Aneel said:
Amazing guide awesome..... bro :good: :beer: can we also add our guides here so that we all together can make it a sticky??
One more request bro we'll have this thread but all the comments and requests in Q&A. Forum so that all the questions can be handled there and here everyone can refer....
Sent from my Xperia Z using xda premium
Click to expand...
Click to collapse
yeah sure bro why not. but how will you add your guide here I don't know & I don't get what you meant by the request.hehe
I will copy all my contents from my guides and paste here along with the codes.... so that this thread will become a place where you can possibly find any guide irrespective of android version what say??
Regarding the request what I say is post a disclaimer not to comment here with problems or requests in this thread... I will create a thread in Q&A section specially for this thread so that they can question,comment,request,etc there.....
Sent from my Xperia Z using xda premium
Aneel said:
I will copy all my contents from my guides and paste here along with the codes.... so that this thread will become a place where you can possibly find any guide irrespective of android version what say??
Sent from my Xperia Mini Pro using xda premium
Click to expand...
Click to collapse
yeah sure that would be great. But let's do it tomorrow let's just call it a day. I am tired
@saqib nazm Yeah till then I'll edit this message after you see saying not to comment here since the thread is updating
Sent from my Xperia Z using xda premium
Some more tutorials are coming. I will post one more tutorial on how to add any app into anywhere in settings. Meanwhile my friend @Aneel will post some useful tutorials/guides.
reserved for next guide
this thread is open for comments guys
Thanks Gentle Men , 2 of nice Devs are Here
saqib nazm said:
this thread is open for comments guys
Click to expand...
Click to collapse
Add signing and zipaligning to your guide.
XperienceD said:
Add signing and zipaligning to your guide.
Click to expand...
Click to collapse
yeah sure man thanks for the suggestion. Will add it
saqib nazm said:
yeah sure man thanks for the suggestion. Will add it
Click to expand...
Click to collapse
nicely explained guide :good::good:
sandy7 said:
nicely explained guide :good::good:
Click to expand...
Click to collapse
thanks sandy :highfive:
Guys new & very useful guide about settings has been added in the 2nd post :good:
Both of you guys are just aweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesome.
Thanks for these gudies.
Exellent work.
:good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good:
Wow great man, awesome guide.
Sent from my Zelly creamWT19i
Mankotialovely said:
Both of you guys are just aweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesome.
Thanks for these gudies.
Exellent work.
:good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good: :good:
Click to expand...
Click to collapse
ChhunkaDavid said:
Wow great man, awesome guide.
Sent from my Zelly creamWT19i
Click to expand...
Click to collapse
Thanks to both of you & please let me know whoever followed my guide if it is understandably good or If I need to make it better
I'm looking for guide how add kill back button, can you make it?
godlesplay said:
I'm looking for guide how add kill back button, can you make it?
Click to expand...
Click to collapse
hmm...that would take a lot of time & lots of work but I can try though. Let's see