5,605,373 Members 42,548 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE][AOSP][4.1+][WIP] KitKat Gradient Status & Nav Bars

Tip us?
 
ATTACK
Old
(Last edited by ATTACK; 3rd December 2013 at 05:22 PM.) Reason: Two priest and a goldfish walk into a bar....
#1  
ATTACK's Avatar
Recognized Themer - OP
Thanks Meter 1199
Posts: 849
Join Date: Jan 2012

 
DONATE TO ME
Default [GUIDE][AOSP][4.1+][WIP] KitKat Gradient Status & Nav Bars

I've been asked several times to post a guide on how I created the gradient status and nav bar mod [LINK]. So here it is!... If you use this mod in you're work please give proper credit.


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DISCLAIMER:
YOU MUST KNOW HOW TO DE-COMPILE & COMPILE APK'S AND JAR FILES, WORK WITH SMALI CODE AND USE THE APPROPRIATE PROGRAMS.
I WILL NOT ANSWER QUESTION ON "HOW DO I...", "WHAT DO I..." OR "CAN YOU..."

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

>>REMOVING LOCKSCREEN TINT GUIDE: THANKS @Koloses

>>WHITE STATUS BAR CLOCK GUIDE

LETS BEGIN:

DELETE: RED CODE
ADD: BLUE CODE


Adding translucency to status & nav bars.
This will enabled the status and navigation bar to be translucent, independently of each other.
Meaning you could set the status bar to 20% and the navigation bar to 75%.

1. Decompile android.policy.jar \ com \ android \ internal \ policy \ impl \ PhoneWindowManager.smali

Look for this line:
Code:
.method public getSystemDecorRectLw(Landroid/graphics/Rect;)I
Code:
.method public getSystemDecorRectLw(Landroid/graphics/Rect;)I
    .locals 1
    .parameter "systemRect"

    .prologue
    .line 2755
    iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemLeft:I

    iput v0, p1, Landroid/graphics/Rect;->left:I

    .line 2756
    iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemTop:I

    iput v0, p1, Landroid/graphics/Rect;->top:I

    .line 2757
    iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemRight:I

    iput v0, p1, Landroid/graphics/Rect;->right:I

    .line 2758
    iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemBottom:I

    iput v0, p1, Landroid/graphics/Rect;->bottom:I

    .line 2759
    iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mStatusBar:Landroid/view/WindowManagerPolicy$WindowState;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mStatusBar:Landroid/view/WindowManagerPolicy$WindowState;

    invoke-interface {v0}, Landroid/view/WindowManagerPolicy$WindowState;->getSurfaceLayer()I

    move-result v0

    .line 2761
    :goto_0
    return v0

    .line 2760
    :cond_0
    iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBar:Landroid/view/WindowManagerPolicy$WindowState;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBar:Landroid/view/WindowManagerPolicy$WindowState;

    invoke-interface {v0}, Landroid/view/WindowManagerPolicy$WindowState;->getSurfaceLayer()I

    move-result v0

    goto :goto_0

    .line 2761
    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method
Replace with:

Code:

     const/4 v0, 0x0

     return v0
.end method
Finished...now compile.


2. Decompile SystemUI.apk \ com \ android \ systemui \ statusbar \ phone \ PhoneStatusBar.smali

Look for:
Code:
.method private getNavigationBarLayoutParams()Landroid/view/WindowManager$LayoutParams;
Code:
.method private getNavigationBarLayoutParams()Landroid/view/WindowManager$LayoutParams;
    .locals 6

    .prologue
    const/4 v1, -0x1

    .line 792
    new-instance v0, Landroid/view/WindowManager$LayoutParams;

    const/16 v3, 0x7e3

    const v4, 0x840068

    const/4 v5, -0x3

    move v2, v1

    move v5, v1

    invoke-direct/range {v0 .. v5}, Landroid/view/WindowManager$LayoutParams;-><init>(IIIII)V

    .line 803
    invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 804
    iget v1, v0, Landroid/view/WindowManager$LayoutParams;->flags:I

    const/high16 v2, 0x100

    or-int/2addr v1, v2

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->flags:I

    .line 807
    :cond_0
    const-string v1, "NavigationBar"

    invoke-virtual {v0, v1}, Landroid/view/WindowManager$LayoutParams;->setTitle(Ljava/lang/CharSequence;)V

    .line 808
    const/4 v1, 0x0

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->windowAnimations:I

    .line 809
    return-object v0
