[Galaxy S II Android Development] remuntada78:
GUIDE TO CHANGE QUICKSETTING TOGGLES ICON THEME

[YOUTUBE]ny3qlLrop48[/YOUTUBE]

work perfectly in my JB rom 4.1.2 xwlsd based

Before modding do a Nandroid Backup

thanks and credit to Goldie for his help to achieve this mod:good:

thanks and credit to Didact74 for how to add a listpreference:good:

thanks and credit to CNexus for his shared observer code:good:

To achieve you need:

SecSettings.apk

SystemUI.apk

tool for decompile and compile like apktool 1.5.2;

tool for text edit like notepad++:

Start with SecSettings.apk:

Decompile SecSettings.apk ,go in res/xml ,open with text editor display_settings.xml and add the red line

<CheckBoxPreference android:persistent="false" android:title="@string/display_saving" android:key="power_saving_mode" android:summary="@string/display_saving_mode_summary" />
<CheckBoxPreference android:persistent="false" android:title="@string/notification_pulse_title" android:key="notification_pulse" />
[COLOR="Red"]<PreferenceCategory android:title="@string/statusbar_options" android:key="statusbar_options">
<ListPreference android:persistent="false" android:entries="@array/toggles_chooser_entries" android:title="@string/icon_toggles_chooser" android:key="toggles_chooser" android:summary="@string/icon_toggles_chooser_summary" android:entryValues="@array/toggles_chooser_values" />
</PreferenceCategory>[/COLOR]

Go in res/value open with text editor arrays.xml and add at the end the red line

[COLOR="Red"]<string-array name="toggles_chooser_entries">
<item>S2 Stock Toggles</item>
<item>S5 Stock Toggles</item>
<item>Green Toggles</item>
</string-array>
<string-array name="toggles_chooser_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>[/COLOR]
</resources>

Go in res/value open with text editor strings.xml and add at the end this line

<string name="statusbar_options">Statusbar Options</string>
<string name="icon_toggles_chooser">Toggles Theme</string>
<string name="icon_toggles_chooser_summary">Select toggles\'s icons theme</string>
</resources>

Go in smali\com\android\settings\DisplaySettings.smal i and add the following lines in RED

.field mSupportFolderType:Z

[COLOR="Red"].field private mTogglesTheme:Landroid/preference/ListPreference;[/COLOR]

.field private mTouchKeyLight:Landroid/preference/ListPreference;

In the same file find .method public onCreate and add the following lines in RED

iput-object v12, p0, Lcom/android/settings/DisplaySettings;->mFontSizePref:Landroid/preference/ListPreference;

.line 424
iget-object v12, p0, Lcom/android/settings/DisplaySettings;->mFontSizePref:Landroid/preference/ListPreference;

invoke-virtual {v12, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
[COLOR="Red"]
const-string v12, "toggles_chooser"

invoke-virtual {p0, v12}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v12

check-cast v12, Landroid/preference/ListPreference;

iput-object v12, p0, Lcom/android/settings/DisplaySettings;->mTogglesTheme:Landroid/preference/ListPreference;

const-string v12, "toggles_chooser"

const/4 v13, 0x0

invoke-static {v8, v12, v13}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v12

iget-object v13, p0, Lcom/android/settings/DisplaySettings;->mTogglesTheme:Landroid/preference/ListPreference;

invoke-static {v12}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

move-result-object v12

invoke-virtual {v13, v12}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

iget-object v13, p0, Lcom/android/settings/DisplaySettings;->mTogglesTheme:Landroid/preference/ListPreference;

invoke-virtual {v13, p0}, Landroid/preference/SwitchPreferenceScreen;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V[/COLOR]

.line 426

In the same file find .method public onPreferenceChange then find this code and add the red lines ,in blue line some explanation

const-string v2, "contextualpage_settings"

invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, :[COLOR="Red"]cond_togglestheme[/COLOR] [COLOR="Blue"]change this from cond_2 to cond_togglestheme[/COLOR]

.line 1089
check-cast p2, Ljava/lang/Boolean;

invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z

move-result v0

if-eqz v0, :cond_e

.line 1100
const-string v1, "DisplaySettings"

const-string v3, "CONTEXTUALPAGE_SWITCH_CHANGED changed = false"

invoke-static {v1, v3}, Landroid/util/Log;->secD(Ljava/lang/String;Ljava/lang/String;)I

goto :goto_7

:cond_11
move-wide v0, v4

goto/16 :goto_3

[COLOR="Red"]:cond_togglestheme
iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mTogglesTheme:Landroid/preference/ListPreference;

if-ne p1, v1, :cond_2

check-cast p2, Ljava/lang/String;

invoke-static {p2}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

move-result-object v1

invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

move-result v0

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v2, "toggles_chooser"

invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_4[/COLOR]
.end method

Save all changes and compile SecSettings

SystemUI part

Decompile SystemUI.apk ,download this zip View attachment 2623550 and put the drawable png in res\drawable-hdpi

Compile SystemUI and decompile the new SystemUI.apk to obtain the new ids of the new pngs

So open SystemUI\res\value\public and leave it open

Go in SystemUI\smali\com\android\systemui\statusbar\policy\quicksetting and open AirplaneModeQuickSettingButton,smali and add the following red lines, in blue lines some explanation

find .method public constructor <init>(Landroid/content/Context;)V and change the code from this

.method public constructor <init>(Landroid/content/Context;)V
.locals 9
.parameter "context"

.prologue
const/4 v7, 0x0

.line 112
const/4 v2, 0x0

const v3, 0x7f0a00f5

const v4, 0x7f0201ba

const v5, 0x7f0201b9

const v6, 0x7f0201b8

move-object v0, p0

move-object v1, p1

move v8, v7

invoke-direct/range {v0 .. v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;IIIIII)V

.line 53

to this

.method public constructor <init>(Landroid/content/Context;)V
.locals 9
.parameter "context"

.prologue
[COLOR="Red"] invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v2, "toggles_chooser"

const v3, 0x0

invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v1

const v2, 0x1

if-eq v2, v1, :cond_themes5

const v2, 0x2

if-eq v2, v1, :cond_green

const v3, 0x7f0a00f5 [COLOR="Blue"] <--this is id of text show under the icon, this remain the same in each theme[/COLOR]

const v4, 0x7f0201ba[COLOR="Blue"] <--this id is of stock tw_quick_panel_icon_airplane_on, check if it's the same of you public[/COLOR]

const v5, 0x7f0201b9[COLOR="Blue"] <--this id is of stock tw_quick_panel_icon_airplane_off, check if it's the same of you public[/COLOR]

const v6, 0x7f0201b8[COLOR="Blue"] <--this id is of stock tw_quick_panel_icon_airplane_dim, check if it's the same of you public[/COLOR]

goto :goto_new

:cond_themes5

const v3, 0x7f0a00f5

const v4, 0x7f021104[COLOR="Blue"] <--this id is of s5tw_quick_panel_icon_airplane_on, check if it's the same of you public[/COLOR]

const v5, 0x7f021103[COLOR="Blue"] <--this id is of s5tw_quick_panel_icon_airplane_off, check if it's the same of you public[/COLOR]

const v6, 0x7f021102[COLOR="Blue"] <--this id is of s5tw_quick_panel_icon_airplane_dim, check if it's the same of you public[/COLOR]

goto :goto_new

:cond_green

const v3, 0x7f0a00f5

const v4, 0x7f0210d2[COLOR="Blue"] <--this id is of greentw_quick_panel_icon_airplane_on, check if it's the same of you public[/COLOR]

const v5, 0x7f0210d1[COLOR="Blue"] <--this id is of greentw_quick_panel_icon_airplane_off, check if it's the same of you public[/COLOR]

const v6, 0x7f0210d0[COLOR="Blue"] <--this id is of greentw_quick_panel_icon_airplane_dim, check if it's the same of you public[/COLOR]

:goto_new[/COLOR]

const/4 v7, 0x0

.line 112
const/4 v2, 0x0

move-object v0, p0

move-object v1, p1

move v8, v7

invoke-direct/range {v0 .. v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;IIIIII)V

.line 53

then apply the same code for these others smali file:

AllShareCastQuickSettingButton

AutoRotateQuickSettingButton

BluetoothQuickSettingButton

DoNotDisturbQuickSettingButton

DormantModeQuickSettingButton

DrivingModeQuickSettingButton

LocationQuickSettingButton

MobileDataQuickSettingButton

MultiWindowQuickSettingButton

NfcP2pQuickSettingButton

PowerSavingQuickSettingButton

SBeamQuickSettingButton

SilentModeQuickSettingButton

SmartStayQuickSettingButton

SyncQuickSettingButton

WifiQuickSettingButton

In the SilentModeQuickSettingButton.smali change code from this

.method public constructor <init>(Landroid/content/Context;)V
.locals 9
.parameter "context"

.prologue
const/4 v2, 0x0

const v5, 0x7f0201ed

.line 53
const v3, 0x7f0a00ed

const v4, 0x7f0201ec

const/4 v6, 0x0

const v7, 0x7f0201eb

move-object v0, p0

move-object v1, p1

move v8, v5

invoke-direct/range {v0 .. v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;IIIIII)V

.line 36
iput-object v2, p0, Lcom/android/systemui/statusbar/policy/quicksetting/SilentModeQuickSettingButton;->mAudioManager:Landroid/media/AudioManager;

to this

.method public constructor <init>(Landroid/content/Context;)V
.locals 9
.parameter "context"

.prologue
[COLOR="Red"]	invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v2, "toggles_chooser"

const v3, 0x0

invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v1

const v2, 0x1

if-eq v2, v1, :cond_themes5

const v2, 0x2

if-eq v2, v1, :cond_green

const v5, 0x7f0201ed [COLOR="Blue"] this id is stock tw_quick_panel_icon_silent_on [/COLOR]

const v3, 0x7f0a00ed[COLOR="Blue"] this id is for the text[/COLOR]

const v4, 0x7f0201ec[COLOR="Blue"] this id is stock tw_quick_panel_icon_silent_off [/COLOR]

const v7, 0x7f0201eb[COLOR="Blue"] this id is stock tw_quick_panel_icon_silent_on_on [/COLOR]

goto :goto_new

:cond_themes5

const v5, 0x7f02112a[COLOR="Blue"] this id is s5tw_quick_panel_icon_silent_on [/COLOR]

const v3, 0x7f0a00ed

const v4, 0x7f021128[COLOR="Blue"] this id is s5tw_quick_panel_icon_silent_on [/COLOR]

const v7, 0x7f021127[COLOR="Blue"] this id is s5tw_quick_panel_icon_silent_on [/COLOR]

goto :goto_new

:cond_green

const v5, 0x7f0210f8[COLOR="Blue"] this id is greentw_quick_panel_icon_silent_on [/COLOR]

const v3, 0x7f0a00ed

const v4, 0x7f0210f7[COLOR="Blue"] this id is greentw_quick_panel_icon_silent_on [/COLOR]

const v7, 0x7f0210f6[COLOR="Blue"] this id is greentw_quick_panel_icon_silent_on [/COLOR]

:goto_new[/COLOR]

const/4 v2, 0x0

.line 53
const/4 v6, 0x0

move-object v0, p0

move-object v1, p1

move v8, v5

invoke-direct/range {v0 .. v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;IIIIII)V

.line 36
iput-object v2, p0, Lcom/android/systemui/statusbar/policy/quicksetting/SilentModeQuickSettingButton;->mAudioManager:Landroid/media/AudioManager;

For each smali files check each ids with yours in your public.xml

This part add the observer, is to change the icons theme in real time, whitout this part you need to restart device to show the changes

Go in SystemUI\smali\com\android\systemui\statusbar\policy\quicksetting and open QuickSettingPanel

find .method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V and add the following red lines at the end

.line 99
invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->update()V

.line 100
[COLOR="Red"]iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->mContext:Landroid/content/Context;

invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v0

invoke-direct {p0, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->regObserver(Landroid/content/ContentResolver;)V[/COLOR]

return-void
.end method

then add this entire in red method like this

.method static synthetic access$100(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;)I
.locals 1
.parameter "x0"

.prologue
.line 51
iget v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->mButtonCnt:I

return v0
.end method

[COLOR="Red"].method static synthetic access$500(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;)V
.locals 0
.parameter

.prologue
.line 83
invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->refreshView()V

return-void
.end method[/COLOR]

.method private disableQuickSettingButton([Ljava/lang/String;)[Ljava/lang/String;
.locals 3

then add this entire in red method like this

:cond_2
invoke-virtual {p0, v11}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->prepareTranslationX(Z)V

.line 345
return-void
.end method

[COLOR="Red"].method private regObserver(Landroid/content/ContentResolver;)V
.locals 3
.parameter "cs"

.prologue
const/4 v2, 0x0

new-instance v0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel$SettingsObserver;

new-instance v1, Landroid/os/Handler;

invoke-direct {v1}, Landroid/os/Handler;-><init>()V

invoke-direct {v0, p0, p0, v1}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel$SettingsObserver;-><init>(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;Landroid/os/Handler;)V

.local v0, ob:Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel$SettingsObserver;
const-string v1, "toggles_chooser"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

invoke-virtual {p1, v1, v2, v0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

return-void
.end method[/COLOR]

.method private setViewWidth()I
.locals 5

then add this smali file View attachment 2623605 in SystemUI\smali\com\android\systemui\statusbar\policy\quicksetting

Save all changes and compile SystemUI, the put SecSettings.apk and SystemUI.apk in your device.