[Asus Zenfone 4] bamzzz:
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:

<uses-permission android:name="android.permission.REBOOT"/>

Add below:

<uses-permission android:name="android.permission.FORCE_STOP_PACKAGES" />

Scroll to end of line, add this above </application>

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

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

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

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

<color name="colorAccent">#ffff4081</color>
<color name="colorPrimary">#ff3f51b5</color>
<color name="colorPrimaryDark">#ff303f9f</color>

7. Open res/values/dimens.xml and add this:

<dimen name="button_size">30.0dip</dimen>

8. Open res/values/ids.xml and add this:

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

<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. :p

Thanks to:

wuby986@xda

daxgirl@xda

Guide by bamzzz@xda

fb.me/bamz4ever