[Q][DEV] Question about GingerBread code - Settings.apk - Android Q&A, Help & Troubleshooting

Hello everyone!
I recently started modfying Settings.apk to make it look like ICS following THIS GUIDE.
What I'm trying to do, though, is to add toggle buttons to the Wi-Fi and Bluetooth options, just like ICS.
This code:
Code:
<PreferenceScreen android:title="@string/settings_label" android:key="parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceCategory android:title="@string/settings_ics_radio" />
<CheckBoxPreference android:persistent="false" android:title="@string/wifi_quick_toggle_title" android:key="enable_wifi" android:summary="@string/wifi_quick_toggle_summary" />
Adds the button, but that said button does nothing.
What do I need to add in order to make it work?
Edit: I see from here that it might require smali editing, but I'm not too sure since that last guide was trying to add a toggle that didn't actually exist before, and I just want to add a button that already exists in another menu.
Thanks in advance.

Related

[Q][SOLVED]Problem with PreferenceScreen xml file

i have a gitc_preferences.xml layout file in my res/layout/ folder. i am using IntelliJ 10.0.3 and i love it. the code completion in java and in xml is by and far the best ive used. but for some reason when i am making a PreferenceScreen it seems to choke.
lemme show a little stub of something...
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="first_cat">
<CheckBoxPreference
android:key="checkbox_preference"
android:title="title toggle preference"
android:summary="bleh" />
</PreferenceCategory>
</PreferenceScreen>
now everything inside the <PreferenceScreen></PreferenceScreen> tag is red. it says "Element PreferenceCatagory is not allowed here" "Element CheckBoxPreference is not allowed here"
now it code completes to CheckBox but it turns red when i continue on to CheckBoxPreferences.
any help. it wont compile.
YAY! ive once again solved my own problem.
layouts of PreferenceScreen's cant be in res/layout/ they have to be in res/xml/
killersnowman said:
YAY! ive once again solved my own problem.
layouts of PreferenceScreen's cant be in res/layout/ they have to be in res/xml/
Click to expand...
Click to collapse
THANK YOU for your own answer, it helped me !
Thanks
killersnowman said:
YAY! ive once again solved my own problem.
layouts of PreferenceScreen's cant be in res/layout/ they have to be in res/xml/
Click to expand...
Click to collapse
Thanks you very much dude... only here I found this problem and the solution. :fingers-crossed::highfive:
Thank you
Thank you

[Q] Editing an .apk file.