.end method
Editing Status bar & Navigation bar background

SystemUI.apk \ res \ layout \ navigation_bar.xml
SystemUI.apk \ res \ layout-sw600dp \ navigation_bar.xml
Code:
android:background="#88000000"
Code:
android:background="@drawable/nav_bar_background"
SystemUI.apk \ res \ values \ drawables.xml

Code:
<item type="drawable" name="status_bar_background">#88000000</item>
SystemUI.apk \ res \ layout \ status_bar.xml
Code:
android:background="#FF000000"
Code:
android:background="@drawable/status_bar_background"
Gradient Status & Nav Bar

startCOLOR = BOTTOM
endCOLOR = TOP

Create 2 new XML's:
Place in SystemUI \ res \ drawable

[status_bar_background.xml]
Code:
<?xml version="1.0" encoding="utf-8"?>
<shape
  xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#00000000" android:endColor="#99000000" android:angle="@integer/status_bar_bg_gradient_degrees" name="status_bar_background" />
</shape>
[nav_bar_background.xml]
Code:
<?xml version="1.0" encoding="utf-8"?>
<shape
  xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#cc000000" android:endColor="#00000000" android:angle="@integer/nav_bar_bg_gradient_degrees" name="nav_bar_background" />
</shape>
Add to integers (SystemUI.apk \ res \ values \ integers)
Code:
<integer name="nav_bar_bg_gradient_degrees">90</integer>
<integer name="status_bar_bg_gradient_degrees">90</integer>
At this point you may want to adjust the background gradient for the recents background. I went with 5% ~ 0%

SystemUI \ res \ drawable \ status_bar_recents_background
Code:
<?xml version="1.0" encoding="utf-8"?>
<shape
  xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#0d000000" android:endColor="#00000000" android:angle="@integer/status_bar_recents_bg_gradient_degrees" name="status_bar_recents_background" />
</shape>


Finished...now compile.


Hex Opacity Values
 
Code:
******** 100% — FF

******** 95% — F2

******** 90% — E6

******** 85% — D9

******** 80% — CC

******** 75% — BF

******** 70% — B3

******** 65% — A6

******** 60% — 99

******** 55% — 8C

******** 50% — 80

******** 45% — 73

******** 40% — 66

******** 35% — 59

******** 30% — 4D

******** 25% — 40

******** 20% — 33

******** 15% — 26

******** 10% — 1A

******** 5% — 0D

******** 0% — 00


KNOWN ISSUES:
Code:
*White backgrounds causes the status bar to become white (System Wide)
*Lockscreen tint needs to be adjusted to match gradient.
END RESULT
Attached Files
File Type: rar White Status Icons.rar - [Click for QR Code] (27.5 KB, 1489 views)
File Type: rar [HDPI] White Status Icons.rar - [Click for QR Code] (37.2 KB, 1387 views)
-$ locate Dev-Host
/public/ATTACK/myfiles/d-h.st
The Following 57 Users Say Thank You to ATTACK For This Useful Post: [ Click to Expand ]
 
ATTACK
Old
#2  
ATTACK's Avatar
Recognized Themer - OP
Thanks Meter 1199
Posts: 849
Join Date: Jan 2012

 
DONATE TO ME
Place Holder...
-$ locate Dev-Host
/public/ATTACK/myfiles/d-h.st
The Following 5 Users Say Thank You to ATTACK For This Useful Post: [ Click to Expand ]
 
EnricoD
Old
#3  
EnricoD's Avatar
Recognized Contributor
Thanks Meter 3199
Posts: 1,862
Join Date: May 2013
Location: Roma
Sorry.. last part of the guide

"At this point you may want to adjust the background gradient for the recents background. I went with 5% ~ 0%

SystemUI \ res \ drawable \ nav_bar_recents_background"

Shoud be nav_bar_background.xml not nav_bar_recents_background


The Stuff Song (click to show)
 

The Following 5 Users Say Thank You to EnricoD For This Useful Post: [ Click to Expand ]
 
