FORUMS
Remove All Ads from XDA

[GUIDE]4.2.2 Statusbar for Samsung 4.1.2 ROM with Live Tiles

725 posts
Thanks Meter: 3,410
 
Post Reply Email Thread
4.2.2 Style Stausbar for Samsung 4.1.2 ROM


(This tutorial is originally made for SGSA but it should work with all samsung 4.1.2 ROMs)

Before we begin let me give credit to original author of this mod @SpaceCaker i'm just gonna tell you how to port it to Samsung JB 4.1.2 ROM.
(SpaceCaker's original Thread here)

Note: Throughout the tutorial we'll travel sequentially, i mean when i ask you to search for something and you find more than two matches, then choose the immediate one which comes after previous modification.
So let's begin

- Decompile SystemUI.apk
- Navigate to res/layout
Quote:

- tw_status_bar.xml
search for

Code:
<com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/status_bar_background" android:focusable="true" android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
Add this below it
Code:
<com.android.systemui.statusbar.StatusBarServiceLRPull android:layout_width="fill_parent" android:layout_height="wrap_content">
- Now search for
Code:
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
Add this above it
Code:
</com.android.systemui.statusbar.StatusBarServiceLRPull>
- Save file

Quote:

- tw_status_bar_expanded.xml
replace

Code:
<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/tw_close_handle_underlap">
with
Code:
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/close_handle_underlap">
below it there will be <include /> clause add this line below it
Code:
</LinearLayout>
below it there'll be <TextView /> add these lines below it
Code:
<com.spacecaker.SpaceLayOut android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
            <include layout="@layout/quickpanel_quick_settings_space" />
        </LinearLayout>
        <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/tw_close_handle_underlap">
- Now search for
Code:
<com.android.systemui.statusbar.phone.CloseDragHandle
and add this code above it
Code:
</com.spacecaker.SpaceLayOut>
- Save file

Quote:

- tw_status_bar_expanded_header.xml
search for

Code:
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="@dimen/status_bar_expanded_setting_width" android:layout_height="39.0dip">
replace it with below code
Code:
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="invisible" android:layout_width="0.100000024dip" android:layout_height="0.100000024dip">
        <ImageView android:id="@id/settings_button_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_quickpanel_icon_settings" android:scaleType="center" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/accessibility_settings_button" />
    </RelativeLayout>
    <RelativeLayout android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="@dimen/status_bar_expanded_setting_width" android:layout_height="39.0dip">
- Search below for
Code:
android:contentDescription="@string/accessibility_settings_button"
and add this above it
Code:
android:onClick="mOpenSettings"
- Below after </RelativeLayout> add this code
Code:
<com.spacecaker.ButtonBurst android:id="@id/spacebuttonburst" android:layout_width="31.0dip" android:layout_height="34.0dip" android:scaleType="center" />
- Save file.

Quote:

- Navigate to /res/values and add these lines to ids.xml

Code:
<item type="id" name="spaceybeaneyheader">false</item>
<item type="id" name="jbclock">false</item>
<item type="id" name="spacebuttonburst">false</item>
<item type="id" name="recent_app_button">false</item>

Quote:

- Add these lines to end of the file Styles.xml

Code:
<style name="S3.Clear" parent="@*android:style/Widget.Button">
        <item name="android:textAppearance">?android:textAppearanceSmallInverse</item>
        <item name="android:textColor">#ffffffff</item>
        <item name="android:gravity">center</item>
        <item name="android:background">@drawable/tw_btn_default_small</item>
        <item name="android:focusable">true</item>
        <item name="android:clickable">true</item>
    </style>
- Save files

Quote:

- Download attached files and extract them in the directory where apk is decompiled.Now compile and again decompile APK.

Quote:

- Go to /res/values/public.xml and search these

Code:
<public type="drawable" name="btn_tg"
    <public type="drawable" name="btn_toggles_normal"
- Open smali/com/spacecaker/ButtonBurst.smali and search this
Code:
const v3, 0x7f020180
replace red part with id you got from
Code:
<public type="drawable" name="btn_toggles_normal"
- Now find this
Code:
const v3, 0x7f02017f
replace red part with id you got from
Code:
<public type="drawable" name="btn_tg"

Quote:

- Open smali/com/android/systemui/SystemUIService.smali and add this to end of file

Code:
.method public mOpenSettings(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.settings"

    const-string v2, "com.android.settings.Settings"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public ProfileButton(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.contacts"

    const-string v2, "com.android.contacts.activities.PeopleActivity"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public camera_tile(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.sec.android.app.camera"

    const-string v2, "com.sec.android.app.camera.Camera"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public turn_off_light(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "turn.off.the.lights"

    const-string v2, "turn.off.the.lights.LockerActivity"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public torch_toggle(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.teslacoilsw.flashlight"

    const-string v2, "com.teslacoilsw.flashlight.TeslaLEDToggle"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public dormant_toggle(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.settings"

    const-string v2, "com.android.settings.dormantmode.DormantmodeSettings"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public tether_toggle(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.settings"

    const-string v2, "com.android.settings.TetherSettings"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public app_toggle(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.settings"

    const-string v2, "com.android.settings.RunningServices"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public bat_toggle(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.settings"

    const-string v2, "com.android.settings.fuelgauge.PowerUsageSummary"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

.method public SpaceCakerButton(Landroid/view/View;)V
    .locals 3
    .parameter "v"

    .prologue
    .line 2431
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2432
    const-string v1, "com.android.settings"

    const-string v2, "com.android.settings.Settings"

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    move-result-object v0

    .line 2433
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    const-string v1, "statusbar"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/StatusBarManager;

    invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V

    .line 1720
    return-void
.end method

That's all compile apk and push it to device.
(Torch and Sleep tiles won't work unless you install TeslaLED and Turn Off the Lights app from market)
You can refer to SpaceCaker's thread for more info and tutorial for how to add new tiles.
If you get any errors/FCs report here along with full log.
(i won't quote posts without logcat and ask for logcat, i'll simply ignore them)
Attached Files
File Type: zip harsh_files_v2.zip - [Click for QR Code] (79.3 KB, 2085 views)
The Following 28 Users Say Thank You to BOOTMGR For This Useful Post: [ View ] Gift BOOTMGR Ad-Free
 
 
13th December 2013, 08:26 AM |#2  
BOOTMGR's Avatar
OP Senior Member
Flag Ahmedabad
Thanks Meter: 3,410
 
More
How to add Live Tiles
So now you've setup layout for 4.2 statusbar.Now its time to add some live tiles here.

What you'll get
At the moment i've only created live tiles for Battery and WiFi (those are the only ones which are fairly noticeable and widely used).Live tile for battery shows battery level and WiFi tile shows AP name and signal level when connected.See below screenshot for more info.
(More tiles will be added later when i'll get some time)


So let's begin
Quote:

- Add thses lines to res/values/ids.xml

Code:
<item type="id" name="harsh_batt">false</item>
    <item type="id" name="harsh_wifi">false</item>
    <item type="id" name="harsh_bat_img">false</item>
    <item type="id" name="harsh_wifi_img">false</item>

Quote:

- Now open \res\layout\quickpanel_quick_settings_space.xml
- Every tile here is wrapped up within <FrameLayout></FrameLayout>.So now select one of frameLayout which will be your battery tile.This framelayout will include one ImageView (for indication of battery tile) and one TextView (for showing battery in %).Create them if you haven't.
- Now remove

Code:
android:src="@drawable/set"
or whatever drawable you've associated to that ImageView.
- Add
Code:
android:id="@id/harsh_bat_img"
for same ImageView.
- We'll do the same for TextView.Remove
Code:
android:text="Battery"
and add
Code:
android:id="@id/harsh_batt"
for that TextView.

- Now let's do the same for WiFi tile.Select FrameLayout for that tile and do following changes for that FrameLayout
- Remove
Code:
android:src="@drawable/set"
for the <ImageView> and add
Code:
android:id="@id/harsh_wifi_img"
- Now for <TextView>, remove
Code:
android:text="xxx"
and add
Code:
android:id="@id/harsh_wifi"
- Thats all.Save the files.

Quote:

- Download the attached file and extract it to decompiled directory.
- Compile APK and decompiled it back so that public ids get generated.
- Now keep you res/values/public.xml open.

Quote:

- Open smali\com\spacecaker\SpaceLayOut.smali
- Add

Code:
.field draw:Landroid/graphics/drawable/Drawable;

.field iv:Landroid/widget/ImageView;
before .field private mContext:Landroid/content/Context;
- Add
Code:
.field res:Landroid/content/res/Resources;

.field t:Landroid/widget/TextView;

.field userName:Ljava/lang/String;
after .field private mUpdating:Z
- Now search for .method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSetV and add following lines before return-void
Code:
invoke-virtual {p0}, Lcom/spacecaker/SpaceLayOut;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    iput-object v0, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;
- search for .method private update(Z)V and add this below .line 46 (i.e. at the starting of the method)
Code:
invoke-virtual {p0}, Lcom/spacecaker/SpaceLayOut;->getBatteryState()V

    .line 256
    invoke-virtual {p0}, Lcom/spacecaker/SpaceLayOut;->getWifiInfo()V
- Now add the following lines after # virtual methods.
Code:
.method public getBatteryState()V
    .locals 13

    .prologue
    .line 31
    const v10, 0x7f0d012c

    invoke-virtual {p0, v10}, Lcom/spacecaker/SpaceLayOut;->findViewById(I)Landroid/view/View;

    move-result-object v10

    check-cast v10, Landroid/widget/TextView;

    iput-object v10, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    .line 32
    const v10, 0x7f0d012e

    invoke-virtual {p0, v10}, Lcom/spacecaker/SpaceLayOut;->findViewById(I)Landroid/view/View;

    move-result-object v10

    check-cast v10, Landroid/widget/ImageView;

    iput-object v10, p0, Lcom/spacecaker/SpaceLayOut;->iv:Landroid/widget/ImageView;

    .line 33
    new-instance v3, Landroid/content/IntentFilter;

    const-string v10, "android.intent.action.BATTERY_CHANGED"

    invoke-direct {v3, v10}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 34
    .local v3, ifilter:Landroid/content/IntentFilter;
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->mContext:Landroid/content/Context;

    const/4 v11, 0x0

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

    move-result-object v1

    .line 35
    .local v1, batteryStatus:Landroid/content/Intent;
    const-string v10, "level"

    const/4 v11, -0x1

    invoke-virtual {v1, v10, v11}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v5

    .line 36
    .local v5, level:I
    const-string v10, "scale"

    const/4 v11, -0x1

    invoke-virtual {v1, v10, v11}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v7

    .line 37
    .local v7, scale:I
    const-string v10, "status"

    const/4 v11, -0x1

    invoke-virtual {v1, v10, v11}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v8

    .line 38
    .local v8, status:I
    const/4 v10, 0x2

    if-eq v8, v10, :cond_0

    const/4 v10, 0x5

    if-eq v8, v10, :cond_0

    const/4 v4, 0x0

    .line 39
    .local v4, isCharging:Z
    :goto_0
    const-string v10, "plugged"

    const/4 v11, -0x1

    invoke-virtual {v1, v10, v11}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v2

    .line 40
    .local v2, chargePlug:I
    const/4 v10, 0x2

    if-ne v2, v10, :cond_1

    const/4 v9, 0x1

    .line 41
    .local v9, usbCharge:Z
    :goto_1
    int-to-float v10, v5

    int-to-float v11, v7

    div-float v6, v10, v11

    .line 42
    .local v6, net_battery:F
    const/high16 v10, 0x42c8

    mul-float/2addr v10, v6

    invoke-static {v10}, Ljava/lang/Math;->round(F)I

    move-result v0

    .line 43
    .local v0, batteryPct:I
    if-eqz v4, :cond_3

    .line 44
    if-eqz v9, :cond_2

    .line 45
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v12

    invoke-direct {v11, v12}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v12, "%"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    const-string v12, " (USB)"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-virtual {v10, v11}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 52
    :goto_2
    :try_start_0
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;

    iget-object v11, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;

    const v12, 0x7f0202ff

    invoke-virtual {v11, v12}, Landroid/content/res/Resources;->getXml(I)Landroid/content/res/XmlResourceParser;

    move-result-object v11

    invoke-static {v10, v11}, Landroid/graphics/drawable/Drawable;->createFromXml(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;)Landroid/graphics/drawable/Drawable;

    move-result-object v10

    iput-object v10, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 55
    :goto_3
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v10, v0}, Landroid/graphics/drawable/Drawable;->setLevel(I)Z

    .line 56
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->iv:Landroid/widget/ImageView;

    iget-object v11, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v10, v11}, Landroid/widget/ImageView;->setBackground(Landroid/graphics/drawable/Drawable;)V

    .line 57
    return-void

    .line 38
    .end local v0           #batteryPct:I
    .end local v2           #chargePlug:I
    .end local v4           #isCharging:Z
    .end local v6           #net_battery:F
    .end local v9           #usbCharge:Z
    :cond_0
    const/4 v4, 0x1

    goto :goto_0

    .line 40
    .restart local v2       #chargePlug:I
    .restart local v4       #isCharging:Z
    :cond_1
    const/4 v9, 0x0

    goto :goto_1

    .line 47
    .restart local v0       #batteryPct:I
    .restart local v6       #net_battery:F
    .restart local v9       #usbCharge:Z
    :cond_2
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v12

    invoke-direct {v11, v12}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v12, "%"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    const-string v12, " (AC)"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-virtual {v10, v11}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_2

    .line 49
    :cond_3
    iget-object v10, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v12

    invoke-direct {v11, v12}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v12, "%"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-virtual {v10, v11}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_2

    .line 53
    :catch_0
    move-exception v10

    goto :goto_3
.end method

.method public getWifiInfo()V
    .locals 7

    .prologue
    .line 59
    const v4, 0x7f0d012d

    invoke-virtual {p0, v4}, Lcom/spacecaker/SpaceLayOut;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/TextView;

    iput-object v4, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    .line 60
    const v4, 0x7f0d012f

    invoke-virtual {p0, v4}, Lcom/spacecaker/SpaceLayOut;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/ImageView;

    iput-object v4, p0, Lcom/spacecaker/SpaceLayOut;->iv:Landroid/widget/ImageView;

    .line 61
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->mContext:Landroid/content/Context;

    const-string v5, "wifi"

    invoke-virtual {v4, v5}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Landroid/net/wifi/WifiManager;

    .line 62
    .local v3, wm:Landroid/net/wifi/WifiManager;
    invoke-virtual {v3}, Landroid/net/wifi/WifiManager;->getWifiState()I

    move-result v2

    .line 63
    .local v2, wifiState:I
    packed-switch v2, :pswitch_data_0

    .line 86
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    const-string v5, "Error"

    invoke-virtual {v4, v5}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 89
    :goto_0
    return-void

    .line 67
    :pswitch_0
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    const-string v5, "Wi-Fi"

    invoke-virtual {v4, v5}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 69
    :try_start_0
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;

    iget-object v5, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;

    const v6, 0x7f020322

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getXml(I)Landroid/content/res/XmlResourceParser;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/graphics/drawable/Drawable;->createFromXml(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;)Landroid/graphics/drawable/Drawable;

    move-result-object v4

    iput-object v4, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1

    .line 72
    :goto_1
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->iv:Landroid/widget/ImageView;

    iget-object v5, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v4, v5}, Landroid/widget/ImageView;->setBackground(Landroid/graphics/drawable/Drawable;)V

    goto :goto_0

    .line 75
    :pswitch_1
    invoke-virtual {v3}, Landroid/net/wifi/WifiManager;->getConnectionInfo()Landroid/net/wifi/WifiInfo;

    move-result-object v1

    .line 76
    .local v1, wifiInfo:Landroid/net/wifi/WifiInfo;
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->t:Landroid/widget/TextView;

    invoke-virtual {v1}, Landroid/net/wifi/WifiInfo;->getSSID()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 77
    invoke-virtual {v1}, Landroid/net/wifi/WifiInfo;->getRssi()I

    move-result v4

    const/4 v5, 0x5

    invoke-static {v4, v5}, Landroid/net/wifi/WifiManager;->calculateSignalLevel(II)I

    move-result v0

    .line 79
    .local v0, signalLevel:I
    :try_start_1
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;

    iget-object v5, p0, Lcom/spacecaker/SpaceLayOut;->res:Landroid/content/res/Resources;

    const v6, 0x7f020300

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getXml(I)Landroid/content/res/XmlResourceParser;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/graphics/drawable/Drawable;->createFromXml(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;)Landroid/graphics/drawable/Drawable;

    move-result-object v4

    iput-object v4, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    .line 82
    :goto_2
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v4, v0}, Landroid/graphics/drawable/Drawable;->setLevel(I)Z

    .line 83
    iget-object v4, p0, Lcom/spacecaker/SpaceLayOut;->iv:Landroid/widget/ImageView;

    iget-object v5, p0, Lcom/spacecaker/SpaceLayOut;->draw:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v4, v5}, Landroid/widget/ImageView;->setBackground(Landroid/graphics/drawable/Drawable;)V

    goto :goto_0

    .line 80
    :catch_0
    move-exception v4

    goto :goto_2

    .line 70
    .end local v0           #signalLevel:I
    .end local v1           #wifiInfo:Landroid/net/wifi/WifiInfo;
    :catch_1
    move-exception v4

    goto :goto_1

    .line 63
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

Quote:

- Search for

Code:
const v15, 0x7f0d012c
change public id which you get from
Code:
<public type="id" name="harsh_batt"
in public.xml
- Search for
Code:
const v15, 0x7f0d012e
change public id which you get from
Code:
<public type="id" name="harsh_bat_img"
- Search for
Code:
const v15, 0x7f0202ff
change public id which you get from
Code:
<public type="drawable" name="harsh_stat_battery"
- Search for
Code:
const v8, 0x7f0d012d
change public id which you get from
Code:
<public type="id" name="harsh_wifi"
- Search for
Code:
const v8, 0x7f0d012f
change public id which you get from
Code:
<public type="id" name="harsh_wifi_img"
- Search for
Code:
const v8, 0x7f020322
change public id which you get from
Code:
<public type="drawable" name="wifi_tile"
- Search for
Code:
const v8, 0x7f020300
change public id which you get from
Code:
<public type="drawable" name="harsh_stat_wifi"

- Thats it.Now save your file and compile APK and push it to device.
Attached Files
File Type: zip Live_tiles_files.zip - [Click for QR Code] (66.0 KB, 988 views)
The Following 11 Users Say Thank You to BOOTMGR For This Useful Post: [ View ] Gift BOOTMGR Ad-Free
13th December 2013, 08:27 AM |#3  
BOOTMGR's Avatar
OP Senior Member
Flag Ahmedabad
Thanks Meter: 3,410
 
More
Tips,Tricks & FAQs
Changelog:
  • 13/12/13 --> Initial Release
  • 27/12/13 --> Optimized code.Reduced lags when live tiles are implemented.Live tiles will update only when statusbar is pulled down.
Tips, Tricks & FAQs:
  • If battery indicator or any other image don't look in center, define paddings like android:layout_marginTop="30.0dip"
  • If you've added more than 3 rows, then you need to enclose it in <ScrollView> in order to make it scrollable.
  • Even though i've named them Live tiles, they're not actually live like original 4.2.2 statusbar. They'll update only when tile layout is drawn (i mean expanded).But this has one advantage that addition overhead to system is gone.
  • Associate android: onClick="foobar" attribute to FrameLayout instead of ImageView so that clicking anywhere on the tile can execute defined method.
  • Each <LinearLayout> shows one row which have 3 FrameLayout by default.If you'll add/remove FrameLayout then width of tiles will be set accordingly.
The Following 6 Users Say Thank You to BOOTMGR For This Useful Post: [ View ] Gift BOOTMGR Ad-Free
13th December 2013, 09:32 AM |#4  
Member
Thanks Meter: 1
 
More
screenshot will be? I would like to see the final result
13th December 2013, 11:12 AM |#5  
Member
Thanks Meter: 4
 
More
Status bar disappeared. What to do? Galaxy ace 2 android 4.1.2
13th December 2013, 11:18 AM |#6  
Goldie's Avatar
Inactive Recognized Developer
Thanks Meter: 22,972
 
Donate to Me
More
Quote:
Originally Posted by ildar2099

Status bar disappeared. What to do? Galaxy ace 2 android 4.1.2

First...read the OP. Especially the underlined line at the bottom

Nice guide btw

Sent from my GT-I9305 using Tapatalk
The Following 2 Users Say Thank You to Goldie For This Useful Post: [ View ] Gift Goldie Ad-Free
13th December 2013, 11:46 AM |#7  
Member
Thanks Meter: 4
 
More
Code:
pkTools152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_july' has no default translation in C:\ApkT
ools152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_june' has no default translation in C:\ApkT
ools152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_march' has no default translation in C:\Apk
Tools152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_may' has no default translation in C:\ApkTo
ols152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_november' has no default translation in C:\
ApkTools152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_october' has no default translation in C:\A
pkTools152\SystemUI\res; found: mk
aapt: warning: string 'month_shortest_september' has no default translation in C:
\ApkTools152\SystemUI\res; found: mk
aapt: warning: string 'no_such_item' has no default translation in C:\ApkTools152
\SystemUI\res; found: bg cs da de el en_US es_ES es_US et fi fr ga hr hu is it kk
 ko lt lv mk nb nl pl pt_PT ro ru sk sl sr sv tr uk
aapt: warning: string 'pm' has no default translation in C:\ApkTools152\SystemUI\
res; found: mk
aapt: warning: string 'quickpanel_data_roaming_disable_toast' has no default tran
slation in C:\ApkTools152\SystemUI\res; found: bg cs da de el en_US es_ES es_US e
t fi fr ga hr hu is it kk ko lt lv mk nb nl pl pt_PT ro ru sk sl sr sv tr uk
aapt: warning: string 'quickpanel_data_roaming_enable_toast' has no default trans
lation in C:\ApkTools152\SystemUI\res; found: bg cs da de el en_US es_ES es_US et
 fi fr ga hr hu is it kk ko lt lv mk nb nl pl pt_PT ro ru sk sl sr sv tr uk
aapt: warning: string 'today' has no default translation in C:\ApkTools152\System
UI\res; found: mk
aapt: warning: string 'tomorrow' has no default translation in C:\ApkTools152\Sys
temUI\res; found: mk
aapt: warning: string 'twelve_hour_time_format' has no default translation in C:\
ApkTools152\SystemUI\res; found: mk
aapt: warning: string 'yesterday' has no default translation in C:\ApkTools152\Sy
stemUI\res; found: mk
I: Building apk file...
   SystemUI - complete

 All done!
My original SystemUI.apk
Attached Files
File Type: apk SystemUI.apk - [Click for QR Code] (1.76 MB, 499 views)
13th December 2013, 11:54 AM |#8  
Goldie's Avatar
Inactive Recognized Developer
Thanks Meter: 22,972
 
Donate to Me
More
They're just apktool warnings. You need a logcat of the system ui fc not the compile log

Sent from my GT-I9305 using Tapatalk
13th December 2013, 12:02 PM |#9  
Member
Thanks Meter: 4
 
More
Quote:
Originally Posted by Goldie

They're just apktool warnings. You need a logcat of the system ui fc not the compile log

Sent from my GT-I9305 using Tapatalk

where to find it?
13th December 2013, 12:08 PM |#10  
Goldie's Avatar
Inactive Recognized Developer
Thanks Meter: 22,972
 
Donate to Me
More
Quote:
Originally Posted by ildar2099

where to find it?

You should have a dumpstate_app_error.txt.gz in data/log. If not then you need to google how to take a logcat

Sent from my GT-I9305 using Tapatalk
13th December 2013, 12:37 PM |#11  
Member
Thanks Meter: 4
 
More
Quote:
Originally Posted by Goldie

You should have a dumpstate_app_error.txt.gz in data/log. If not then you need to google how to take a logcat

Sent from my GT-I9305 using Tapatalk

can be more?

Sent from my GT-I8160 using xda app-developers app
Post Reply Subscribe to Thread

Tags
4.2.2, live, statusbar, tiles

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

Advanced Search
Display Modes