Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,955 Members 52,932 Now Online
XDA Developers Android and Mobile Development Forum

[How-To]Removing Battery Percentage,Adding Toggles,Battery Circles to Statusbar

Tip us?
 
neectron
Old
(Last edited by neectron; 17th November 2012 at 04:08 AM.)
#1  
neectron's Avatar
Senior Member - OP
Thanks Meter 1,521
Posts: 1,540
Join Date: Dec 2011
Location: Really>?

 
DONATE TO ME
Default [How-To]Removing Battery Percentage,Adding Toggles,Battery Circles to Statusbar

[How-To]Removing Battery Percentage and Adding Toggles to Statusbar



Quote:
Thanks to pvyParts for being part of this thread.

More info about public.xml - http://forum.xda-developers.com/show...8&postcount=73


Adding/porting toggles to Statusbar.
  • Decompile SystemUI.apk

  • Copy both folders from lidroid.zip to /systemui/smali.

  • Copy icons from the quickpanel-icons.zip to /systemui/res/drawable-hdpi.

  • Copy 3 xmls from power.zip to /systemui/res/layout.

  • Copy arrays.xml to /systemui/res/values.

    Resource modifications:

  • Edit "systemui\res\values\ids.xml" and add these Id:
     

    Code:
    <item type="id" name="power_widget_button_image">false</item>
    <item type="id" name="power_widget_button_text">false</item>
    <item type="id" name="power_widget_button_indic">false</item>
    <item type="id" name="power_widget_button">false</item>



  • Edit "systemui\res\values\strings.xml" and add these strings:
     

    Code:
        <string name="quickpanel_sound_text">Sound</string>
        <string name="quickpanel_sound_vibration_text">Sound</string>
        <string name="quickpanel_silent_text">Silent</string>
        <string name="quickpanel_vibration_text">Vibration</string>
        <string name="quickpanel_rotation_text">Rotation</string>
        <string name="quickpanel_bluetooth_text">Bluetooth</string>
        <string name="quickpanel_gps_text">GPS</string>
        <string name="quickpanel_autosync_text">Auto Sync</string>
        <string name="quickpanel_brightness_text">Brightness</string>
        <string name="quickpanel_screen_timeout_text">Timeout</string>
        <string name="quickpanel_lockscreen_text">Lockscreen</string>
        <string name="quickpanel_airplane_text">Flight</string>
        <string name="quickpanel_flashlight_text">Flashlight</string>
        <string name="quickpanel_reboot_text">Reboot</string>
        <string name="quickpanel_shutdown_text">Shutdown</string>
        <string name="airplane_mode">In Flight mode</string>
        <string name="shutdown_confirm">Your phone will shut down.</string>
        <string name="screen_timeout_seconds">Screen timeout set to: %d second(s)</string>
        <string name="screen_timeout_minutes">Screen timeout set to: %d minute(s)</string>
        <string name="screen_timeout_hours">Screen timeout set to: %d hour(s)</string>
        <string name="hamster">Phone Options</string>
        <string name="yes">OK</string>
        <string name="no">Cancel</string>
        <string name="reboot">Reboot</string>
        <string name="reboot_recovery">Recovery</string>
        <string name="quickpanel_dc_text">Data</string>
        <string name="reboot_download">Download</string>
        <string name="quickpanel_network_mode_text">Network</string>
        <string name="quickpanel_wifi_text">WiFi</string>


  • Edit "systemui\res\values\public.xml" and add these:

  • Add after the last drawable declared:

     

    Code:
        <public type="drawable" name="stat_2g3g_off" id="0x7f0200e1" />
        <public type="drawable" name="stat_2g3g_on" id="0x7f0200e2" />
        <public type="drawable" name="stat_3g_on" id="0x7f0200e3" />
        <public type="drawable" name="stat_airplane_off" id="0x7f0200e4" />
        <public type="drawable" name="stat_airplane_on" id="0x7f0200e5" />
        <public type="drawable" name="stat_bg_ing" id="0x7f0200e6" />
        <public type="drawable" name="stat_bg_off" id="0x7f0200e7" />
        <public type="drawable" name="stat_bg_on" id="0x7f0200e8" />
        <public type="drawable" name="stat_bluetooth_off" id="0x7f0200e9" />
        <public type="drawable" name="stat_bluetooth_on" id="0x7f0200ea" />
        <public type="drawable" name="stat_brightness_auto" id="0x7f0200eb" />
        <public type="drawable" name="stat_brightness_mid" id="0x7f0200ec" />
        <public type="drawable" name="stat_brightness_off" id="0x7f0200ed" />
        <public type="drawable" name="stat_brightness_on" id="0x7f0200ee" />
        <public type="drawable" name="stat_data_off" id="0x7f0200ef" />
        <public type="drawable" name="stat_data_on" id="0x7f0200f0" />
        <public type="drawable" name="stat_flashlight_off" id="0x7f0200f1" />
        <public type="drawable" name="stat_flashlight_on" id="0x7f0200f2" />
        <public type="drawable" name="stat_gps_off" id="0x7f0200f3" />
        <public type="drawable" name="stat_gps_on" id="0x7f0200f4" />
        <public type="drawable" name="stat_lock_screen_off" id="0x7f0200f5" />
        <public type="drawable" name="stat_lock_screen_on" id="0x7f0200f6" />
        <public type="drawable" name="stat_wifi_on" id="0x7f0200f7" />
        <public type="drawable" name="stat_orientation_off" id="0x7f0200f8" />
        <public type="drawable" name="stat_orientation_on" id="0x7f0200f9" />
        <public type="drawable" name="stat_reboot" id="0x7f0200fc" />
        <public type="drawable" name="stat_ring_on" id="0x7f0200fd" />
        <public type="drawable" name="stat_ring_vibrate_on" id="0x7f0200fe" />
        <public type="drawable" name="stat_screen_timeout_10m" id="0x7f0200ff" />
        <public type="drawable" name="stat_screen_timeout_15s" id="0x7f020100" />
        <public type="drawable" name="stat_screen_timeout_1m" id="0x7f020101" />
        <public type="drawable" name="stat_screen_timeout_2m" id="0x7f020102" />
        <public type="drawable" name="stat_screen_timeout_30s" id="0x7f020103" />
        <public type="drawable" name="stat_screen_timeout_off" id="0x7f020104" />
        <public type="drawable" name="stat_screen_timeout_on" id="0x7f020105" />
        <public type="drawable" name="stat_screen_timeout_unknown" id="0x7f020106" />
        <public type="drawable" name="stat_shutdown" id="0x7f020107" />
        <public type="drawable" name="stat_silent" id="0x7f020108" />
        <public type="drawable" name="stat_sync_off" id="0x7f020109" />
        <public type="drawable" name="stat_sync_on" id="0x7f02010a" />
        <public type="drawable" name="stat_vibrate_off" id="0x7f02010b" />
        <public type="drawable" name="stat_wifi_off" id="0x7f02010c" />


  • Add after the last layout declared:

    Code:
        <public type="layout" name="power_widget_button" id="0x7f03001b" />
        <public type="layout" name="power_widget_layout" id="0x7f03001c" />
        <public type="layout" name="power_widget_scrollview" id="0x7f03001d" />
  • Add after the last string declared:
     

    Code:
       <public type="string" name="quickpanel_sound_text" id="0x7f08007f" />
        <public type="string" name="quickpanel_sound_vibration_text" id="0x7f080080" />
        <public type="string" name="quickpanel_silent_text" id="0x7f080081" />
        <public type="string" name="quickpanel_vibration_text" id="0x7f080082" />
        <public type="string" name="quickpanel_rotation_text" id="0x7f080083" />
        <public type="string" name="quickpanel_bluetooth_text" id="0x7f080084" />
        <public type="string" name="quickpanel_gps_text" id="0x7f080085" />
        <public type="string" name="quickpanel_autosync_text" id="0x7f080086" />
        <public type="string" name="quickpanel_brightness_text" id="0x7f080087" />
        <public type="string" name="quickpanel_screen_timeout_text" id="0x7f080088" />
        <public type="string" name="quickpanel_lockscreen_text" id="0x7f080089" />
        <public type="string" name="quickpanel_airplane_text" id="0x7f08008a" />
        <public type="string" name="quickpanel_flashlight_text" id="0x7f08008b" />
        <public type="string" name="quickpanel_reboot_text" id="0x7f08008c" />
        <public type="string" name="quickpanel_shutdown_text" id="0x7f08008d" />
        <public type="string" name="airplane_mode" id="0x7f08008e" />
        <public type="string" name="shutdown_confirm" id="0x7f08008f" />
        <public type="string" name="screen_timeout_seconds" id="0x7f080090" />
        <public type="string" name="screen_timeout_minutes" id="0x7f080091" />
        <public type="string" name="screen_timeout_hours" id="0x7f080092" />
        <public type="string" name="hamster" id="0x7f080093" />
        <public type="string" name="yes" id="0x7f080094" />
        <public type="string" name="no" id="0x7f080095" />
        <public type="string" name="reboot" id="0x7f080096" />


  • Add after the last id decalred:
     

    Code:
        <public type="id" name="power_widget_button_image" id="0x7f0e0094" />
        <public type="id" name="power_widget_button_text" id="0x7f0e0095" />
        <public type="id" name="power_widget_button_indic" id="0x7f0e0096" />
        <public type="id" name="power_widget_button" id="0x7f0e0097" />
        <public type="array" name="config_cdmaDbmThresholds" id="0x7f0f0000" />
        <public type="array" name="config_cdmaEcioThresholds" id="0x7f0f0001" />
        <public type="array" name="config_evdoDbmThresholds" id="0x7f0f0002" />
        <public type="array" name="config_evdoSnrThresholds" id="0x7f0f0003" />
        <public type="array" name="shutdown_reboot_options" id="0x7f0f0004" />
        <public type="array" name="shutdown_reboot_actions" id="0x7f0f0005" />




    Smali modifications:

  • Edit "systemui\smali\com\android\systemui\statusbar \phone\PhoneStatusBar.smali" and make these changes :


    Add the only lines prefixed by ++;

    Code:
    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
    	
    return-object v4

  • Compile SystemUI.apk.
  • Copy Meta-Inf and AndroidManifest.xml from stock SystemUI.apk to your modded one.
  • That's it.

Waring:If the variables you are going to add to public.xml is already used,then you will have edit more smali.
Like if variable for "stat_data_on ": 0x7f0200f0 is already used,then you have to change it to 0x7f02xxxx,not used.
Then you have edit systemui\smali\com\lidroid\systemui\quickpanel\Mob ileDataButton.smali.
Find 0x7f0200f0 and change it to new 0x7f02xxxx you have addedin public.xml.Similarly for other variables also,if it is used change the respective .smali



Credit:I have used resources from this thread
************************************************** ************************************************** ************************************************** ****************

Removing Battery Percentage from Statusbar

  • Decompile SystemUI.apk

  • Open systemui/res/layout/status_bar.xml.

  • Find the line :
    Code:
    <TextView android:layout_gravity="left|center" android:id="@id/battery_text" android: paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" style="@style/StatusBarNotificationText" />
  • Change that line to:
    Code:
    <TextView android:layout_gravity="left|center" android:id="@id/battery_text" android: paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" android:visibility="gone" style="@style/StatusBarNotificationText" />
  • Save the file.
  • Compile SystemUI.apk
  • Copy Meta-Inf and AndroidManifest.xml from stock SystemUI.apk to your modded one.
  • That's it.

  • Then copy it to /system,set permissions to -rw-r-r.
  • Then copy it to /system/app.
  • Reboot the phone.

Credit:Thanks to pvyParts for the tip.


Download:SystemUI w/o battery percentage[U/Sola]

************************************************** ************************************************** *******************************************


Battery Mod

1% Battery Mod
Attached Thumbnails
Click image for larger version

Name:	16.jpg
Views:	7872
Size:	19.7 KB
ID:	1390846  
Back with Nexus 7 2013
The Following 40 Users Say Thank You to neectron For This Useful Post: [ Click to Expand ]
 
Spaun_Studio
Old
#2  
Spaun_Studio's Avatar
Member
Thanks Meter 576
Posts: 70
Join Date: Nov 2011
You are very very fast )
The Following User Says Thank You to Spaun_Studio For This Useful Post: [ Click to Expand ]
 
neectron
Old
(Last edited by neectron; 10th October 2012 at 06:58 PM.)
#3  
neectron's Avatar
Senior Member - OP
Thanks Meter 1,521
Posts: 1,540
Join Date: Dec 2011
Location: Really>?

 
DONATE TO ME
Quote:
Originally Posted by Spaun_Studio View Post
You are very very fast )
what?!
Back with Nexus 7 2013
 
wisnuhadi23
Old
#4  
wisnuhadi23's Avatar
Senior Member
Thanks Meter 52
Posts: 230
Join Date: Jul 2012

 
DONATE TO ME
Great tutorial.
It would have been better if you also include guide how to add quick toggle to systemui.apk I really want to learn how. I have been trying to find a nice guide but most of them are for sams... phones.

Sent from my ST25i using Tapatalk 2
 
linsbr
Old
#5  
Member
Thanks Meter 23
Posts: 98
Join Date: Apr 2012
Location: Belo Horizonte
Great tutorial...
Worked just fine for me.. Thanks a lot, that % was starting to get annoying
The Following User Says Thank You to linsbr For This Useful Post: [ Click to Expand ]
 
pvyParts
Old
#6  
pvyParts's Avatar
Recognized Developer
Thanks Meter 2,322
Posts: 1,857
Join Date: Oct 2010
pretty sure that adding

http://developer.android.com/referen...oid:visibility
Code:
android:visibility="GONE"
Code:
<TextView android:layout_gravity="left|center" android:id="@id/battery_text" android: paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" android:visibility="gone" style="@style/StatusBarNotificationText" />
into the xml with no smali mods will also work

it did on older firmwares just an FYI.

Pvy.
The Following User Says Thank You to pvyParts For This Useful Post: [ Click to Expand ]
 
neectron
Old
#7  
neectron's Avatar
Senior Member - OP
Thanks Meter 1,521
Posts: 1,540
Join Date: Dec 2011
Location: Really>?

 
DONATE TO ME
Quote:
Originally Posted by pvyParts View Post
pretty sure that adding

http://developer.android.com/referen...oid:visibility
Code:
android:visibility="GONE"
Code:
<TextView android:layout_gravity="left|center" android:id="@id/battery_text" android: paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" android:visibility="gone" style="@style/StatusBarNotificationText" />
into the xml with no smali mods will also work

it did on older firmwares just an FYI.

Pvy.
Great,it works.Changed the first post.
Back with Nexus 7 2013
The Following User Says Thank You to neectron For This Useful Post: [ Click to Expand ]
 
neectron
Old
#8  
neectron's Avatar
Senior Member - OP
Thanks Meter 1,521
Posts: 1,540
Join Date: Dec 2011
Location: Really>?

 
DONATE TO ME
Quote:
Originally Posted by wisnuhadi23 View Post
Great tutorial.
It would have been better if you also include guide how to add quick toggle to systemui.apk I really want to learn how. I have been trying to find a nice guide but most of them are for sams... phones.

Sent from my ST25i using Tapatalk 2
Added.
Back with Nexus 7 2013
 
wisnuhadi23
Old
#9  
wisnuhadi23's Avatar
Senior Member
Thanks Meter 52
Posts: 230
Join Date: Jul 2012

 
DONATE TO ME
Quote:
Originally Posted by neectron View Post
Added.
Thanks for the tutorial.
I tried to follow all the steps you mentioned but I always end up getting error like this : (attachment)
Do you know what's wrong with it ?
I get the error even when editing a single line in status_bar.xml
Attached Thumbnails
Click image for larger version

Name:	apk.jpg
Views:	1915
Size:	68.6 KB
ID:	1395463  
 
neectron
Old
#10  
neectron's Avatar
Senior Member - OP
Thanks Meter 1,521
Posts: 1,540
Join Date: Dec 2011
Location: Really>?

 
DONATE TO ME
Quote:
Originally Posted by wisnuhadi23 View Post
Thanks for the tutorial.
I tried to follow all the steps you mentioned but I always end up getting error like this : (attachment)
Do you know what's wrong with it ?
I get the error even when editing a single line in status_bar.xml
I think androidmanifest.xml didn't decompile properly,so it is not compiling.
Back with Nexus 7 2013

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes