[Sony Cross-Device Development Themes and Apps] MasDergiL:
Due to the large demand for how to replace the battery icon for Lollipop and Marshmallow , here I will give a little tutorial .

This tutorial applies to Rom CM12 / 12.1 / 13 /AOSP/5.0/5.1/6.0/6.0.1

Well , we start from the first:

[IMG="ScreenShot"]http://cyandgl.yw.lt/files/1033961/cm_status_bar.png[/IMG]

Materials and requirements:

-- PC

-- Apktool

-- Notepad++

-- WinRAR or any archive application

-- SystemUI.apk

-- Battery icon Download here

-- Battery smali Download here

-- Know How to Decompile and Recompile Apk. (don't ask here)

-- Know Baksmali smali (don't ask here)

-- Be patient

We start from step by step

STEP 1:

-- Decompile Your SystemUI.apk

-- Download Battery-icon.zip

-- Extract Battery-icon.zip

-- Copy Battery icon to your SystemUI (Place the appropriate folder)

-- Recompile Your SystemUI. (Done STEP 1)

STEP 2:

-- Decompile again your SystemUI

-- Download Smali-source.zip

-- Extract Smali-source.zip

-- Copy Smali-source to your smali , smali/com/cyandgl/battery/

-- go to res/values/public.xml

-- open public.xml and search 2 line:

<public type="drawable" name="stat_sys_battery" id="0xYOURCODE1" />
<public type="drawable" name="stat_sys_battery_charge" id="0xYOURCODE2" />

-- Now open smali/com/cyandgl/battery/Battery$1.smali

-- find .line 104 and .line 124 and change const v3, 0X.. with your public code.

iget-object v2, p0, Lcom/cyandgl/battery/Battery$1;->val$BatteryImage:Landroid/widget/ImageView;

const v3, 0xstat_sys_battery_charge!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11

invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageResource(I)V

.line 38
:goto_1
return-void

.line 29
.end local v0 # "ifCharging":Z
:cond_0
const/4 v0, 0x1

goto :goto_0

.line 36
.restart local v0 # "ifCharging":Z
:cond_1
iget-object v2, p0, Lcom/cyandgl/battery/Battery$1;->val$BatteryImage:Landroid/widget/ImageView;

const v3, 0xstat_sys_battery !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageResource(I)V

goto :goto_1
.end method

-- Save

-- Now go to res/layout/status_bar.xml and Open

--
<com.cyandgl.battery.Battery android:gravity="center" android:id="@id/battery" android:paddingLeft="1.5dip" android:layout_width="wrap_content" android:layout_height="fill_parent" />
--

-- Paste my xml after

<com.android.systemui.BatteryLevelTextView android:textSize="@dimen/battery_level_text_size" android:textColor="@color/status_bar_battery_level_text_color" android:layout_gravity="center_vertical" android:id="@id/battery_level_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/header_battery_margin_keyguard" />

EXAMPLE:

</com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
<com.android.keyguard.AlphaOptimizedLinearLayout android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
<include layout="@layout/system_icons" />
<com.android.systemui.BatteryLevelTextView android:textSize=[COLOR="Red"]"@dimen/battery_level_text_size"[/COLOR] android:textColor=[COLOR="Green"]"@color/status_bar_battery_level_text_color"[/COLOR] android:layout_gravity="center_vertical" android:id="@id/battery_level_text" android:layout_width=[COLOR="Red"]"wrap_content"[/COLOR] android:layout_height=[COLOR="Red"]"wrap_content"[/COLOR] android:layout_marginStart=[COLOR="Red"]"@dimen/header_battery_margin_keyguard"[/COLOR] />
<com.cyandgl.battery.Battery android:gravity="center" android:id="@id/battery" android:paddingLeft="1.5dip" android:layout_width="wrap_content" android:layout_height="fill_parent" />
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="start|center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:paddingStart="7.0dip" />
</com.android.keyguard.AlphaOptimizedLinearLayout>
</LinearLayout>

-- Change Red color to "0.0dip and Green color to "#00000000" and save

-- Than edit status_bar_expanded_header.xml and keyguard_status_bar.xml

-- Now go to res/layout/system_icons.xml and open

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:id="@id/system_icons" android:layout_width="wrap_content" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.keyguard.AlphaOptimizedLinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
<include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="2.5dip" layout="@layout/signal_cluster_view" />
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width=[COLOR="Red"]"9.5dip"[/COLOR] android:layout_height=[COLOR="Red"]"14.5dip"[/COLOR] android:layout_marginBottom=[COLOR="Red"]"@dimen/battery_margin_bottom"[/COLOR] android:layout_marginStart=[COLOR="Red"]"@dimen/signal_cluster_battery_padding"[/COLOR] />
</LinearLayout>

-- Change Red color to "0.0dip"

-- Save

-- Decompile your SystemUI.apk

-- Sign

-------====== GOOD LUCK ======------