FORUMS
Remove All Ads from XDA

[MOD/TUTORIAL] [LP] Add reboot option for Systemui (the easy way)

430 posts
Thanks Meter: 624
 
By Denie46, Senior Member on 18th April 2016, 10:15 AM
Post Reply Email Thread
I got asked a few times on how to add reboot option for SystemUI just like in my ROM.

Here's how it looks like: (the button next to the battery icon)



Q: Why this is the easy way?
A: Basically there are two ways to make your SystemuI restart - the one is using java/smali and the other, the easier way, is using xml editing only.
Q: How does it work?
A: In xml language for Android every element has it's own attributes, for example the button that we're going to use has an
Code:
android:onClick
attribute, this specific attribute allows to call a method from java/smali in order to start a certain function. But if no method is found the SystemUI app will force close and then automatically start again - which is what we want.


Requirements:
--- you know what compile/decompile is
--- you know what odex/deodex is
--- you have experience with flashing stuff
Warning! This mod might work on odexed roms since it doesn't mess with smali. For odexed users it is highly recommended that a back up is created.

Installation:
--- locate your SystemUI. It's in system>priv-app>SystemUI>SystemUI.apk
--- decompile
--- go to res>layout and open status_bar_expanded_header.xml
--- find the following line of code:
Code:
<TextView android:textSize="@dimen/battery_level_text_size" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/battery_level" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="noHideDescendants" android:paddingEnd="@dimen/battery_level_padding_end" android:layout_marginStart="@dimen/header_battery_margin_expanded" />
    </LinearLayout>
--- paste this code after it:
Code:
 <ImageButton
     android:layout_height="wrap_content"
     android:layout_width="wrap_content"
     android:background="@drawable/systemui_restart"
     android:layout_toStartOf="@id/multi_user_switch"
     android:onClick="selfDestruct" 
     android:layout_marginRight="160dip"
     android:layout_marginTop="19dip"/>
--- save the xml file
--- the hard parts is over
--- download the attached systemUI_drawables.zip archive (non-flashable!) and put the extracted files into your systemui
--- compile and flash


When your phone reboots you should now have a reboot SystemUI option!
Happy play!
Attached Files
File Type: zip systemUI_drawables.zip - [Click for QR Code] (6.4 KB, 154 views)
19th April 2016, 10:08 PM |#3  
ipuzz's Avatar
Senior Member
Flag YOGYAKARTA
Thanks Meter: 57
 
More
thx
working perfectly! thx
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2016-04-20-03-02-21-picsay.jpg
Views:	418
Size:	249.6 KB
ID:	3724429  
21st April 2016, 06:24 AM |#4  
silaey's Avatar
Junior Member
Flag Kingstone
Thanks Meter: 2
 
More
Quote:
Originally Posted by ipuzz

working perfectly! thx

are you using mokee rom???

Sent from my 2014811
21st April 2016, 12:35 PM |#5  
ipuzz's Avatar
Senior Member
Flag YOGYAKARTA
Thanks Meter: 57
 
More
Quote:
Originally Posted by silaey

are you using mokee rom???

Sent from my 2014811

Am used Stock rom deodex Xperia z1 😀😜
Post Reply Subscribe to Thread

Tags
axp, denie46, reboot, systemui, systemui reboot

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

Advanced Search
Display Modes