FORUMS
Remove All Ads from XDA

[GUIDE][HOW] Easy Preference Control

104 posts
Thanks Meter: 218
 
Post Reply Email Thread
Hi all.. i'm back again for share guide about add preference into stock Settings.apk
This guide is work for JB 4.1+

Feature:
PreferenceScreen
SeekBarPreference
ColorPickerPreference
MyListPreference
SwitchPreference
CheckBoxPreference
MyEditTextPreference
FilePreference
and many more..

Requirement:
- Understanding about APK compile/decompile
- APKTool
- Notepad++ (PC)

How:
1. Decompile Settings.apk
2. Copy smali and res folder from guide
3. Open AndroidManifest.xml
Find:
Code:
    <uses-permission android:name="android.permission.REBOOT"/>
Add below:
Code:
    <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES" />
Scroll to end of line, add this above </application>
Code:
    <activity android:label="@string/zen_control_title" android:name="com.android.settings.bamzzz.ZenControl" />
4. Open res/xml/dashboard_categories.xml (Lollipop) or res/xml/settings_headers.xml (JB)
Add this below "<dashboard-category android:id="@id/system_section" ..." or what do you want
Lollipop:
Code:
        <dashboard-tile android:icon="@drawable/ic_settings_zencontrol" android:id="@id/zen_control" android:title="@string/zen_control_title" android:fragment="com.android.settings.bamzzz.ZenControl" />
JB:
Code:
        <header android:icon="@drawable/ic_settings_zencontrol" android:id="@id/zen_control" android:title="@string/zen_control_title" android:fragment="com.android.settings.bamzzz.ZenControl" />
5. Open res/values/attrs.xml and add this:
Code:
    <attr name="colorPrimary" format="color" />
    <attr name="colorPrimaryDark" format="color" />
    <attr name="colorAccent" format="color" />
	<declare-styleable name="ThumbnailListPreference">
        <attr name="drawableArray" format="reference" />
        <attr name="entryList" format="reference" />
        <attr name="entryValuesList" format="reference" />
        <attr name="entryDefault" format="string" />
    </declare-styleable>
6. Open res/values/colors.xml and add this:
Code:
    <color name="colorAccent">#ffff4081</color>
    <color name="colorPrimary">#ff3f51b5</color>
    <color name="colorPrimaryDark">#ff303f9f</color>
7. Open res/values/dimens.xml and add this:
Code:
    <dimen name="button_size">30.0dip</dimen>
8. Open res/values/ids.xml and add this:
Code:
    <item type="id" name="zen_control">false</item>
    <item type="id" name="appIcon">false</item>
    <item type="id" name="linearLayout">false</item>
    <item type="id" name="appName">false</item>
    <item type="id" name="appPackage">false</item>
    <item type="id" name="imageView">false</item>
    <item type="id" name="color_picker_view">false</item>
    <item type="id" name="text_hex_wrapper">false</item>
    <item type="id" name="hex_val">false</item>
    <item type="id" name="old_color_panel">false</item>
    <item type="id" name="new_color_panel">false</item>
    <item type="id" name="fileSwitch">false</item>
    <item type="id" name="searchApp">false</item>
    <item type="id" name="appsList">false</item>
    <item type="id" name="progressBar">false</item>
    <item type="id" name="iconForApp">false</item>
    <item type="id" name="seekBarPrefUnitsRight">false</item>
    <item type="id" name="seekBarPrefValue">false</item>
    <item type="id" name="seekBarPrefUnitsLeft">false</item>
    <item type="id" name="seekBarPrefBarContainer">false</item>
    <item type="id" name="seekBarPrefSeekBar">false</item>
    <item type="id" name="thumbnailRadioButton">false</item>
    <item type="id" name="thumbnailImage">false</item>
    <item type="id" name="thumbnailText">false</item>
    <item type="id" name="thumbnailListView">false</item>
    <item type="id" name="thumbnailIcon">false</item>
9. Open res/values/strings.xml and add this:
Code:
    <string name="zen_control_title">Zen Control™</string> <!-- Rename if do you want -->
    <string name="ok">OK</string>
    <string name="app_reboot_required_title">App Reboot Required</string>
    <string name="app_reboot_required_message">%1$s reboot is required for the changes to take effect.\n\nReboot now?</string>
    <string name="dialog_color_picker">Color Picker</string>
    <string name="press_color_to_apply">Press on Color to apply</string>
10. Open smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali
Find "0x1020018" and replace with public id from framework-res type="id" name="widget_frame"
11. Open smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali
Find "0x1020010" and replace with public id from framework-res type="id" name="summary"
12. Open res/xml/zen_prefs.xml, add/edit your preference here...
13. Done

Attention: Don't rename smali and/or folder structure without my permission..!!!

Keep oprek. Salam bootloop.

Thanks to:
[email protected]
[email protected]

Guide by [email protected]
fb.me/bamz4ever
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2016-02-19-07-00-05.png
Views:	2990
Size:	58.6 KB
ID:	3651486   Click image for larger version

Name:	Screenshot_2016-02-19-07-00-34.png
Views:	3022
Size:	66.9 KB
ID:	3651487   Click image for larger version

Name:	Screenshot_2016-02-19-07-00-13.png
Views:	2918
Size:	43.4 KB
ID:	3651488   Click image for larger version

Name:	Screenshot_2016-02-19-07-00-23.png
Views:	2554
Size:	58.4 KB
ID:	3651489  
Attached Files
File Type: zip Guide Easy Preference Control.zip - [Click for QR Code] (408.4 KB, 2266 views)
The Following 7 Users Say Thank You to bamzzz For This Useful Post: [ View ] Gift bamzzz Ad-Free
6th March 2016, 02:23 AM |#3  
Junior Member
Thanks Meter: 0
 
More
Ask um,
java.lang.RuntimeException: Unable to resume activity {com.android.settings/com.android.settings.SubSettings}: java.lang.NullPointerException: Attempt to read from null array
at android.app.ActivityThread.performResumeActivity(A ctivityThread.java:3019)
at android.app.ActivityThread.handleResumeActivity(Ac tivityThread.java:3050)
at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:2425)
at android.app.ActivityThread.access$900(ActivityThre ad.java:154)
at android.app.ActivityThread$H.handleMessage(Activit yThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:10 2)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.jav a:5294)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:699)
7th March 2016, 08:48 AM |#5  
Junior Member
Thanks Meter: 0
 
More
missing 0x1020010 tutor no.11
Quote:
Originally Posted by bamzzz


11. Open smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali
Find "0x1020010" and replace with public id from framework-res type="id" name="summary"

i cant find that tutor sir
please help
7th March 2016, 12:55 PM |#6  
Junior Member
Thanks Meter: 0
 
More
No undefined array sir ?
29th June 2016, 06:10 PM |#7  
Junior Member
Flag Kolhapur
Thanks Meter: 2
 
More
Quote:
Originally Posted by shining.surya

i cant find that tutor sir
please help

i am also not able to find
17th July 2016, 01:52 PM |#8  
moonryder's Avatar
Senior Member
Flag southern
Thanks Meter: 757
 
More
@bamzzz @venkat kamesh
added missed
Code:
<public type="id" name="widget_frame" id="0x7f0f02e1" />
to public.xml
and missed
Code:
<item type="id" name="widget_frame">false</item>
to ids.xml
recompiled settings.apk to get public id´s
decompiled again and wanted to change id´s in smali.
But there is no value 0x1020010 in smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali
17th July 2016, 02:43 PM |#9  
venkat kamesh's Avatar
Recognized Contributor
Flag Tirupati
Thanks Meter: 10,889
 
Donate to Me
More
Quote:
Originally Posted by moonryder

@bamzzz @venkat kamesh
added missed

Code:
<public type="id" name="widget_frame" id="0x7f0f02e1" />
to public.xml
and missed
Code:
<item type="id" name="widget_frame">false</item>
to ids.xml
recompiled settings.apk to get public id´s
decompiled again and wanted to change id´s in smali.
But there is no value 0x1020010 in smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali

Bro adding id was not a matter

In layout xml or any xml. Where id is defined

Just change @iD to @+id this will add the required id to ids.xml also creates public id

Coming to 0x10xxxxx these public ids will be with framework-res.apk.

Good luck bro
18th July 2016, 04:24 PM |#10  
moonryder's Avatar
Senior Member
Flag southern
Thanks Meter: 757
 
More
Quote:
Originally Posted by venkat kamesh

Bro adding id was not a matter

In layout xml or any xml. Where id is defined

Just change @iD to @+id this will add the required id to ids.xml also creates public id

Coming to 0x10xxxxx these public ids will be with framework-res.apk.

Good luck bro

hi bro,

thx for the tipp with the +id

I looked in the framework-res and saw that there has nothing to be changed in the smali cuz the id´s are the same.
But there is no value 0x1020010 in smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali - so i can´t check/change the id!
And without that value this mod did not work! (also the one from @venkat kamesh) - pity
20th July 2016, 04:27 AM |#11  
venkat kamesh's Avatar
Recognized Contributor
Flag Tirupati
Thanks Meter: 10,889
 
Donate to Me
More
Quote:
Originally Posted by moonryder

hi bro,

thx for the tipp with the +id

I looked in the framework-res and saw that there has nothing to be changed in the smali cuz the id´s are the same.
But there is no value 0x1020010 in smali/com/android/settings/bamzzz/prefs/ColorPickerPreference.smali - so i can´t check/change the id!
And without that value this mod did not work! (also the one from @venkat kamesh) - pity

Haha this guide was not from me
I haven't tested it either bro

See @Bloodlvst solved this
Hope he may help you bro
Post Reply Subscribe to Thread

Tags
settings

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes