Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,780,834 Members 50,460 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
CoD.<D.J.>
Old
(Last edited by CoD.<D.J.>; 25th September 2012 at 03:44 PM.)
#1  
CoD.<D.J.>'s Avatar
Senior Member - OP
Thanks Meter 570
Posts: 148
Join Date: Nov 2011
Location: jaipur
Tutorial [GUIDE] How to add TABS to Settings with swipe gesture... \m/

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, 4024 views)
The Following 79 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ Click to Expand ]
 
CoD.<D.J.>
Old
#2  
CoD.<D.J.>'s Avatar
Senior Member - OP
Thanks Meter 570
Posts: 148
Join Date: Nov 2011
Location: jaipur
................ Reserved
The Following 4 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ Click to Expand ]
 
CoD.<D.J.>
Old
#3  
CoD.<D.J.>'s Avatar
Senior Member - OP
Thanks Meter 570
Posts: 148
Join Date: Nov 2011
Location: jaipur
Quote:
Originally Posted by CoD.<D.J.> View Post
................ Reserved
......................
The Following 2 Users Say Thank You to CoD.<D.J.> For This Useful Post: [ Click to Expand ]
 
emjimadhu
Old
#4  
emjimadhu's Avatar
Senior Member
Thanks Meter 106
Posts: 232
Join Date: Jan 2012

 
DONATE TO ME
Good guide bro.. this is what we want. Thanks.

HYPOCRITES I'm gonna do it blind
HYPOCRITES your messiah was never mine!
 
MatZ69
Old
(Last edited by MatZ69; 23rd September 2012 at 06:05 PM.)
#5  
MatZ69's Avatar
Recognized Themer
Thanks Meter 917
Posts: 640
Join Date: Jan 2011
Location: Odivelas/Lisbon

 
DONATE TO ME
Awesome
Its a good way to make the settings look like MIUI^^

Ty for sharing

I am MatZ^^

Plz dont send me pm of bugs without logcat or screenshot, otherwise i wont respond.
Dont send me pm if u dont have 10 posts... the forum has a purpose
 
MatZ69
Old
#6  
MatZ69's Avatar
Recognized Themer
Thanks Meter 917
Posts: 640
Join Date: Jan 2011
Location: Odivelas/Lisbon

 
DONATE TO ME
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?

I am MatZ^^

Plz dont send me pm of bugs without logcat or screenshot, otherwise i wont respond.
Dont send me pm if u dont have 10 posts... the forum has a purpose
 
pabloltg
Old
(Last edited by pabloltg; 25th September 2012 at 04:09 AM.)
#7  
pabloltg's Avatar
Senior Member
Thanks Meter 200
Posts: 267
Join Date: Jan 2012
Location: Córdoba
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
The Following User Says Thank You to pabloltg For This Useful Post: [ Click to Expand ]
 
MatZ69
Old
#8  
MatZ69's Avatar
Recognized Themer
Thanks Meter 917
Posts: 640
Join Date: Jan 2011
Location: Odivelas/Lisbon

 
DONATE TO ME
Yh but still have the samr problem.
Can u share your apk to compare?

Sent from my GT-S5660 using xda app-developers app

I am MatZ^^

Plz dont send me pm of bugs without logcat or screenshot, otherwise i wont respond.
Dont send me pm if u dont have 10 posts... the forum has a purpose
 
samsoul16
Old
#9  
samsoul16's Avatar
Senior Member
Thanks Meter 519
Posts: 1,359
Join Date: Apr 2012
Location: Thane
Luv U DJ...!!! Awesome one..

Sent from my GT-S6102 using Xparent SkyBlue Tapatalk 2
 
CoD.<D.J.>
Old
#10  
CoD.<D.J.>'s Avatar
Senior Member - OP
Thanks Meter 570
Posts: 148
Join Date: Nov 2011
Location: jaipur
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: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes