Post Reply

[GUIDE] How to add TABS to Settings with swipe gesture... \m/

OP CoD.<D.J.>

23rd September 2012, 01:26 AM   |  #1  
CoD.<D.J.>'s Avatar
OP Senior Member
Flag jaipur
Thanks Meter: 574
 
148 posts
Join Date:Joined: Nov 2011
More
Hello everyone..
I made some mods for the stock apps for galaxy y. Like settings app with tabs , Jellybean like statusbar ICS like Dialer and caller ID (You can see them Links are in my sign). Many people were asking me to make these for them so I decides to make a guide so everyone can do it.

Note : These guides are only for gingerbread samsung apps but these mods may or may not work with your apps.

What you need to have is.. Experience of compiling/decompiling apk's with ApkTool. Deodexed ROM.

So I am starting with How to modify settings.apk to have tabs


File to be modified is Settings.apk
This may work with ICS, JB ,Cyanogenmods settings.apk also

1. Pull settings.apk from system/app/ and decompile it with apktool. ( I wont cover how to compile, decompile and sign apks.)

2. Download the Settings.zip from attachments.

3. Extract downloaded zip it to the decompiled folder.

4. Now open res/values/strings.xml and add these lines at the end..

Code:
<string name="personal_settings_tab">Actions</string>
<string name="settings_ics_actions">APPLICATIONS</string>
<string name="program_settings_tab">Google</string>
<string name="settings_ics_google">GOOGLE APPS</string>
5. Now open res/values/ids.xml and add these lines at the end..

Code:
<item type="id" name="tabHost">false</item>
<item type="id" name="tabsLayout">false</item>
<item type="id" name="tabsText">false</item>
6. Now compile Settings.apk.... Wait Its not done yet you have to decompile it again. So decompile the settings.apk you just compiled

7. Now the part where you have to modify some smali files. Its not hard you just have to change some values in smali files I added. These are Ids of layouts and xml files.

8. Open smali/com/android/settings/TabbedSettings.smali and also open res/values/public.xml. Now you have to find the Ids given below and change them according to your public.xml. You will find lines like this in public.xml <public type="anim" name="slide_out_left" id="0x7f0c0002" /> underlined part is the ID for the name ("slide out left" here..) given. So find the ids below and replace them with the ids of names given below..



Code:
 Find -------------------  Replace with ID of name  

IN smali/com/android/settings/TabbedSettings.smali

0x7f0c0002 -------------------  slide_out_left (anim)
0x7f0c0003 -------------------  slide_out_right (anim) 
0x7f03005c -------------------  type="layout" name="tab_indicator"
0x7f0b011b -------------------  type="id" name="tabsText"
0x7f03005b -------------------  type="layout" name="tab_content"
0x7f0b0119 -------------------  type="id" name="tabHost"

IN smali/com/android/settings/TabbedSettings$1.smali

0x7f0c0001 -------------------  type="anim" name="slide_in_right"
0x7f0c     -------------------  type="anim" name="slide_in_left" (Only first 4 digits)

IN smali/com/android/settings/PersonalSettings.smali

0x7f040039 -------------------  type="xml" name="personal_settings"
0x7f03005a -------------------  type="layout" name="speed_container"

IN smali/com/android/settings/ProgramSettings.smali

0x7f04003a -------------------  type="xml" name="program_settings"
0x7f03005a -------------------  type="layout" name="speed_container"
9. Now open AndroidManifest.apk and under these lines

Code:
<application android:label="@string/settings_label" android:icon="@drawable/ic_launcher_settings" android:taskAffinity="">
        <uses-library android:name="touchwiz" />
add these lines (Ignore if you dont have line <uses-library android:name="touchwiz" /> its for samsung phone)

Code:
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/settings_label_launcher" android:name="TabbedSettings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.settings.SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="PersonalSettings" />
        <activity android:name="ProgramSettings" />
Now find these lines

Code:
<activity android:label="@string/settings_label_launcher" android:name="Settings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.settings.SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
and replace with

Code:
<activity android:label="@string/settings_label_launcher" android:name="Settings">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
10. Now you are done with modifications. Recompile+sign the settings.apk and push it to system/app/ ................ ENJOY

NOTE. If the apps shortcuts gives you force close or you want to add some other apps shortcut there then do the following..

1. Open personal_settings.xml(for Actions TAB) or program_settings.xml(For Google apps Tab) there you will see the shortcuts defined.

Code:
<com.android.settings.IconPreferenceScreen android:title="  Phone" settings:icon="@drawable/app_phone">
        <intent android:targetPackage="com.sec.android.app.dialertab" android:action="android.intent.action.MAIN" android:targetClass="com.sec.android.app.dialertab.DialerTabActivity" />
If your phone is different then Samsung then shortcut to phone will give you forceclose so to fix it do this,

2. change the android:targetPackage from "com.sec.android.app.dialertab" to whichever app you want. You can find package name in app's AndroidManifest.xml file or you can see it in Logcat while you launch the app.


