FORUMS

[GUIDE] [TUT] Header Images Auto machine

100 posts
Thanks Meter: 164
 
Post Reply Email Thread
GUIDE Header Images Auto machine
Work and Tested - CM 12.1 & LP Based

1. Decompile settings.apk
At the file:
Settings\res\xml\Display_Settings.xmll
Add this line

Quote:

<com.android.settings.cyanogenmod.SystemSettingSwi tchPreference android:title="@string/status_bar_custom_header_title" android:key="status_bar_custom_header" android:summary="@string/status_bar_custom_header_summary" android:defaultValue="false" />

ADD THIS LINES.
Settings\res\values\strings.xml

Quote:

<string name="status_bar_custom_header_title">Custom auto machine header image</string>
<string name="status_bar_custom_header_summary">Enable notification panel header image</string>

*Compile Settings.apk DONE*

2. Decompile SystemUI.apk
ystemUI\res\layout\status_bar_expanded_header.xml
Looking for:

xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto">
following inserted ::
Quote:

<ImageView android:layout_gravity="center" android:id="@id/background_image" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="centerCrop" android:adjustViewBounds="true" />

SystemUI\res\values\ids.xml
Add this line

Quote:

<item type="id" name="background_image">false</item>

*compile and decompile again to assign the ID to a file*
GO TO SystemUI\smali\com\android\systemui\statusbar\phon e\PhoneStatusbar.smali

PHP Code:
Looking for:
# instance fields
following inserted ::
.
field private mStatusBarHeaderMachine:Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;
----------------------------------------------------------------
Looking for:
.
method protected makeStatusBarView()V
After This Line
:
    
invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->startGlyphRasterizeHack()V
following inserted
:
    .
line 1309
    
new-instance v3Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;

    
move-object/from16 v0p0

    iget
-object v4v0Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

    
invoke-direct {v3v4}, Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;-><init>(Landroid/content/Context;)V

    move
-object/from16 v0p0

    iput
-object v3v0Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarHeaderMachine:Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;

    .
line 1310
    move
-object/from16 v0p0

    iget
-object v3v0Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarHeaderMachine:Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;

    
move-object/from16 v0p0

    iget
-object v4v0Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHeader:Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;

    
invoke-virtual {v3v4}, Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;->addObserver(Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine$IStatusBarHeaderMachineObserver;)V

    
.line 1311
    move
-object/from16 v0p0

    iget
-object v3v0Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarHeaderMachine:Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;

    
invoke-virtual {v3}, Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine;->updateEnablement()V    
----------------------------------------------------------------
SystemUI\smali\com\android\systemui\statusbar\phone\StatusBarHeaderView.smali

Looking 
for:
.implements 
Lcom/android/systemui/statusbar/policy/WeatherController$Callback;
following inserted :
.implements 
Lcom/android/systemui/ahmednhk/StatusBarHeaderMachine$IStatusBarHeaderMachineObserver;
----------------------------------------------------------------
Looking for:
# instance fields
following inserted :
.
field private mBackgroundImage:Landroid/widget/ImageView;
----------------------------------------------------------------
Looking for:
.
field private mCollapsedHeight:I
following inserted 
:
.
field private mCurrentBackground:Landroid/graphics/drawable/Drawable;
----------------------------------------------------------------
Looking for:
.
field private mExpandedHeight:I
following inserted 
:
.
field private mLastHeight:F
----------------------------------------------------------------
Looking for:
.
method static synthetic access$900(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;)Landroid/widget/Switch;
At the end of it -> inserted :
.
method static synthetic access$100001(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;Landroid/graphics/drawable/Drawable;Z)V
    
.locals 0
    
.param p0"x0"    # Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;
    
.param p1"x1"    # Landroid/graphics/drawable/Drawable;
    
.param p2"x2"    # Z

    
.prologue
    
.line 71
    invoke