I am new to the android development. But i want to learn and i am trying.....I have Samsung galaxy tab 2 P3100 currently running CM10.....I rooted that myself and i can install different roms i.e. I can understand the instructions.... I want to edit an app called 7notes with mazec....the app looks like this when installed.....
1) The blue rectangle shows an app called Notebooks which is a note taking app...
2) The red rectangle shows the app i want to edit i.e. 7notes with mazec which is an input method....
I am a right handed guy....i want to edit the app so that it will be convenient for me to use....I want the app to look like this.....
Is there any way i can edit the app like that....i can provide the .apk file....
AkshayGTP3100 said:
I am new to the android development. But i want to learn and i am trying.....I have Samsung galaxy tab 2 P3100 currently running CM10.....I rooted that myself and i can install different roms i.e. I can understand the instructions.... I want to edit an app called 7notes with mazec....the app looks like this when installed.....
1) The blue rectangle shows an app called Notebooks which is a note taking app...
2) The red rectangle shows the app i want to edit i.e. 7notes with mazec which is an input method....
I am a right handed guy....i want to edit the app so that it will be convenient for me to use....I want the app to look like this.....
Is there any way i can edit the app like that....i can provide the .apk file....
Click to expand...
Click to collapse
It "should" be as simple as editing the res/layout to the values you want. I say "should" because I've never done more than a center clock mod in respect to moving placement of items. Hopefully someone can either verify this, or send you on the right path :thumbup:
Sent from my SPH-D710 using xda premium
Stryke_the_Orc said:
It "should" be as simple as editing the res/layout to the values you want. I say "should" because I've never done more than a center clock mod in respect to moving placement of items. Hopefully someone can either verify this, or send you on the right path :thumbup:
Sent from my SPH-D710 using xda premium
Click to expand...
Click to collapse
Here is a link for the .apk file...... https://www.dropbox.com/sh/xnm0f7qax191raw/KZRRuJSsh-
I found the layout folder already.....i think the related xml code is in the /res/layout/keyboard_handwriting.xml file.... am i correct?
i dnt know anything about the xml.....mean while, i will try to find out how to relocate the layout for the buttons.....
Can you send me the original and the edited xml file of the mod you did abt the center clock? maybe this mod is on the similar lines.....That will help me understand the modifications in this app.....
AkshayGTP3100 said:
Here is a link for the .apk file...... https://www.dropbox.com/sh/xnm0f7qax191raw/KZRRuJSsh-
I found the layout folder already.....i think the related xml code is in the /res/layout/keyboard_handwriting.xml file.... am i correct?
i dnt know anything about the xml.....mean while, i will try to find out how to relocate the layout for the buttons.....
Can you send me the original and the edited xml file of the mod you did abt the center clock? maybe this mod is on the similar lines.....That will help me understand the modifications in this app.....
Click to expand...
Click to collapse
Yes, it appears to be that file. The xml's arent difficult to edit as long as you know what you're looking for, and know what terminology to use.
Code:
[SIZE="1"] <ImageView android:id="@id/delete_backward" android:paddingTop="@dimen/bottom_bar_padding_top" android:paddingBottom="@dimen/bottom_bar_padding_bottom" android:layout_width="@dimen/img_w_menubar_button" android:layout_height="@dimen/img_h_menubar_button" [COLOR="Red"]android:layout_marginRight[/COLOR]="@dimen/bottom_bar_btn_margin" android:src="@drawable/backspace" android:layout_toLeftOf="@id/new_line" [COLOR="Red"]android:layout_alignBottom[/COLOR]="@id/menu" />
<ImageView android:id="@id/delete_stroke" android:paddingTop="@dimen/bottom_bar_padding_top" android:paddingBottom="@dimen/bottom_bar_padding_bottom" android:layout_width="@dimen/img_w_menubar_button" android:layout_height="@dimen/img_h_menubar_button"[COLOR="Red"] android:layout_marginRight[/COLOR]="@dimen/bottom_bar_btn_margin" android:src="@drawable/delete_stroke_n" [COLOR="Red"]android:layout_toLeftOf[/COLOR]="@id/new_line" [COLOR="red"]android:layout_alignBottom[/COLOR]="@id/menu" />
[/SIZE]
The code selected in red, is what you would to change, however, I'm not entirely sure what to change them to. I would try to find an app that already has something setup like you want this to be and look at the layout of those buttons.
The center clock mod I found using this guide only edited one line, like this
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" [COLOR="red"]android:gravity="left|center"[/COLOR] android:id="@id/clock" android:paddingLeft="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
and changed it to this
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" [COLOR="Blue"]android:gravity="center"[/COLOR] android:paddingTop="3.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" />
again, the code in red is the original, and code in blue is edited.
You could try something to the effect of
Code:
<ImageView android:id="@id/delete_stroke" android:paddingTop="@dimen/bottom_bar_padding_top" android:paddingBottom="@dimen/bottom_bar_padding_bottom" android:layout_width="@dimen/img_w_menubar_button" android:layout_height="@dimen/img_h_menubar_button[COLOR="Blue"]android:layout_marginLeft[/COLOR]="@dimen/bottom_bar_btn_margin" android:src="@drawable/delete_stroke_n" [COLOR="Blue"]android:layout_alignBottom[/COLOR]="@id/new_line" [COLOR="red"]android:layout_alignBottom[/COLOR]="@id/menu" />
Obviously, I dont know if this will work or not, but you can try it. Just make sure you keep your original apk so you can replace it if you need to:good:
Stryke_the_Orc said:
Yes, it appears to be that file. The xml's arent difficult to edit as long as you know what you're looking for, and know what terminology to use.
Code:
[SIZE="1"] <ImageView android:id="@id/delete_backward" android:paddingTop="@dimen/bottom_bar_padding_top" android:paddingBottom="@dimen/bottom_bar_padding_bottom" android:layout_width="@dimen/img_w_menubar_button" android:layout_height="@dimen/img_h_menubar_button" [COLOR="Red"]android:layout_marginRight[/COLOR]="@dimen/bottom_bar_btn_margin" android:src="@drawable/backspace" android:layout_toLeftOf="@id/new_line" [COLOR="Red"]android:layout_alignBottom[/COLOR]="@id/menu" />
<ImageView android:id="@id/delete_stroke" android:paddingTop="@dimen/bottom_bar_padding_top" android:paddingBottom="@dimen/bottom_bar_padding_bottom" android:layout_width="@dimen/img_w_menubar_button" android:layout_height="@dimen/img_h_menubar_button"[COLOR="Red"] android:layout_marginRight[/COLOR]="@dimen/bottom_bar_btn_margin" android:src="@drawable/delete_stroke_n" [COLOR="Red"]android:layout_toLeftOf[/COLOR]="@id/new_line" [COLOR="red"]android:layout_alignBottom[/COLOR]="@id/menu" />
[/SIZE]
The code selected in red, is what you would to change, however, I'm not entirely sure what to change them to. I would try to find an app that already has something setup like you want this to be and look at the layout of those buttons.
The center clock mod I found using this guide only edited one line, like this
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" [COLOR="red"]android:gravity="left|center"[/COLOR] android:id="@id/clock" android:paddingLeft="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
and changed it to this
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" [COLOR="Blue"]android:gravity="center"[/COLOR] android:paddingTop="3.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" />
again, the code in red is the original, and code in blue is edited.
You could try something to the effect of
Code:
<ImageView android:id="@id/delete_stroke" android:paddingTop="@dimen/bottom_bar_padding_top" android:paddingBottom="@dimen/bottom_bar_padding_bottom" android:layout_width="@dimen/img_w_menubar_button" android:layout_height="@dimen/img_h_menubar_button[COLOR="Blue"]android:layout_marginLeft[/COLOR]="@dimen/bottom_bar_btn_margin" android:src="@drawable/delete_stroke_n" [COLOR="Blue"]android:layout_alignBottom[/COLOR]="@id/new_line" [COLOR="red"]android:layout_alignBottom[/COLOR]="@id/menu" />
Obviously, I dont know if this will work or not, but you can try it. Just make sure you keep your original apk so you can replace it if you need to:good:
Click to expand...
Click to collapse
Thank you very much Stryke_the_Orc.....i tried what you suggested but i am getting some compilation error.....i not only want to move the buttons horizontally but i want them staked also.... i will keep looking for solution....
AkshayGTP3100 said:
Thank you very much Stryke_the_Orc.....i tried what you suggested but i am getting some compilation error.....i not only want to move the buttons horizontally but i want them staked also.... i will keep looking for solution....
Click to expand...
Click to collapse
Good luck to you, like I said, I wasn't sure that would work, but it should give you some idea of what you're looking for:beer:
Sent from my SPH-D710 using xda premium

[Q] Reading new settings

Hello!
I'm using a Galaxy Tab 2 (p5110) and building off CM 10.1.
I've successfully edited the settings app to display a bunch of menus. Reference: imgur.com/bsvM3RP
My XML file that holds the preferences looks like this:
Code:
<PreferenceScreen>
<PreferenceCategory
android:title="@string/sip_phone_setting">
<EditTextPreference
android:key="sip_extension_number"
android:title="@string/extension_number"
android:digits="0123456789"/>
<EditTextPreference
android:key="sip_server_host"
android:title="@string/server_host"
android:digits=".0123456789"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/sip_credentials_setting">
<EditTextPreference
android:key="sip_credential_username"
android:title="@string/sip_username"/>
<EditTextPreference
android:key="sip_credentials_password"
android:title="@string/sip_password"/>
</PreferenceCategory>
</PreferenceScreen>
What I'd like to be able to do is access one of the keys from an outside application. Any ideas on how I may achieve that?

[TUTORIAL] [MOD] How to add Extra Options in About Sections

Hello Today I am Showing How to add Extra Options in Settings CPU Info Screen Resolution Mem Info Swap Mem Info I will Update This Thread with New Options So Let"s Start
Requirement:
Apktool http://forum.xda-developers.com/show....php?t=1755243
Settings.apk From Your Phone
Nice Brain to Understand
Credits:
My Friends Aryne Neil Carlno Cabatan
Instructions:
Step 1 :- Pull Your Settings from Your Phone
Step 2 :- Decompile The Settings.apk
Step 3 :- Merged The Your Settings with My Zip
Step 4 :- Open Values/strings.xml
Step 5 :- Add This
Code:
<string name="cpu_info">CPU info</string>
<string name="mem_info">Mem info (avail/total)</string>
<string name="swap_mem_info">Swap mem info (avail/total)</string>
<string name="device_screen_resolution">Screen resolution</string>
Step 6 :- Open xml/device_info_settings
Step 7 :- Remove All lines
Step 8 :- Add This
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/about_settings"
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen android:title="@string/device_status" android:key="status_info" android:summary="@string/device_status_summary">
<intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.deviceinfo.Status" />
</PreferenceScreen>
<Preference android:title="@string/model_number" android:key="device_model" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/firmware_version" android:key="firmware_version" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/baseband_version" android:key="baseband_version" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/kernel_version" android:key="kernel_version" android:summary="@string/device_info_default" />
<Preference android:title="@string/cpu_info" android:key="device_cpu" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/device_screen_resolution" android:key="device_screen_resolution" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/mem_info" android:key="device_memory" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/swap_mem_info" android:key="device_swap_memory" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
<Preference android:title="Guide by" android:key="android_fire_xda" android:summary="AndroidFire" style="?android:preferenceInformationStyle" />
</PreferenceScreen>
Step 9 :- Recompile and Decompile Again
Step 10 :- Go to values/public.xml
Step 11 :- search for device_info_settings Note the id code
Step 12 :- Search for 0x7f040010 Change This according to your public
Step 13 :- Recompile And Sign And Enjoy
My Work
My Work
Android
APP
AF-Root Checker
[APP][4.1+] AF Calendar Widget
[APP][2.3+] AF CPU Widget
GUIDE
[GUIDE][2.3+] How to add AF Volume Panel to Android Phone
AF-Battery Mod
ICS PlatLogo
[GUIDE] How to Disable Scrolling Cache for Smooth
[GUIDE] How to add Extra Options in About Sections
[GUIDE] How to add Colorey Platlogo
[GUIDE] How to add Android L Preview Platlogo
[GUIDE] [TUTORIAL] [GUIDE] How to Play with Screen Title
[GUIDE]How to Replace Checkbox with Switch
ROM
[ROM] AF Firey
TOOL
[TOOL] AF-Apk​[TOOL] AF-Signer​​
Reserved
AF Work
AF Work
Android
APP
[APP][4.1+] AF Calendar Widget
[APP][2.3+] AF CPU Widget
GUIDE
[GUIDE][2.3+] How to add AF Volume Panel to Android Phone
ROM
[ROM] AF Firey
TOOL
[TOOL] AF-Apk​[TOOL] AF-Signer​​
I have an error
Hello there
At first I apologize for my English.
I tried this method but I have a problem with steps 11 and 12
can you help me?
when I do research in device_info_settings .. / values ​​/ public.xml
I find 2 id's:
Line 451: <public type="xml" name="device_info_settings" id="0x7f050011" />
Line 2469: <public type="string" name="device_info_settings" id="0x7f0b04a8" />
And I tried with the two solution, I get an error ...
And id 0x7f040010, is:
Line 261: <public type="layout" name="auto_brightness_preview" id="0x7f040010" />
thank you in advance.
daemon1666 said:
Hello there
At first I apologize for my English.
I tried this method but I have a problem with steps 11 and 12
can you help me?
when I do research in device_info_settings .. / values ​​/ public.xml
I find 2 id's:
Line 451:
Line 2469:
And I tried with the two solution, I get an error ...
And id 0x7f040010, is:
Line 261:
thank you in advance.
Click to expand...
Click to collapse
First of Thing that What Android Version r using if Your Android Version 2.3 leave step 12 and 13 if are using 3.0+ then find for that ids change valuse according to ur public device_info_settings (xml one not strings) if u get error pls show me logcat logcat will easily to understand ur problem Recommended You to use AF-Apk to Decompile and Recompile Apk If Want it search on google ok
2nd Things No Need to Say Thanks Just Presss the button
AndroidFire said:
First of You What Android Version if Your Android Version 2.3 leave step 12 and 13 if are using 2.3+ then find for that ids change valuse according to ur public device_info_settings (xml one not layout)
2nd Things No Need to Say Thanks Just Presss the button
Click to expand...
Click to collapse
I have a nexus 5
in custom rom 4.4.4
I started in xml, so I don't know by what I must change the id
can you show me an example?
Sorry but I am a beginner.
daemon1666 said:
I have a nexus 5
in custom rom 4.4.4
I started in xml, so I don't know by what I must change the id
can you show me an example?
Sorry but I am a beginner.
Click to expand...
Click to collapse
First things.
can u attach ur public.xml and DeviceInfoSettings.smali I will Do for You
Second Things Thanks Button will more appericated then saying thanks
AndroidFire said:
First things.
can u attach ur public.xml and DeviceInfoSettings.smali I will Do for You
Second Things Thanks Button will more appericated then saying thanks
Click to expand...
Click to collapse
I joined the archive.
Ihave already made steps 1-9
And
I clicked on the button "thanks" and +1 on Google+
daemon1666 said:
I joined the archive.
Ihave already made steps 1-9
And
I clicked on the button "thanks" and +1 on Google+
Click to expand...
Click to collapse
done mind don't kang my work respect my work here is the link just replace the file
https://db.tt/ieOJqB3g
Thx... Again
If something has changed, I'm sorry, I had tried so many things by myself.
What was the problem?
I just tested ..
The first compilation, I have problems compiling
having replaced the device_info_settings.smali well.
I have attached the log
deleted sorry..