slimdizzy
Old
#4  
Senior Member
Thanks Meter 233
Posts: 739
Join Date: Sep 2008
Can you show a screenshot with the launcher open? I want to see how your mod deals with changes in the status bar and nav bar. Previous mods failed at this. Either everything gets white out or system UI crashes constantly.

TIA
-------------------------
Main: Moto X 1058 (Rogers) Unlocked Bootloader
Other Devices: Galaxy Nexus - Dreams 4.4 KitKat, Nokia 620 WP8, Nexus 7(x2), HTC One XL, Nexus S i9020a, Acer A500, Galaxy Tab 7" (Orginal)
R.I.P Devices: HTC Desire (dropped down stairs), HTC 7 Mozart (eaten by aliens), HTC One X+ (sold)
 
ATTACK
Old
#5  
ATTACK's Avatar
Recognized Themer - OP
Thanks Meter 1199
Posts: 849
Join Date: Jan 2012

 
DONATE TO ME
Quote:
Originally Posted by enricocid View Post
Sorry.. last part of the guide

"At this point you may want to adjust the background gradient for the recents background. I went with 5% ~ 0%

SystemUI \ res \ drawable \ nav_bar_recents_background"

Shoud be nav_bar_background.xml not nav_bar_recents_background
FIXED... It's actually SystemUI \ res \ drawable \ status_bar_recents_background.
-$ locate Dev-Host
/public/ATTACK/myfiles/d-h.st
The Following 4 Users Say Thank You to ATTACK For This Useful Post: [ Click to Expand ]
 
ATTACK
Old
#6  
ATTACK's Avatar
Recognized Themer - OP
Thanks Meter 1199
Posts: 849
Join Date: Jan 2012

 
DONATE TO ME
Quote:
Originally Posted by slimdizzy View Post
Can you show a screenshot with the launcher open? I want to see how your mod deals with changes in the status bar and nav bar. Previous mods failed at this. Either everything gets white out or system UI crashes constantly.

TIA
Everything works....the only 2 issues are listed in the OP
-$ locate Dev-Host
/public/ATTACK/myfiles/d-h.st
The Following User Says Thank You to ATTACK For This Useful Post: [ Click to Expand ]
 
EnricoD
Old
#7  
EnricoD's Avatar
Recognized Contributor
Thanks Meter 3199
Posts: 1,862
Join Date: May 2013
Location: Roma
Quote:
Originally Posted by ATTACK View Post
Everything works....the only 2 issues are listed in the OP
Sorry Bro

I've already done Your guide and works very good... but

You say to delete this in drawables.xml

<item type="drawable" name="system_bar_background">#88000000</item>

But if You delete this You will get errors...

Since You add android:background="@drawable/status_bar_background"

You should delete the item status_bar_background from drawables.xml

It works for me...
great guide

Thank You




The Stuff Song (click to show)
 

The Following 3 Users Say Thank You to EnricoD For This Useful Post: [ Click to Expand ]
 
Maurice5813
Old
#8  
Guest
Thanks Meter 848
Posts: 0
Join Date: Jan 1970
this working on cm10.2, 4.3.1?
 
this-is-me
Old
#9  
Junior Member
Thanks Meter 3
Posts: 24
Join Date: Sep 2010
@ATTACK, If you are familiar with the Xposed framework, I wonder if it would make it easier on you to make this modification into an Xposed mod. Do you think it is worth trying?
 
cammykool
Old
#10  
cammykool's Avatar
Senior Member
Thanks Meter 301
Posts: 1,021
Join Date: Sep 2011
Location: Aurora Colorado
I don't know how to decompile so I would be cool with that.

Sent from my SCH-I535 using Tapatalk


Quote:
Originally Posted by cyanogen View Post
I mean this with the utmost respect: go eat a bowl of dicks.
Current Phone: Verizon Samsung Galaxy S3

Current Tablet: Hisense Sero 7 Pro

Current MP3 Player:  Apple iPod Touch 3rd Generation 32gb

Current BS Devices:
FreedomPop HTC Evo 4G (no perminant rom as of now)

LG Optimus S (Purple) (CM11 KitKat)

Previous Devices:
LG Optimus V (tvall CM9)
VZW Moto DROID (Kfazz CM10)


Tags
aosp, galaxy nexus, guide, kitkat, translucent status bar
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes