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

Search This thread

CoD.<D.J.>

Senior Member
Nov 24, 2011
148
576
jaipur
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

SC20120815-151937.png
SC20120815-151942.png
SC20120815-151945.png
SC20120815-151948.png

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:
[COLOR="Blue"] Find -------------------  Replace with ID of name  [/COLOR]

[COLOR="PaleGreen"]IN smali/com/android/settings/TabbedSettings.smali[/COLOR]

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"

[COLOR="PaleGreen"]IN smali/com/android/settings/TabbedSettings$1.smali[/COLOR]

0x7f0c0001 -------------------  type="anim" name="slide_in_right"
0x7f0c     -------------------  type="anim" name="slide_in_left" ([COLOR="Red"]Only first 4 digits[/COLOR])

[COLOR="PaleGreen"]IN smali/com/android/settings/PersonalSettings.smali[/COLOR]

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

[COLOR="PaleGreen"]IN smali/com/android/settings/ProgramSettings.smali[/COLOR]

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 :highfive:

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.DialerTabActivity" 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 :victory:

Images and layouts in Zip files are for ldpi devices so they may look ugly on your high res devices.
 

Attachments

  • Settings.zip
    33.8 KB · Views: 6,825
Last edited:

MatZ69

Senior Member
Jan 25, 2011
640
911
Odivelas/Lisbon
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?
 

MatZ69

Senior Member
Jan 25, 2011
640
911
Odivelas/Lisbon
Np i figure out how do it. Thanks a lot

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

Attachments

  • uploadfromtaptalk1348589993137.jpg
    uploadfromtaptalk1348589993137.jpg
    21 KB · Views: 1,146

nextsmoothproject

New member
Jul 10, 2012
3
0
It can't compile

sorry, i can't compile my edited settings.apk at the 6 step, because apktool can't find a drawable that is @drawable/tab_focus...
In your zip there isn't that file, and that it's not included in my decompiled settings.apk (galaxy mini s5570)
this is a splitted part of my log
Code:
\projects\Settings.apk\res\drawable\tab_indicator.xml:6: error: Error: No resource found that
 matches the given name (at 'drawable' with value '@drawable/tab_focus').
 

MatZ69

Senior Member
Jan 25, 2011
640
911
Odivelas/Lisbon
Cant understand from step 6
Just copile and then decopile again Settings.apk

sorry, i can't compile my edited settings.apk at the 6 step, because apktool can't find a drawable that is @drawable/tab_focus...
In your zip there isn't that file, and that it's not included in my decompiled settings.apk (galaxy mini s5570)
this is a splitted part of my log
Code:
\projects\Settings.apk\res\drawable\tab_indicator.xml:6: error: Error: No resource found that
 matches the given name (at 'drawable' with value '@drawable/tab_focus').
copy tab_pressed and rename it to tab_focus. I think that u need 4 tab_*** images
 

gerald78

Member
Sep 30, 2012
15
8
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?

hi, I has followed the guide...but settings didn't appear...and I think we have same problems here...can you share your apk for compare..:)
Btw I using galaxy mini
 

ryanfebriyadi

Senior Member
Nov 5, 2011
122
299
GARUT
Redmi Note 9
app not show

sir, i've edited my settings.apk,,editing and recompiling succeed without errors,,but the app not appear on my drawer..i also made 2 variants (signed and unsigned),,it still disappear frm my drawer..
 

Chris95X8

Senior Member
Mar 21, 2011
2,787
2,276
Please, if anybody knows how to make this with Java code, make a tutorial. Please!
 

aways

Senior Member
Nov 11, 2011
4,221
14,036
¯\_(ツ)_/¯
www.c-rom.org
how i can fix it ?



I: Smaling...
Exception in thread "main" java.lang.NullPointerException
at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2922)
at org.antlr.runtime.CommonTokenStream.getSourceName(CommonTokenStream.java:345)
at org.antlr.runtime.Parser.getSourceName(Parser.java:88)
at org.jf.smali.smaliParser.getErrorHeader(smaliParser.java:358)
at org.antlr.runtime.BaseRecognizer.displayRecognitionError(BaseRecognizer.java:192)
at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:186)
at org.jf.smali.smaliParser.fixed_32bit_literal(smaliParser.java:5287)
at org.jf.smali.smaliParser.instruction(smaliParser.java:11207)
at org.jf.smali.smaliParser.statements_and_directives(smaliParser.java:1841)
at org.jf.smali.smaliParser.method(smaliParser.java:1609)
at org.jf.smali.smaliParser.smali_file(smaliParser.java:595)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:243)
at brut.androlib.Androlib.buildSources(Androlib.java:200)
at brut.androlib.Androlib.build(Androlib.java:191)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:185)
at brut.apktool.Main.main(Main.java:70)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 84
    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

    SC20120815-151937.png
    SC20120815-151942.png
    SC20120815-151945.png
    SC20120815-151948.png

    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:
    [COLOR="Blue"] Find -------------------  Replace with ID of name  [/COLOR]
    
    [COLOR="PaleGreen"]IN smali/com/android/settings/TabbedSettings.smali[/COLOR]
    
    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"
    
    [COLOR="PaleGreen"]IN smali/com/android/settings/TabbedSettings$1.smali[/COLOR]
    
    0x7f0c0001 -------------------  type="anim" name="slide_in_right"
    0x7f0c     -------------------  type="anim" name="slide_in_left" ([COLOR="Red"]Only first 4 digits[/COLOR])
    
    [COLOR="PaleGreen"]IN smali/com/android/settings/PersonalSettings.smali[/COLOR]
    
    0x7f040039 -------------------  type="xml" name="personal_settings"
    0x7f03005a -------------------  type="layout" name="speed_container"
    
    [COLOR="PaleGreen"]IN smali/com/android/settings/ProgramSettings.smali[/COLOR]
    
    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 :highfive:

    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.DialerTabActivity" 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 :victory:

    Images and layouts in Zip files are for ldpi devices so they may look ugly on your high res devices.
    4
    ................ Reserved
    3
    Included tab_indicator.xml into settings.zip.. Sry guys I forgot to add it.
    3
    :highfive:
    I removed the document solved tab_indicator erased:
    new
    :good:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <selector
      xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected" />
        <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected" />
        <item android:state_pressed="true" android:drawable="@drawable/tab_press" />
    </selector>
    :highfive:

    old:mad:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <selector
      xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected" />
        <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected" />
        <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_focus" />
        <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_focus" />
        <item android:state_pressed="true" android:drawable="@drawable/tab_press" />
    </selector>

    Now I have another problem with the file AndroidManifest:confused:
    when I make the change to pass the new apk file / app
    not installed and treated much more than 20 times:silly:
    and not to do ...:confused:

    Please help
    please help Take a look at my files

    It won't work that way :p
    When you modify AndroidManifest.xml you have to sign the apk and if you sign it, the system will reject it because the new signature won't match the system uid.
    To avoid this you have to resign all the apks in /system/app and then push the signed and modded Settings.apk
    Hope that helps
    2
    ................ Reserved
    ......................