3. change the android:targetClass from "com.sec.android.app.dialertab.DialerTabActivi ty" to the launcher activity of the app. You can find launcher activity name in app's AndroidManifest.xml file (add package name before it) or you can see it in Logcat while you launch the app.

4. Compile+sign and push settings.apk to system/app/

Note.. Look for the DeviceInfoSettings.smali in smali/com/android/settings/ if it doesn't exist then You have to change it with correct activity in TabbedSettings.smali. Find DeviceInfoSettings in TabbedSettings.smali and change it to another activity name.

I will do other Guides later.. Have Fun

Images and layouts in Zip files are for ldpi devices so they may look ugly on your high res devices.
Attached Files
File Type: zip Settings.zip - [Click for QR Code] (33.8 KB, 4280 views)
Last edited by CoD.<D.J.>; 25th September 2012 at 03:44 PM.
The Following 81 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ View ]
23rd September 2012, 01:27 AM   |  #2  
CoD.<D.J.>'s Avatar
OP Senior Member
Flag jaipur
Thanks Meter: 574
 
148 posts
Join Date:Joined: Nov 2011
More
................ Reserved
The Following 4 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ View ]
23rd September 2012, 01:28 AM   |  #3  
CoD.<D.J.>'s Avatar
OP Senior Member
Flag jaipur
Thanks Meter: 574
 
148 posts
Join Date:Joined: Nov 2011
More
Quote:
Originally Posted by CoD.<D.J.>

................ Reserved

......................
The Following 2 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ View ]
23rd September 2012, 06:37 AM   |  #4  
emjimadhu's Avatar
Senior Member
Thanks Meter: 106
 
232 posts
Join Date:Joined: Jan 2012
Donate to Me
More
Good guide bro.. this is what we want. Thanks.

HYPOCRITES I'm gonna do it blind
HYPOCRITES your messiah was never mine!
23rd September 2012, 06:02 PM   |  #5  
MatZ69's Avatar
Recognized Themer
Flag Odivelas/Lisbon
Thanks Meter: 918
 
640 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Awesome
Its a good way to make the settings look like MIUI^^

Ty for sharing
Last edited by MatZ69; 23rd September 2012 at 06:05 PM.
24th September 2012, 11:13 PM   |  #6  
MatZ69's Avatar
Recognized Themer
Flag Odivelas/Lisbon
Thanks Meter: 918
 
640 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Hey i have one problem...
The tab_indicator.xml is missing in your files but i managed one way to do that, the problem is that i followed your guide and the settings guive me FC...
The logcat says that the error is in TabbedSettings.smali
There is the code.
Code:
E/AndroidRuntime(3701): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.TabbedSettings}: android.view.InflateException: Binary XML file line #2: Error inflating class selector
09-24 23:04:02.389 E/AndroidRuntime(3701): 	at com.android.settings.TabbedSettings.createTabView(Tab.java:95)
09-24 23:04:02.389 E/AndroidRuntime(3701): 	at com.android.settings.TabbedSettings.setupTab(Tab.java:79)
09-24 23:04:02.389 E/AndroidRuntime(3701): 	at com.android.settings.TabbedSettings.onCreate(Tab.java:67)
09-24 23:04:02.389 E/AndroidRuntime(3701): Caused by: java.lang.ClassNotFoundException: android.view.selector in loader dalvik.system.PathClassLoader[/system/framework/twframework.jar:/system/app/Settings.apk]
I reviewed the all the codes and they match, but isnt working at all.
Can u help me?
25th September 2012, 02:28 AM   |  #7  
pabloltg's Avatar
Senior Member
Flag Córdoba
Thanks Meter: 201
 
267 posts
Join Date:Joined: Jan 2012
More
Yup, problems with tab_indicator.. i've made one (in attach, change .txt for .xml), put in drawable and every works fine in CM7.. but not work in CM10, some ideas?






_________________



tab_indicator.txt
Last edited by pabloltg; 25th September 2012 at 04:09 AM.
The Following User Says Thank You to pabloltg For This Useful Post: [ View ]
25th September 2012, 07:25 AM   |  #8  
MatZ69's Avatar
Recognized Themer
Flag Odivelas/Lisbon
Thanks Meter: 918
 
640 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Yh but still have the samr problem.
Can u share your apk to compare?

Sent from my GT-S5660 using xda app-developers app
25th September 2012, 09:51 AM   |  #9  
samsoul16's Avatar
Senior Member
Flag Thane
Thanks Meter: 519
 
1,368 posts
Join Date:Joined: Apr 2012
More
Luv U DJ...!!! Awesome one..

Sent from my GT-S6102 using Xparent SkyBlue Tapatalk 2
25th September 2012, 03:38 PM   |  #10  
CoD.<D.J.>'s Avatar
OP Senior Member
Flag jaipur
Thanks Meter: 574
 
148 posts
Join Date:Joined: Nov 2011
More
Included tab_indicator.xml into settings.zip.. Sry guys I forgot to add it.

The Following 3 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software and Hacking General [Developers Only] by ThreadRank