[GUIDE][GB]How to add jellybean like WiFi-BT switch in title bar

Add jellybean like Wi-Fi & Bluetooth ON/OFF switch in title_bar.
This is a cool guide to add Wi-Fi or Bluetooth switch in titlebar as you can see in jellybean.
This mod work will on any gingerbread running phone.
Things you need:-
Apktool/Apk-Multitool
Notepad++
Basic knowledge about compiling & decompiling.
Basic knowledge about xml editing & modding.
Settings.apk from your rom
Click to expand...
Click to collapse
Lets start:-
Step-1
First of all decompile your settings.apk
Step-2
Now download this
and extract it.
Open & copy the "res" and paste it in your decompiled "settings" folder
Step-3
Now goto settings/res/xml and open wifi_settings.xml
Here you will see a line like that:
Code:
<CheckBoxPreference android:persistent="false" android:title="@string/wifi_quick_toggle_title" android:key="enable_wifi" android:summary="@string/wifi_quick_toggle_summary" />
Step-4
Add this android:layout="@layout/sachin_wifi_switch" Now it will look like this:
Code:
<CheckBoxPreference android:persistent="false" [COLOR="red"]android:layout="@layout/sachin_wifi_switch"[/COLOR] android:title="@string/wifi_quick_toggle_title" android:key="enable_wifi" android:summary="@string/wifi_quick_toggle_summary" />
now save and close it.
Step-5
Now open bluetooth_settings.xml
and find this:
Code:
<CheckBoxPreference android:title="@string/bluetooth" android:key="bt_checkbox" android:summary="@string/bluetooth_quick_toggle_summary" />
Step-6
Here add this android:layout="@layout/sachin_bt_switch"
and now it will look like this:
Code:
<CheckBoxPreference [COLOR="red"]android:layout="@layout/sachin_bt_switch"[/COLOR] android:title="@string/bluetooth" android:key="bt_checkbox" android:summary="@string/bluetooth_quick_toggle_summary" />
save and close it.
Step-7
Now open AndroidManifest.xml in "Settings" folder.
Here find this:
Code:
<activity android:label="@string/wifi_settings" android:icon="@drawable/mainmenu_icon_wifi_settings" android:name=".wifi.WifiSettings" android:clearTaskOnLaunch="true" android:configChanges="keyboardHidden|orientation">
Step-8
After "activity" add this android:theme="@android:style/Theme.NoTitleBar"
like this:
Code:
<activity [COLOR="red"]android:theme="@android:style/Theme.NoTitleBar"[/COLOR] android:label="@string/wifi_settings" android:icon="@drawable/mainmenu_icon_wifi_settings" android:name=".wifi.WifiSettings" android:clearTaskOnLaunch="true" android:configChanges="keyboardHidden|orientation">
now find this:
Code:
<activity android:label="@string/bluetooth_settings_title" android:icon="@drawable/mainmenu_icon_bluetooth_settings" android:name=".bluetooth.BluetoothSettings" android:clearTaskOnLaunch="true" android:configChanges="keyboardHidden|orientation">
similarly do here, add android:theme="@android:style/Theme.NoTitleBar" after "activity".
like this:
Code:
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/bluetooth_settings_title" android:icon="@drawable/mainmenu_icon_bluetooth_settings" android:name=".bluetooth.BluetoothSettings" android:clearTaskOnLaunch="true" android:configChanges="keyboardHidden|orientation">
save and close it.
and you are done with modding.
Now compile & Sign the new Settings.apk
and push it to system/app and change the permission to rw-r-r
Enjoy! Press THANKS if you like it
HIT HARD
HIT OFTEN
#Roman Empire​
Regards:- Sachin Kumar53

Categories

Resources