[Android Themes] Akhilendra Gadde:
Implementing Auto-Close SystemUI feature

@ Devs [MENTION=4987653]BOND1987[/MENTION] , @akash akya ,

There is no need to edit any thing else but only systemuiservice.smali.....

I have taken these resources from Suvi v12 rom by bsuhas. So actual credits to bsuhas :)

Just Replace your entire OnClick Method by the below method:-

[B][COLOR="black"].method public [COLOR="red"]SettingsButton[/COLOR](Landroid/view/View;)V
.locals 3
.parameter "v"

.prologue
.line 2431
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 2432
const-string v1, "[COLOR="Red"]com.android.settings[/COLOR]"

const-string v2, "[COLOR="red"]com.android.settings.Settings[/COLOR]"

invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

const/high16 v2, 0x1000

invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

move-result-object v0

.line 2433
invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

const-string v1, "statusbar"

invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/app/StatusBarManager;

[COLOR="red"]invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V[/COLOR]

.line 1720
return-void
.end method[/COLOR][/B]

and then make the following changes

* replace red ones with the following -

in the 1st line, give any name to the button u want to define . eg:- .method public ProfileButton(Landroid/view/View;)V

in const-string v1, " * put target class name here*

in const - string v2, " * put the target class name as well as an activity to call it *

for eg:-

in const - string v1 ----- target class is to call the complete app ---------> com.android.contacts

and in const - string v2 ----- add package name + an activity to call it --------> com.android.contacts.activities.PeopleActivity

Lets take an example for defining a method and calling it . i'll call Settings here

.method public [COLOR="red"]settingsButton[/COLOR](Landroid/view/View;)V
.locals 3
.parameter "v"

.prologue
.line 2431
new-instance v0, Landroid/content/Intent;

invoke-direct {v0}, Landroid/content/Intent;-><init>()V

.line 2432
const-string v1, "[COLOR="red"]com.android.settings[/COLOR]"

const-string v2, "[COLOR="red"]com.android.settings.Settings[/COLOR]"

invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

const/high16 v2, 0x1000

invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

move-result-object v0

.line 2433
invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

const-string v1, "statusbar"

invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/app/StatusBarManager;

invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

.line 1720
return-void
.end method

after this we have to call it on clicking a tile . so lets define it in the quickpanel_quick_settings_space.xml

Add this wherever you want the tile to appear . ;)

<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tile_toggle" android:layout_width="125.0px" android:layout_height="150.0px" android:layout_weight="1.0">
<Button android:layout_gravity="center_horizontal" android:background="@drawable/set" android:layout_width="wrap_content" android:layout_height="wrap_content" [COLOR="Red"][SIZE="4"]android:onClick="settingsButton"[/SIZE][/COLOR] />
<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:gravity="center" android:background="#00000000" android:layout_width="240.0px" android:layout_height="wrap_content" android:layout_marginBottom="3.0px" android:text="Settings" android:singleLine="true" android:layout_alignParentBottom="true" />
</RelativeLayout>

Video to Confirm it working. :highfive:

[YOUTUBE]UlsgbRLG_f8[/YOUTUBE]

Sorry if the above explaination is too long :fingers-crossed::fingers-crossed: