FORUMS

[MOD]BatteryMod | Changeable Position

236 posts
Thanks Meter: 205
 
Post Reply Email Thread

Hi guys! It's been a long time. Now i present you my new mod called 'BatteryMod'. What is it? It will replace your current battery icon to my circle battery icon(oh yeah i made that icon by myself). And you can change the position left/right.
Quote:

What to do?
1. Modding SystemUI
2. Install my app.

Step 1. Modding SystemUI
Quote:

1. Download the attachment below.
2. Extract drawable folder into SystemUI folder.
3. Compile your SystemUI.
4. And Decompile your new compiled SystemUI.
5. Open public.xml, search for 'batt' & 'batt_charge'. Remember the public value!
6. Extract smali folder into SystemUI folder.
7. Open ucup.tech.batteryicon.BatteryIcon$1.smali, scroll down.
8. Replace '0x7f02009d' into your batt_charge's public value.
9. Replace '0x7f02009c' into your batt's public value.
10. Open your status_bar.xml(this will remove the clock.)
11. Replace the lines inside the first LinearLayout(id: icons) with this

Code:
<ucup.tech.batteryicon.StatusBarLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
	<ucup.tech.batteryicon.BatteryIcon android:id="@id/battIcon" android:gravity="center_vertical" android:layout_width="18.5px" android:layout_height="18.5px" />
	<com.android.systemui.statusbar.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:paddingLeft="6.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" />
	<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
</ucup.tech.batteryicon.StatusBarLayout>
12. Register the 'battIcon' in your ids.xml and public.xml(this time you don't need to remember the public values)
13. Open your com.android.systemui.statusbar.policy.StatusBarPol icy(this will remove the EDT's battery mod)
14. Replace the updateBattery method with mine.
Code:
.method private final updateBattery(Landroid/content/Intent;)V
    .locals 13
    .parameter "intent"

    .prologue
    const/4 v11, 0x3

    const/4 v10, 0x1

    const/4 v9, 0x0

    const-string v8, "level"

    const-string v12, "alarm"

    .line 633
    const-string v6, "icon-small"

    invoke-virtual {p1, v6, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v2

    .line 634
    .local v2, id:I
    const-string v6, "level"

    invoke-virtual {p1, v8, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v3

    .line 635
    .local v3, level:I
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mService:Landroid/app/StatusBarManager;

    const-string v7, "battery"

    invoke-virtual {v6, v7, v2, v3}, Landroid/app/StatusBarManager;->setIcon(Ljava/lang/String;II)V

    const v2, 0x0

    invoke-virtual {v6, v7, v2}, Landroid/app/StatusBarManager;->setIconVisibility(Ljava/lang/String;Z)V

    .line 637
    const-string v6, "plugged"

    invoke-virtual {p1, v6, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v6

    if-eqz v6, :cond_4

    move v5, v10

    .line 638
    .local v5, plugged:Z
    :goto_0
    const-string v6, "level"

    const/4 v6, -0x1

    invoke-virtual {p1, v8, v6}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v3

    .line 647
    iget-boolean v4, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBatteryPlugged:Z

    .line 649
    .local v4, oldPlugged:Z
    iput-boolean v5, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBatteryPlugged:Z

    .line 650
    iput v3, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBatteryLevel:I

    .line 652
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBatteryFirst:Z

    if-eqz v6, :cond_0

    .line 653
    iput-boolean v9, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBatteryFirst:Z

    .line 667
    :cond_0
    iput-object p1, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIntent:Landroid/content/Intent;

    .line 669
    const-string v6, "status"

    invoke-virtual {p1, v6, v10}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v1

    .line 670
    .local v1, batteryStatus:I
    const-string v6, "health"

    invoke-virtual {p1, v6, v10}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v0

    .line 671
    .local v0, batteryHealth:I
    const-string v6, "StatusBarPolicy"

    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "BAT. S:"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, " H:"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 673
    if-ne v1, v11, :cond_5

    .line 674
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    if-eqz v6, :cond_2

    .line 675
    iput-boolean v9, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    .line 676
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mDisChargeDialog:Landroid/app/AlertDialog;

    if-eqz v6, :cond_1

    .line 677
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mDisChargeDialog:Landroid/app/AlertDialog;

    invoke-virtual {v6}, Landroid/app/AlertDialog;->dismiss()V

    .line 680
    :cond_1
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBattIntent:Landroid/app/PendingIntent;

    if-eqz v6, :cond_2

    .line 681
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mContext:Landroid/content/Context;

    const-string v7, "alarm"

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

    move-result-object v6

    check-cast v6, Landroid/app/AlarmManager;

    iget-object v7, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBattIntent:Landroid/app/PendingIntent;

    invoke-virtual {v6, v7}, Landroid/app/AlarmManager;->cancel(Landroid/app/PendingIntent;)V

    .line 685
    :cond_2
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsFullCharged:Z

    if-eqz v6, :cond_3

    .line 686
    iput-boolean v9, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsFullCharged:Z

    .line 687
    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->removeFullChargeNotification()V

    .line 717
    :cond_3
    :goto_1
    return-void

    .end local v0           #batteryHealth:I
    .end local v1           #batteryStatus:I
    .end local v4           #oldPlugged:Z
    .end local v5           #plugged:Z
    :cond_4
    move v5, v9

    .line 637
    goto :goto_0

    .line 690
    .restart local v0       #batteryHealth:I
    .restart local v1       #batteryStatus:I
    .restart local v4       #oldPlugged:Z
    .restart local v5       #plugged:Z
    :cond_5
    const/4 v6, 0x4

    if-ne v1, v6, :cond_8

    .line 691
    if-eq v0, v11, :cond_6

    const/4 v6, 0x7

    if-ne v0, v6, :cond_3

    .line 693
    :cond_6
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    if-nez v6, :cond_7

    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mDisChargeDialog:Landroid/app/AlertDialog;

    if-nez v6, :cond_7

    .line 694
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    invoke-direct {p0, v6}, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->showDisChargePopup(Z)V

    .line 696
    :cond_7
    iput-boolean v10, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    goto :goto_1

    .line 699
    :cond_8
    const/4 v6, 0x5

    if-ne v1, v6, :cond_9

    .line 700
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsFullCharged:Z

    if-nez v6, :cond_3

    .line 701
    iput-boolean v10, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsFullCharged:Z

    .line 702
    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->addFullChargeNotification()V

    goto :goto_1

    .line 705
    :cond_9
    iget-boolean v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    if-eqz v6, :cond_3

    const/4 v6, 0x2

    if-ne v0, v6, :cond_3

    .line 706
    iput-boolean v9, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mIsDisCharged:Z

    .line 708
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mDisChargeDialog:Landroid/app/AlertDialog;

    if-eqz v6, :cond_a

    .line 709
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mDisChargeDialog:Landroid/app/AlertDialog;

    invoke-virtual {v6}, Landroid/app/AlertDialog;->dismiss()V

    .line 712
    :cond_a
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBattIntent:Landroid/app/PendingIntent;

    if-eqz v6, :cond_3

    .line 713
    iget-object v6, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mContext:Landroid/content/Context;

    const-string v7, "alarm"

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

    move-result-object v6

    check-cast v6, Landroid/app/AlarmManager;

    iget-object v7, p0, Lcom/android/systemui/statusbar/policy/StatusBarPolicy;->mBattIntent:Landroid/app/PendingIntent;

    invoke-virtual {v6, v7}, Landroid/app/AlarmManager;->cancel(Landroid/app/PendingIntent;)V

    goto :goto_1
.end method
15. Compile SystemUI and Push!

Step 2. Install my app.
Quote:

1. Well, you know how to install an app right?

Screenshots:
Quote:


FAQs:
Quote:

Question: My SystemUI FC!
Answer: You know how to logcat right?

Question: This thread is awful!
Answer: I know...

Credits:
- OGBatteryMod's Source for get identifier from string
- Google

Quote:

disclaimer:
im sorry for this long thread, im no good at english and making thread like this.

Attached Files
File Type: apk BatteryMod.apk - [Click for QR Code] (266.1 KB, 408 views)
File Type: zip SystemUI.zip - [Click for QR Code] (16.2 KB, 420 views)
The Following 12 Users Say Thank You to AuliaYF For This Useful Post: [ View ] Gift AuliaYF Ad-Free
4th June 2014, 08:16 AM |#2  
Member
Flag Cebu City
Thanks Meter: 9
 
More
woah!
Quote:
Originally Posted by auliayf


hi guys! It's been a long time. Now i present you my new mod called 'batterymod'. What is it? It will replace your current battery icon to my circle battery icon(oh yeah i made that icon by myself). And you can change the position left/right.


Step 1. Modding systemui


step 2. Install my app.


Screenshots:

faqs:


Credits:
- ogbatterymod's source for get identifier from string
- google

nc guide sir will try it :d
4th June 2014, 08:24 AM |#3  
Member
Thanks Meter: 26
 
More
if u make an update please include an option to hide the battery icon. thanks
4th June 2014, 08:31 AM |#4  
aakpSolder's Avatar
Member
Flag majalengka
Thanks Meter: 40
 
Donate to Me
More
Quote:
Originally Posted by AuliaYF


Hi guys! It's been a long time. Now i present you my new mod called 'BatteryMod'. What is it? It will replace your current battery icon to my circle battery icon(oh yeah i made that icon by myself). And you can change the position left/right.

woow .. greats job. aku suka ini pakde
+1
4th June 2014, 10:37 AM |#5  
AuliaYF's Avatar
OP Senior Member
Flag Bekasi, Indonesia
Thanks Meter: 205
 
More
Quote:
Originally Posted by BLOODSTORM

if u make an update please include an option to hide the battery icon. thanks

ofcourse! thanks for this idea, im thinking about text or more battery icons.

Quote:

Quote:
Originally Posted by dansoy92

nc guide sir will try it :d

Quote:
Originally Posted by aakpSolder

woow .. greats job. aku suka ini pakde
+1

thanks! if you have any suggestion just tell me
The Following User Says Thank You to AuliaYF For This Useful Post: [ View ] Gift AuliaYF Ad-Free
4th June 2014, 11:00 AM |#6  
GSculerlor's Avatar
Senior Member
Flag Malang
Thanks Meter: 89
 
More
Quote:
Originally Posted by AuliaYF

ofcourse! thanks for this idea, im thinking about text or more battery icons.



thanks! if you have any suggestion just tell me

Um, can you make changable battery icon tutor BTW i like it
4th June 2014, 11:26 AM |#7  
Member
Thanks Meter: 26
 
More
Thumbs up
Quote:
Originally Posted by AuliaYF

ofcourse! thanks for this idea, im thinking about text or more battery icons.



thanks! if you have any suggestion just tell me

that would be great. keep it up sir
4th June 2014, 12:04 PM |#8  
AuliaYF's Avatar
OP Senior Member
Flag Bekasi, Indonesia
Thanks Meter: 205
 
More
Thumbs up
Quote:
Originally Posted by GSculerlor

Um, can you make changable battery icon tutor BTW i like it

Later ya! But i will use this https://github.com/AuliaYF/uToggle/b...ls/uTheme.java for the engine.
The Following User Says Thank You to AuliaYF For This Useful Post: [ View ] Gift AuliaYF Ad-Free
4th June 2014, 12:06 PM |#9  
aakpSolder's Avatar
Member
Flag majalengka
Thanks Meter: 40
 
Donate to Me
More
Quote:
Originally Posted by AuliaYF

ofcourse! thanks for this idea, im thinking about text or more battery icons.



thanks! if you have any suggestion just tell me

oke
4th June 2014, 02:12 PM |#10  
LemperGosong's Avatar
Junior Member
Thanks Meter: 0
 
More
its cool . Thanks Pressed Paman
4th June 2014, 05:19 PM |#11  
Member
Flag Cebu City
Thanks Meter: 9
 
More
Quote:
Originally Posted by auliayf

ofcourse! Thanks for this idea, im thinking about text or more battery icons.



Thanks! If you have any suggestion just tell me

make battery mod on center sir :d
Post Reply Subscribe to Thread

Tags
batterymod, systemui

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

Advanced Search
Display Modes