Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,805,688 Members 41,338 Now Online
XDA Developers Android and Mobile Development Forum

[Guide] Add OGBatteryMod to your ROM

Tip us?
 
talkingmonkeys
Old
#1  
talkingmonkeys's Avatar
Recognized Contributor - OP
Thanks Meter 1,949
Posts: 1,506
Join Date: May 2013

 
DONATE TO ME
Default [Guide] Add OGBatteryMod to your ROM

I found this guide here and this is what I did differently from it to make this work for us. You can use the linked file to click an app to change the icon or you can add it into settings in your rom. For those that don't know what this does this probably isn't the thread for you. Just wait until you see it popping up in the roms you use. This should work universally for ND8 builds.

http://forum.xda-developers.com/show....php?t=2730108

Now instead of following all of his steps and not finding what you're searching for I will simplify this some to make it quicker. You will want to search for this and replace it throughout the smali file in your decompiled systemui.apk (\SystemUI\smali\com\android\systemui\statusbar\ph one\PhoneStatusBar.smali)

Find all instances of
Code:
Lcom/android/systemui/statusbar/policy/BatteryController;
and replace with

Code:
Lcom/ghareeb/BatteryMod/BatteryController;
Then open (\SystemUI\res\layout\status_bar.xml) and find [This may already be changed if you used tdunham's 1% battery mod]
Code:
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="12.0dip" android:layout_height="18.0dip" android:layout_marginBottom="0.33000004dip" android:layout_marginStart="5.0dip" />
and replace it with
Code:
<ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="0.0dip" android:layout_marginStart="2.0dip" />
Now most importantly you need to add these smali files to your systemui so they're in (systemui/smali/com/ghareeb/BatteryMod)

http://forum.xda-developers.com/atta...1&d=1398368939

Then add the OGBatterymod.apk of your choice to system/app. I didn't provide one in this guide sorry but maybe I will upload one eventually. You can easily look for one to add, all the old ones should work.


To add it to secsettings under display

Decompile secsettings.apk and open (\SecSettings\res\xml\display_settings.xml)

Find
Code:
<PreferenceScreen android:title="@string/notification_panel_title" android:key="notification_panel_edit" android:fragment="com.android.settings.NotificationPanelMenu" />
Add this under that line
Code:
<PreferenceScreen android:title="@string/battery_mod" android:summary="@string/battery_mod_desc">
        <intent android:targetPackage="com.ghareeb.battery" android:action="android.intent.action.MAIN" android:targetClass="com.ghareeb.battery.Settings" />
    </PreferenceScreen>
Now open (\SecSettings\res\values\string.xml) and add this
Code:
<string name="battery_mod">OGBattery Mod</string>
<string name="battery_mod_desc">Change battery icon and charging animation.</string>
For those who don't want to add this to settings for some reason you can find one with the icon so you can just open the app here: http://forum.xda-developers.com/show....php?t=2758088

Thanks to @OsamaGhareeb and @meawww also @axel06 for his that I linked with the icon instead of having to have it in settings if anyone would like to do it this way.
The Following 8 Users Say Thank You to talkingmonkeys For This Useful Post: [ Click to Expand ]
 
Chad The Pathfinder
Old
#2  
Chad The Pathfinder's Avatar
Senior Member
Thanks Meter 2,259
Posts: 2,224
Join Date: Mar 2012
Location: Central Kentucky
Dude you are awesome! I can't wait to get on this. Have to wait till the weekend though.
I'm a padawan with no master.
The Following User Says Thank You to Chad The Pathfinder For This Useful Post: [ Click to Expand ]
 
Chad The Pathfinder
Old
#3  
Chad The Pathfinder's Avatar
Senior Member
Thanks Meter 2,259
Posts: 2,224
Join Date: Mar 2012
Location: Central Kentucky
BTW this works great! Thanks again.
I'm a padawan with no master.
The Following 3 Users Say Thank You to Chad The Pathfinder For This Useful Post: [ Click to Expand ]
 
nyfl2004
Old
(Last edited by nyfl2004; 5th August 2014 at 01:06 AM.)
#4  
nyfl2004's Avatar
Senior Member
Thanks Meter 600
Posts: 547
Join Date: Aug 2012
Location: Deerfield Beach, Fl
Quote:
Originally Posted by talkingmonkeys View Post
I found this guide here and this is what I did differently from it to make this work for us. You can use the linked file to click an app to change the icon or you can add it into settings in your rom. For those that don't know what this does this probably isn't the thread for you. Just wait until you see it popping up in the roms you use. This should work universally for ND8 builds.

http://forum.xda-developers.com/show....php?t=2730108

Now instead of following all of his steps and not finding what you're searching for I will simplify this some to make it quicker. You will want to search for this and replace it throughout the smali file in your decompiled systemui.apk (\SystemUI\smali\com\android\systemui\statusbar\ph one\PhoneStatusBar.smali)

Find all instances of
Code:
Lcom/android/systemui/statusbar/policy/BatteryController;
and replace with

Code:
Lcom/ghareeb/BatteryMod/BatteryController;
Then open (\SystemUI\res\layout\status_bar.xml) and find [This may already be changed if you used tdunham's 1% battery mod]
Code:
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="12.0dip" android:layout_height="18.0dip" android:layout_marginBottom="0.33000004dip" android:layout_marginStart="5.0dip" />
and replace it with
Code:
<ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="0.0dip" android:layout_marginStart="2.0dip" />
Now most importantly you need to add these smali files to your systemui so they're in (systemui/smali/com/ghareeb/BatteryMod)

http://forum.xda-developers.com/atta...1&d=1398368939

Then add the OGBatterymod.apk of your choice to system/app. I didn't provide one in this guide sorry but maybe I will upload one eventually. You can easily look for one to add, all the old ones should work.


To add it to secsettings under display

Decompile secsettings.apk and open (\SecSettings\res\xml\display_settings.xml)

Find
Code:
<PreferenceScreen android:title="@string/notification_panel_title" android:key="notification_panel_edit" android:fragment="com.android.settings.NotificationPanelMenu" />
Add this under that line
Code:
<PreferenceScreen android:title="@string/battery_mod" android:summary="@string/battery_mod_desc">
        <intent android:targetPackage="com.ghareeb.battery" android:action="android.intent.action.MAIN" android:targetClass="com.ghareeb.battery.Settings" />
    </PreferenceScreen>
Now open (\SecSettings\res\values\string.xml) and add this
Code:
<string name="battery_mod">OGBattery Mod</string>
<string name="battery_mod_desc">Change battery icon and charging animation.</string>
For those who don't want to add this to settings for some reason you can find one with the icon so you can just open the app here: http://forum.xda-developers.com/show....php?t=2758088

Thanks to @OsamaGhareeb and @meawww also @axel06 for his that I linked with the icon instead of having to have it in settings if anyone would like to do it this way.
Great guide man. I've been trying to get this mod going using some of the other guides out there, but no luck. Glad I found this. A couple of questions; I don't see a \ph one\ folder in my statusbar smali. Is that typo? Should it be: \SystemUI\smali\com\android\systemui\statusbar\Pho neStatusBar.smali. If so, I followed all steps but I get the following error when trying to recompile. Is it a syntax error?

Edit: Sorry about the path question. Dummy me. As for the recompile error, I think it has something to do with one of the smali files in the Ghareeb zip?
Attached Files
File Type: txt Smali error.txt - [Click for QR Code] (1.6 KB, 9 views)
Sprint Galaxy SIII
Likewise S5 2.5b by @lemonboi5
S5Theme by @nyfl2004
 
talkingmonkeys
Old
#5  
talkingmonkeys's Avatar
Recognized Contributor - OP
Thanks Meter 1,949
Posts: 1,506
Join Date: May 2013

 
DONATE TO ME
Quote:
Originally Posted by nyfl2004 View Post
Great guide man. I've been trying to get this mod going using some of the other guides out there, but no luck. Glad I found this. A couple of questions; I don't see a \ph one\ folder in my statusbar smali. Is that typo? Should it be: \SystemUI\smali\com\android\systemui\statusbar\Pho neStatusBar.smali. If so, I followed all steps but I get the following error when trying to recompile. Is it a syntax error?

Edit: Sorry about the path question. Dummy me. As for the recompile error, I think it has something to do with one of the smali files in the Ghareeb zip?
Try using a different apktool. I think I used 2 beta. The different apk tools use different parameters and I can't remember exactly what you need to change it to for it to recompile just this minute
The Following 2 Users Say Thank You to talkingmonkeys For This Useful Post: [ Click to Expand ]
 
nyfl2004
Old
#6  
nyfl2004's Avatar
Senior Member
Thanks Meter 600
Posts: 547
Join Date: Aug 2012
Location: Deerfield Beach, Fl
Quote:
Originally Posted by talkingmonkeys View Post
Try using a different apktool. I think I used 2 beta. The different apk tools use different parameters and I can't remember exactly what you need to change it to for it to recompile just this minute
Thanks man. I can recompile your edits with no problem. I can't recompile once I add the Ghareeb smali files. I'll keep trying. Thanks again..
Sprint Galaxy SIII
Likewise S5 2.5b by @lemonboi5
S5Theme by @nyfl2004
 
talkingmonkeys
Old
#7  
talkingmonkeys's Avatar
Recognized Contributor - OP
Thanks Meter 1,949
Posts: 1,506
Join Date: May 2013

 
DONATE TO ME
Quote:
Originally Posted by nyfl2004 View Post
Thanks man. I can recompile your edits with no problem. I can't recompile once I add the Ghareeb smali files. I'll keep trying. Thanks again..
Try tickle my android. Chad suggested it to me and it worked. You can send me the file too and I'll have a look. Might not have a chance until Thursday to look at it but I think I know whats wrong its just explaining it drunk isn't too easy
The Following 4 Users Say Thank You to talkingmonkeys For This Useful Post: [ Click to Expand ]
 
nyfl2004
Old
#8  
nyfl2004's Avatar
Senior Member
Thanks Meter 600
Posts: 547
Join Date: Aug 2012
Location: Deerfield Beach, Fl
Quote:
Originally Posted by talkingmonkeys View Post
Try tickle my android. Chad suggested it to me and it worked. You can send me the file too and I'll have a look. Might not have a chance until Thursday to look at it but I think I know whats wrong its just explaining it drunk isn't too easy
Thanks man. I'll give Trickle my Android a shot later after work. If I can't manage, I'll send you the file. I really appreciate your help!
Sprint Galaxy SIII
Likewise S5 2.5b by @lemonboi5
S5Theme by @nyfl2004

The Following User Says Thank You to nyfl2004 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes