[MOD][TUTORIAL][CM10]Transparent-colored statusbar drawer

reaper61616

Senior Member
Nov 23, 2010
663
747
0
Brodnica
Hi!

I figureout how to set transparent background color in CM10 :)



1. Decompile SystemUI.apk (I'm using apktool 1.4.9)

2. Go to: %apktool_folder%\SystemUI\smali\com\android\systemui\statusbar\phone

3. Open in text editor file: PhoneStatusBar$FastColorDrawable.smali

4. replace whole line:

Code:
iget v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$FastColorDrawable;->mColor:I
with

Code:
const v0, 0x6033b5e5
6033b5e5 => aarrggbb (a=alpha, r=red, g=green, b=blue) => this is semi-transparent ICS-blue color :)

After this method draw looks like:
Code:
.method public draw(Landroid/graphics/Canvas;)V
    .locals 2
    .parameter "canvas"

    .prologue
    .line 2632
    const v0, 0x6033b5e5

    sget-object v1, Landroid/graphics/PorterDuff$Mode;->SRC:Landroid/graphics/PorterDuff$Mode;

    invoke-virtual {p1, v0, v1}, Landroid/graphics/Canvas;->drawColor(ILandroid/graphics/PorterDuff$Mode;)V

    .line 2633
    return-void
.end method
4a. For 'HighEndGfx' devices (like HTC One X) need to make something more:

4aa. Open file: %apktool_folder%\SystemUI\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali

4ac. Replace tree lines of code ( do not copy numbers!!):
Code:
1. invoke-static {v0}, Landroid/app/ActivityManager;->isHighEndGfx(Landroid/view/Display;)Z
2. 
3. move-result v0
wiht one line of code ( do not copy numbers!!):

Code:
1. const v0, 0x0
4ad. Now fragment of method makeStatusBarView() looks like:

Code:
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mDisplay:Landroid/view/Display;
    
    const v0, 0x0

    if-nez v0, :cond_0
5. Open SystemUI.apk with WinRAR or 7zip.

6. Compile SystemUI folder and go to %apktool_folder%\SystemUI\build\apk

7. Copy only classes.dex to SystemUI.apk.

8. Move SystemUI.apk to /system/app in phone.

9. Reboot.

10. Set permissions to rw-r-r (644)

11. ... and be happy to have transparent notification drawer. :)


---------------------------------------------------------------------------------
If you want to change toggles background you must decompile framework-res and see in colors.xml (res/values/colors.xml) which colors are described in this file.

Go to SystemUI decompiled folder ->open res/drawable/stat_power_background.xml with text editor -> change
Code:
<item android:state_pressed="false" android:drawable="@android:drawable/input_method_fullscreen_background" />
with

Code:
<item android:state_pressed="false" android:drawable="@android:color/black" />
---------------------------------------------------------------------------------

This is 100% working in CM10, don't know what about others JB roms.
 
Last edited:

Romu313

Senior Member
Dec 3, 2011
87
10
0
hello
thank you for your tutorial, I managed to have transparency, but I have a problem with the toggle who do transparent and are not very visible in your screen while the tutorial you can see the toggle with black background??
If you have an idea?
Thank you in advance.
 

SmallZG

Member
Aug 20, 2012
6
1
0
just a question

First, thank you for giving us such a good method. But there I have a question:

"If you want to change toggles background you must decompile framework-res and see in colors.xml (res/values/colors.xml) which colors are described in this file.

Go to SystemUI decompiled folder ->open res/drawable/stat_power_background.xml with text editor..."

You say to decompile framework-res, but modify parameter in SystemUI. That is what to make me confused.

sorry for my poor english!

PS:I dont find code like <item android:state_pressed="false" android:drawable="@android:drawable/input_method_fullscreen_background" /> in my stat_power_background.xml, this is mine:

<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
</selector>
 
Last edited:

reaper61616

Senior Member
Nov 23, 2010
663
747
0
Brodnica
First, thank you for giving us such a good method. But there I have a question:

"If you want to change toggles background you must decompile framework-res and see in colors.xml (res/values/colors.xml) which colors are described in this file.

