Or Continue to Thread: How to Port Lidroid Toggles to…
Find Your Device:
10th June 2014, 05:41 AM   |  #2  
Adi Aisiteru Reborn's Avatar
OP Senior Member
Flag Bandar Lampung
Thanks Meter: 4,581
 
1,666 posts
Join Date:Joined: Apr 2013
Arrow
STEP - 2

- Decompile the newly Recompiled APK again

Next go to
res/values/public.xml
open it with Notepad++
leave it, but keep it open

- smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali
add the red lines :
Code:
.field private mOldPlmn:Ljava/lang/String;

.field mPixelFormat:I

.field private mPlmnLabel:Landroid/widget/TextView;

.field mPositionTmp:[I

.field mPostCollapseCleanup:Ljava/lang/Runnable;

.field mPowerWidget:Lcom/adi/systemui/powerwidget/PowerWidget;

.field private mPreviousConfigFontScale:F

.field private mPrevioutConfigOrientation:I

.field mQS:Lcom/android/systemui/statusbar/phone/QuickSettings;

.field mQueueLock:Ljava/lang/Object;

.field private mRecentsClickListener:Landroid/view/View$OnClickListener;

Code:
    .end local v6           #signal:Landroid/view/View;
    .end local v7           #systemIcons:Landroid/view/View;
    :cond_0
    iget-object v8, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mLightsOutAnimation:Landroid/animation/Animator;

    invoke-virtual {v8}, Landroid/animation/Animator;->cancel()V

    .line 2213
    iget-object v8, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mLightsOnAnimation:Landroid/animation/Animator;

    invoke-virtual {v8}, Landroid/animation/Animator;->cancel()V

    .line 2215
    if-eqz p1, :cond_1

    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mLightsOutAnimation:Landroid/animation/Animator;

    .line 2216
    .local v0, a:Landroid/animation/Animator;
    :goto_0
    invoke-virtual {v0}, Landroid/animation/Animator;->start()V

    .line 2218
    invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setAreThereNotifications()V

    .line 2219
    return-void

    .line 2215
    .end local v0           #a:Landroid/animation/Animator;
    :cond_1
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mLightsOnAnimation:Landroid/animation/Animator;

    goto :goto_0
.end method

.method private setupPowerWidget()V
    .locals 2

    .prologue
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

    const v1, 0x7f08012a

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

    move-result-object v0

    check-cast v0, Lcom/adi/systemui/powerwidget/PowerWidget;

    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/adi/systemui/powerwidget/PowerWidget;

    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/adi/systemui/powerwidget/PowerWidget;

    invoke-virtual {v0}, Lcom/adi/systemui/powerwidget/PowerWidget;->setupWidget()V

    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/adi/systemui/powerwidget/PowerWidget;

    invoke-virtual {v0}, Lcom/adi/systemui/powerwidget/PowerWidget;->updateWidget()V

    return-void
.end method

.method private showAlwaysAskOrInternetCall(J)V
    .locals 3
    .parameter "simId"

    .prologue
    const/4 v2, 0x0

    .line 3231
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSimIndicatorIconShow:Z

    .line 3232
    const-wide/16 v0, -0x2

    cmp-long v0, p1, v0

    if-nez v0, :cond_0

    .line 3233
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSimIndicatorIcon:Landroid/widget/ImageView;

    const v1, 0x7f020137

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setBackgroundResource(I)V

    .line 3239
    :goto_0
    iget-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mAirplaneMode:Z

    if-nez v0, :cond_2

    .line 3240
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSimIndicatorIcon:Landroid/widget/ImageView;

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

    .line 3245
    :goto_1
    return-void

    .line 3234
    :cond_0
    const-wide/16 v0, -0x3

    cmp-long v0, p1, v0

    if-nez v0, :cond_1

    .line 3235
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSimIndicatorIcon:Landroid/widget/ImageView;

    const v1, 0x7f020136

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setBackgroundResource(I)V

    goto :goto_0

    .line 3237
    :cond_1
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSimIndicatorIcon:Landroid/widget/ImageView;

    const v1, 0x7f020135

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setBackgroundResource(I)V

    goto :goto_0
change this, 0x7f08012a according to the value you got in your own public.xml
Code:
<public type="id" name="adi_widget" id="0x7f??????" />

search this method
Code:
.method protected makeStatusBarView()Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;
scroll down in that method and add the red line
Code:
 move-object/from16 v0, p0

    iget-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v11, v1, v12}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 772
    invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->resetUserSetupObserver()V

    invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setupPowerWidget()V

    .line 774
    new-instance v20, Landroid/content/IntentFilter;

    invoke-direct/range {v20 .. v20}, Landroid/content/IntentFilter;-><init>()V

    .line 775
    .local v20, simInfoIntentFilter:Landroid/content/IntentFilter;
    const-string v1, "android.intent.action.SIM_SETTING_INFO_CHANGED"

OR
you can put the line here
Code:
   iget-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mMediaEjectBroadcastReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v11, v1, v15}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 800
    move-object/from16 v0, p0

   invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setupPowerWidget()V


    iget-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarView:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;

    return-object v1

    .line 440
    .end local v12           #filter:Landroid/content/IntentFilter;
    .end local v14           #indicator:Lcom/android/systemui/statusbar/toolbar/ToolBarIndicator;
    .end local v15           #mediaEjectFilter:Landroid/content/IntentFilter;
    .end local v19           #signalCluster:Lcom/android/systemui/statusbar/SignalClusterViewGemini;
    .end local v20           #simInfoIntentFilter:Landroid/content/IntentFilter;
    .end local v21           #tickerView:Lcom/android/systemui/statusbar/phone/TickerView;
    :cond_d
    const/4 v1, 0x0

    goto/16 :goto_0
NOTE !! if your device / os
Code:
.method protected makeStatusBarView()Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;
doesn't have this line
Code:
 move-object/from16 v0, p0
change this
Code:
 invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setupPowerWidget()V
to like this
Code:
invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setupPowerWidget()V
Last edited by Adi Aisiteru Reborn; 10th June 2014 at 06:20 AM.
The Following 9 Users Say Thank You to Adi Aisiteru Reborn For This Useful Post: [ View ]