-direct {p0p1p2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->doUpdateStatusBarCustomHeader(Landroid/graphics/drawable/Drawable;Z)V

    
return-void
.end method

.method static synthetic access$100002(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;)Landroid/widget/ImageView;
    .
locals 1
    
.param p0"x0"    # Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;

    
.prologue
    
.line 71
    iget
-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    return-
object v0
.end method

.method static synthetic access$100003(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;
    .
locals 0
    
.param p0"x0"    # Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;
    
.param p1"x1"    # Landroid/graphics/drawable/Drawable;

    
.prologue
    
.line 71
    iput
-object p1p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

    return-
object p1
.end method

.method private doUpdateStatusBarCustomHeader(Landroid/graphics/drawable/Drawable;Z)V
    
.locals 2
    
.param p1"next"    # Landroid/graphics/drawable/Drawable;
    
.param p2"force"    # Z

    
.prologue
    
.line 1033
    
if-eqz p1, :cond_1

    
.line 1034
    iget
-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

    if-
eq p1v0, :cond_0

    
.line 1035
    
const-string v0"StatusBarHeaderView"

    
const-string v1"Updating status bar header background"

    
invoke-static {v0v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    
.line 1036
    iget
-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    const/
4 v10x0

    invoke
-virtual {v0v1}, Landroid/widget/ImageView;->setVisibility(I)V

    
.line 1037
    invoke
-direct {p0p1p2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;Z)V

    
.line 1038
    iput
-object p1p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

    .
line 1044
    
:cond_0
    
:goto_0
    
return-void

    
.line 1041
    
:cond_1
    
const/4 v00x0

    iput
-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

    .
line 1042
    iget
-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    const/
16 v10x8

    invoke
-virtual {v0v1}, Landroid/widget/ImageView;->setVisibility(I)V

    
goto :goto_0
.end method

.method private setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;Z)V
    
.locals 5
    
.param p1"dw"    # Landroid/graphics/drawable/Drawable;
    
.param p2"force"    # Z

    
.prologue
    
const/4 v40x1

    
.line 1047
    iget
-object v2p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    
invoke-virtual {v2}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    
move-result-object v2

    
if-eqz v2, :cond_0

    
if-nez p2, :cond_0

    
.line 1048
    
const/4 v20x2

    
new-array v0v2, [Landroid/graphics/drawable/Drawable;

    .
line 1049
    
.local v0"arrayDrawable":[Landroid/graphics/drawable/Drawable;
    const/
4 v20x0

    iget
-object v3p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    
invoke-virtual {v3}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    
move-result-object v3

    aput
-object v3v0v2

    
.line 1050
    aput
-object p1v0v4

    
.line 1052
    
new-instance v1Landroid/graphics/drawable/TransitionDrawable;

    
invoke-direct {v1v0}, Landroid/graphics/drawable/TransitionDrawable;-><init>([Landroid/graphics/drawable/Drawable;)V

    
.line 1053
    
.local v1"transitionDrawable":Landroid/graphics/drawable/TransitionDrawable;
    
invoke-virtual {v1v4}, Landroid/graphics/drawable/TransitionDrawable;->setCrossFadeEnabled(Z)V

    
.line 1054
    iget
-object v2p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    
invoke-virtual {v2v1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    
.line 1055
    
const/16 v20x3e8

    invoke
-virtual {v1v2}, Landroid/graphics/drawable/TransitionDrawable;->startTransition(I)V

    
.line 1059
    
.end local v0    # "arrayDrawable":[Landroid/graphics/drawable/Drawable;
    
.end local v1    # "transitionDrawable":Landroid/graphics/drawable/TransitionDrawable;
    
:goto_0
    
return-void

    
.line 1057
    
:cond_0
    iget
-object v2p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

    
invoke-virtual {v2p1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    
goto :goto_0
.end method
----------------------------------------------------------------
Looking for:
# virtual method
following inserted :
.
method public disableHeader()V
    
.locals 1

    
.prologue
    
.line 1072
    
new-instance v0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$98;

    
invoke-direct {v0p0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$98;-><init>(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;)V

    invoke
-virtual {p0v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->post(Ljava/lang/Runnable;)Z

    
.line 1078
    
return-void
.end method

.method public updateHeader(Landroid/graphics/drawable/Drawable;Z)V
    
.locals 1
    
.param p1"headerImage"    # Landroid/graphics/drawable/Drawable;
    
.param p2"force"    # Z

    
.prologue
    
.line 1063
    
new-instance v0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$97;

    
invoke-direct {v0p0p1p2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$97;-><init>(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;Landroid/graphics/drawable/Drawable;Z)V

    invoke
-virtual {p0v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->post(Ljava/lang/Runnable;)Z

    
.line 1068
    
return-void
.end method
----------------------------------------------------------------
Looking for:
.
method protected onFinishInflate()V
After This Line
:
iput-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mDateExpanded:Landroid/widget/TextView;
following inserted ::
    .
line 31
    
const v00x7f0f017a

    invoke
-virtual {p0v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->findViewById(I)Landroid/view/View;

    
move-result-object v0

    check
-cast v0Landroid/widget/ImageView;

    
iput-object v0p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;
        
    .
line 168

Will Find At 
:    
<
0x7f0f017a - <public type="id" name="background_image">
----------------------------------------------------------------
Looking for:
.
method public setExpansion(F)V
Changing it completely with
:
.
method public setExpansion(F)V
    
.locals 5
    
.param p1"t"    # F

    
.prologue
    
.line 584
    iget
-boolean v2p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpanded:Z

    
if-nez v2, :cond_0

    
.line 585
    
const/4 p10x0

    
.line 587
    
:cond_0
    iput p1
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentT:F

    
.line 588
    iget v2
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

    int
-to-float v2v2

    iget v3
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpandedHeight:I

    iget v4
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

    sub
-int/2addr v3v4

    int
-to-float v3v3

    mul
-float/2addr v3p1

    add
-float v0v2v3

    
.line 589
    
.local v0"height":F
    iget v2
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mLastHeight:F

    cmpl
-float v2v0v2

    
if-eqz v2, :cond_3

    
.line 590
    iget v2
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

    int
-to-float v2v2

    cmpg
-float v2v0v2

    
if-gez v2, :cond_1

    
.line 591
    iget v2
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

    int
-to-float v0v2

    
.line 593
    
:cond_1
    iget v2
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpandedHeight:I

    int
-to-float v2v2

    cmpl
-float v2v0v2

    
if-lez v2, :cond_2

    
.line 594
    iget v2
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpandedHeight:I

    int
-to-float v0v2

    
.line 596
    
:cond_2
    move v1
v0

    
.line 597
    
.local v1"heightFinal":F
    invoke
-direct {p0v1}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setClipping(F)V

    
.line 599
    
new-instance v2Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$96;

    
invoke-direct {v2p0v1}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$96;-><init>(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;F)V

    invoke
-virtual {p0v2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->post(Ljava/lang/Runnable;)Z

    
.line 607
    invoke
-direct {p0p1}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->updateLayoutValues(F)V

    
.line 608
    iput v1
p0Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mLastHeight:F

    
.line 610
    
.end local v1    # "heightFinal":F
    
:cond_3
    
return-void
.end method
----------------------------------------------------------------
*
assign the ID's to file*
SystemUI\smali\com\android\systemui\ahmednhk\StatusBarHeaderProvider.smali
    <public type="drawable" name="notifhead_christmas"
    LINE 220
    
    <public type="drawable" name="notifhead_newyearseve"
    LINE 241
    
    <public type="drawable" name="notifhead_night"
    LINE 265
    
    <public type="drawable" name="notifhead_sunrise"
    LINE 280
    
    <public type="drawable" name="notifhead_morning"
    LINE 295
    
    <public type="drawable" name="notifhead_noon"
    LINE 310
    
    <public type="drawable" name="notifhead_afternoon"
    LINE 325
    
    <public type="drawable" name="notifhead_sunset"
    LINE 342> 
*Compile SystemUI.apk DONE*

Files and Compare Press Me
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	346
Size:	239.3 KB
ID:	4018515   Click image for larger version

Name:	2.png
Views:	326
Size:	216.4 KB
ID:	4018516   Click image for larger version

Name:	3.png
Views:	322
Size:	134.7 KB
ID:	4018517   Click image for larger version

Name:	4.jpg
Views:	314
Size:	63.5 KB
ID:	4018518  
The Following User Says Thank You to ahmed.nasser.hk For This Useful Post: [ View ] Gift ahmed.nasser.hk Ad-Free
22nd April 2017, 11:35 AM |#2  
ryan_joshua's Avatar
Senior Member
Thanks Meter: 61
 
More
I have tried this but my systemUI got fc. I decompile and recompile it without errors. Any help?
Post Reply Subscribe to Thread

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

Advanced Search
Display Modes