Go to SystemUI decompiled folder ->open res/drawable/stat_power_background.xml with text editor..."

You say to decompile framework-res, but modify parameter in SystemUI. That is what to make me confused.

sorry for my poor english!

PS:I dont find code like <item android:state_pressed="false" android:drawable="@android:drawable/input_method_fullscreen_background" /> in my stat_power_background.xml, this is mine:

<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
</selector>
In your stat_power_background.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
</selector>
Add:

Code:
<item android:state_pressed="false" android:drawable="@android:color/[COLOR=red]<color from framework-res e.g. black -> @android:color/black>[/COLOR]" />
after:

Code:
<item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
Your stat_power_background.xml now will be like:

Code:
<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
    <item android:state_pressed="false" android:drawable="@android:color/[COLOR=red]<color from framework-res e.g. black -> @android:color/black>[/COLOR]" />
</selector>
Where red colored font place color described in framework-res/res/values/colors.xml, e.g. black, white, transparent, etc.
 
Last edited:

SmallZG

Member
Aug 20, 2012
6
1
0
In your stat_power_background.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
</selector>
Add:

Code:
<item android:state_pressed="false" android:drawable="@android:color/[COLOR=red]<color from framework-res e.g. black -> @android:color/black>[/COLOR]" />
after:

Code:
<item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
Your stat_power_background.xml now will be like:

Code:
<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
    <item android:state_pressed="false" android:drawable="@android:color/[COLOR=red]<color from framework-res e.g. black -> @android:color/black>[/COLOR]" />
</selector>
Where red colored font place color described in framework-res/res/values/colors.xml, e.g. black, white, transparent, etc.
Thank you for the method. i will try it.
 
  • Like
Reactions: Mali096

vaibhav palande

Senior Member
Jan 27, 2012
281
109
0
Pune
My question its if you have a colour table in numeric values ​​like 0x6033b5e5.
Here is a nice site for RGB colours in hex. u have to calculate transparency separately..

RGB colours in HEX: http://www.perbang.dk/rgb/00FFEE/
Transparency calculation guide: http://www.telerik.com/support/kb/aspnet-ajax/chart/setting-hexadecimal-value-for-color-transparency-of-radchart-elements.aspx

---------- Post added at 12:49 AM ---------- Previous post was at 12:38 AM ----------

I have a problem here. I cant get the black background for toggles. I did everything specified in the OP.

Here is the screenshot:
https://www.dropbox.com/s/www3kjzh0mg1x7z/2012-09-01%2000.44.07.png
Any solution for this?[
 
Last edited:

vaibhav palande

Senior Member
Jan 27, 2012
281
109
0
Pune
I read it. Should i enter that red line too???

---------- Post added at 06:05 PM ---------- Previous post was at 05:30 PM ----------

That is not helping. My stat_power_background.xml code is:

Code:
<?xml version="1.0" encoding="utf-8"?>

<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
  xmlns:android="http://schemas.android.com/apk/res/android"
>
    <item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
	<item android:state_pressed="false" android:drawable="@android:color/black" />

</selector>
here is screenshot: https://www.dropbox.com/s/www3kjzh0mg1x7z/2012-09-01%2000.44.07.png
 

reaper61616

Senior Member
Nov 23, 2010
663
747
0
Brodnica
I read it. Should i enter that red line too???

---------- Post added at 06:05 PM ---------- Previous post was at 05:30 PM ----------

That is not helping. My stat_power_background.xml code is:

Code:
<?xml version="1.0" encoding="utf-8"?>

<selector android:exitFadeDuration="@android:integer/config_mediumAnimTime"
  xmlns:android="http://schemas.android.com/apk/res/android"
>
    <item android:state_pressed="true" android:drawable="@android:drawable/notification_item_background_color_pressed" />
	<item android:state_pressed="false" android:drawable="@android:color/black" />

</selector>
here is screenshot: https://www.dropbox.com/s/www3kjzh0mg1x7z/2012-09-01%2000.44.07.png

Which files are you replacing in original apk? You need to replace res folder resources.arcs and classes.dex
 
  • Like
Reactions: plegdroid