[Sony Xperia S, Acro S, Ion] accts:
++++++++++++++++++++++++++++++++++

UPDATED July 10, 2013: This GUIDE was written back for ICS firmware, although it might still work for JB - I couldn't confirm that due to the fact I had stopped developing/modding. Keep in mind you need to use the latest APKtool - From Here - for JB system. Also don't forget to copy from original apk "AndroidManifest.xml" file and "META-INF" folder for the New "modded" SystemUI.apk to work.

++++++++++++++++++++++++++++++++++

I was helping a member learn how to add the brightness bar slider to his/her status bar. Since I spend a good amount of time typing it up. So I might as well post it here for everyone :D

General Knowledge

PART I:

Download resource file here: SystemX.zip

Decompile your SystemUI

Copy from the file/folder in SystemX to same location on your SystemUI:

icon: /res/drawable-hdpi/quickpanel_brightness_icon.png

(could be different folder based on your device, where ever your toggle icons put it there)

file: res/layout/quickpanel_brightness_settings.xml

folder: /smali/com/android/systemui/statusbar/quickpanel folder

PART II:

Now you need to declare all added variants:

Ids - Open /res/values/ids.xml - Add these three lines at the end. Close & save.

<item type="id" name="title">false</item>
<item type="id" name="brightness_slider">false</item>
<item type="id" name="automatic">false</item>

Strings - Open /res/values/strings.xml - Add these two lines at the end. Close & save.

<string name="brightness_settings_title">Brightness</string>
<string name="brightness_settings_automatic">Fixed</string>

Public - Open /res/values/public.xml - Add to end of each section - Continue with the last id called out.

....
<public type="drawable" name="quickpanel_brightness_icon" id=[color=red]"0x7f020166"[/color] />
....
<public type="layout" name="quickpanel_brightness_settings" id=[color=red]"0x7f03001e"[/color] />
...
<public type="string" name="brightness_settings_title" id=[color=red]"0x7f08009e"[/color] />
<public type="string" name="brightness_settings_automatic" id=[color=red]"0x7f08009f"[/color] />
...
<public type="id" name="title" id=[color=red]"0x7f0e009d"[/color] />
<public type="id" name="brightness_slider" id=[color=red]"0x7f0e009e"[/color] />
<public type="id" name="automatic" id=[color=red]"0x7f0e009f"[/color] />

*Change those in red per your ids - best open public.xml in Excel, sort by id - you will see the last number was used in each section.

PART III:

Now we need to edit the Smali associated with your Public.xml Id's:

Open /smali/com/android/systemui/statusbar/quickpanel/BrightnessSettingsView.smali in Notepad++ (or similar) - Change if needed:

@ line 201

const v1, [color=red]0x7f08009e[/color]

ID associated with public.xml string section name="brightness_setting_title"

@ line 207

const v1, [color=red]0x7f08009f[/color]

ID associated with public.xml string section name="brightness_settings_automatic"

@ line 257

const v1, [color=red]0x7f0e009d[/color]

ID associated with public.xml id section name="title"

@ line 267

const v1, [color=red]0x7f0e009e[/color]

ID associated with public.xml id section name="brightness_slider"

@ line 308

const v1, [color=red]0x7f0e009f[/color]

ID associated with public.xml id section name="automatic"

Save & Close.

Open /smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali in Notepad++ (or similar)

Find this Section:

....
.method protected makeStatusBarView()Landroid/view/View;
.locals 13

.prologue
const/16 v12, 0x8
.....
[i](very long find the last line in this section)[/i]
.....
[color=blue].line 382
return-object v4[/color]

.line 311
.end local v2 #filter:Landroid/content/IntentFilter;
.end local v6 #signalCluster:Lcom/android/systemui/statusbar/SignalClusterView;
.end local v7 #statSysNoSim:Landroid/widget/ImageView;
.end local v8 #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
:catch_0
move-exception v9

goto/16 :goto_0
.end method
.method onBarViewAttached()V
......

In between .line 382 (this line number is not important - ignore whatever it is, only make sure it's the last line in this section) and return-object v4 - Add:

[color=indigo][color=blue].line 382[/color]
const v6, [color=red]0x7f03001e[/color]

invoke-static {v0, v6, v11}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

move-result-object v5

check-cast v5, Lcom/android/systemui/statusbar/quickpanel/BrightnessSettingsView;

invoke-virtual {v5}, Lcom/android/systemui/statusbar/quickpanel/BrightnessSettingsView;->init()V

iget-object v6, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedView:Lcom/android/systemui/statusbar/phone/ExpandedView;

const/4 p0, 0x1

invoke-virtual {v6, v5, p0}, Lcom/android/systemui/statusbar/phone/ExpandedView;->addView(Landroid/view/View;I)V

[color=blue]return-object v4[/color][/color]

ID associated with public.xml layout section name="quickpanel_brightness_settings"

Note:

If you already had Toggle Mod - It should look like this:

[color=blue].line 382[/color]
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

invoke-virtual {v0, v9, v2}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

const v6, 0x7f03001c

invoke-static {v0, v6, v11}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

move-result-object v5

check-cast v5, Lcom/lidroid/systemui/quickpanel/PowerWidget;

invoke-virtual {v5}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V

iget-object v6, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedView:Lcom/android/systemui/statusbar/phone/ExpandedView;

invoke-virtual {v6, v5, v11}, Lcom/android/systemui/statusbar/phone/ExpandedView;->addView(Landroid/view/View;I)V

[color=indigo]const v6, [color=red]0x7f03001e[/color]

invoke-static {v0, v6, v11}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

move-result-object v5

check-cast v5, Lcom/android/systemui/statusbar/quickpanel/BrightnessSettingsView;

invoke-virtual {v5}, Lcom/android/systemui/statusbar/quickpanel/BrightnessSettingsView;->init()V

iget-object v6, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedView:Lcom/android/systemui/statusbar/phone/ExpandedView;

const/4 p0, 0x1

invoke-virtual {v6, v5, p0}, Lcom/android/systemui/statusbar/phone/ExpandedView;->addView(Landroid/view/View;I)V

[color=blue]return-object v4[/color][/color]

Save & Close

PART IV:

Compile & push to your system, don't forget to set your permission to rw-r--r-- ! DONE.

The End:

That's all - Wasn't that hard, wasn't it ? :silly: .... Good Luck !!! :highfive:

Disclaimer: