[GUIDE][MOD][SYSTEMUI] How to add 0.00KB/s meter on statusbar GB/ICS/JB/KK 10-08-2013

Search This thread

xfeedbacker

Senior Member
Aug 9, 2013
59
7
i use to mod my cm7
But now i want to let the update more faster.

in the modified version i saw exactly what i want to do.


7.Edit res/values/integers.xml and add the following lines (changing the values if desired):

Code:
<!-- The counter will only be shown if transfer rates exceed this amount in bytes per second. Set to -1 to always show -->
<integer name="minimum_threshold_bps">18</integer>
<!-- This determines the interval in seconds between consecutive polls (updates). The smaller the value, the more accurate it
will be, but the more power it will consume. Clamped to a minimum of 1 (i.e. once per second) -->
<integer name="poll_rate">2</integer>


But in my systemUI i dont have the integers.xml file

so what i need to do to let the pool/update more faster? can someone help me ?
 

S-X-ShaX

Member
Apr 12, 2014
6
0
make it disappear

It works well except for when I change 18 to -1,it always shows even though I turn off wifi or net.How can I make it disappear when I turn off wifi or net(always shows when wifi or net on)?Please help me,thanks.
 

DSA

Senior Member
May 15, 2011
4,740
5,777
please remove the massive quote in your post, theres no need for it
 

S-X-ShaX

Member
Apr 12, 2014
6
0
@Dzol Cp Can you change taboo5200's smali to make it disappear whem wifi or data turn off?If you can help me,please compile it into an apk,I don''t know why my apktool can't compile easily,I can only decompile it and get smalis,then it will work.
 

zant76

Member
Mar 18, 2014
5
1
Smali file error

Recompiling "LenovoSystemUI.apk" With Original Signature,
using "apktool_2.0.0b7.jar"

With Tickle My Android
(tinyurl.com\ticklemyandroid)

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

..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[24,4] Error for input '.parameter': Invalid directive
..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[40,4] Error for input '.parameter': Invalid directive
..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[41,4] Error for input '.parameter': Invalid directive
..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[40,15] mismatched input '"context"' expecting END_METHOD_DIRECTIVE
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: fx/dzolcp/Speed$1.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:337)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:233)
at brut.apktool.Main.main(Main.java:88)

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

Recompile Not Successful!
 
  • Like
Reactions: Ticklefish

Ticklefish

Recognized Themer
Oct 27, 2011
6,773
8,633
Hampshire, UK
Recompiling "LenovoSystemUI.apk" With Original Signature,
using "apktool_2.0.0b7.jar"

With Tickle My Android
(tinyurl.com\ticklemyandroid)

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

..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[24,4] Error for input '.parameter': Invalid directive
..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[40,4] Error for input '.parameter': Invalid directive
..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[41,4] Error for input '.parameter': Invalid directive
..\_working\LenovoSystemUI.apk\smali\fx\dzolcp\Speed$1.smali[40,15] mismatched input '"context"' expecting END_METHOD_DIRECTIVE
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: fx/dzolcp/Speed$1.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:337)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:233)
at brut.apktool.Main.main(Main.java:88)

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

Recompile Not Successful!

What a fantastic choice of decompiling tool you've made! :D

You need to use 'apktool_1.5.3.jar' to decompile and recompile your apk. The smali in this mod needs an older version of 'smali/baksmali' than is in apktool_2.0.0..
 

nandisenjaya

Member
Apr 13, 2014
23
2
decompile & recompile success, but it's show nothing on my Xperia M Dual JB 4.3 statusbar after i replace SystemUI and reboot device :(
 

S-X-ShaX

Member
Apr 12, 2014
6
0
Means that once you install any logcat or catlog apk from Gplay,
Just open it and you can see error msg on the log.

Sent from my GT-I9300 using xda premium

I know why it don't work,I should use an older verson of apktool and smali,I just find taboo5200'smali can't disappear when wifi or data off,could you change it?I really like it because it can show upload or download in difficult color.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 136
    dzolcp.png
    UPDATE NEW SMALI FILES AND LINES ON 2ND POST *TEST AND WORK ON FROYO ROM, GB ROM & MTK DEVICE (WORK ON KITKAT)

    I just wanna share how to add speed meter (0.00k/s) data on statusbar simple and fastway

    1.Basic knowledge how to compile/decompile using Apktool/Apkmanager/
    Tickle My Android(I try it and so easy) Credits to Ticklefish
    2.Brain and brave :laugh:

    Method :

    -Download smali.zip attachment and extract it
    -Decompile your SystemUI.apk
    -In your smali,,copy/paste extract file
    systemUi/smali/here = smali/fx/dzolcp

    -Then go to res/layout/status_bar.xml and add this line (copy from here)

    Code:
    <fx.dzolcp.Speed android:textAppearance="@style/TextAppearance.StatusBar.Speed" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />

    -Example

    Code:
    <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Kecil" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentRight="true">
                <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                <ImageView android:layout_gravity="center_vertical" android:id="@id/stat_no_sim" android:paddingLeft="4.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                [COLOR="Red"]<fx.dzolcp.Speed android:textAppearance="@style/TextAppearance.StatusBar.Speed" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />[/COLOR]
                <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                    <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>

    -Save and close file.

    -Then open res/values/styles.xml

    edit this at the end of line or you can copy/paste from here

    Code:
    <style name="TextAppearance.StatusBar.Speed" parent="@style/TextAppearance.StatusBar.Clock">
          <item name="android:textSize">14.0dip</item>
          <item name="android:textColor">#ffffffff</item>
     </style>
    </resources>

    -Save and close file.

    -Recompile back your SystemUi.apk..

    -And let me know the result :good:

    Status_bar.xml for SCREENSHOT

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:background="@drawable/status_bar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="3.0dip" android:paddingRight="3.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
            <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.Kecil" android:layout_gravity="left|center" android:id="@id/battery_text" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" style="@style/StatusBarNotificationText" />
                <ImageView android:layout_gravity="center_vertical" android:id="@id/battery" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" />
                <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
            </LinearLayout>
            <DigitalClock android:textAppearance="@style/TextAppearance.StatusBar.Kecil" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentRight="true">
                <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                <ImageView android:layout_gravity="center_vertical" android:id="@id/stat_no_sim" android:paddingLeft="4.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" />
                [COLOR="Red"]<fx.dzolcp.Speed android:textAppearance="@style/TextAppearance.StatusBar.Speed" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />[/COLOR]
                <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                    <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
        <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">
            <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginRight="4.0dip">
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
            </ImageSwitcher>
            <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:paddingRight="10.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
            </com.android.systemui.statusbar.phone.TickerView>
        </LinearLayout>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    544294_425675090858299_939258622_n.jpg



    CREDITS TO : REPENCIS For his 0.00k/s smali files

    CREDITS TO : ROMWIZ For his nice video tutorial
    CREDITS TO : TICKLEFISH For his AWESOME Tools
    CREDITS TO : SANJAY KUMAR For his FROYO tutorial
    CREDITS TO : BLUE SHARKY For his fix SystemUI FC's tutorial
    CREDITS TO : SIEUAN For MTK Devices mod
    CREDITS TO : TABOO5200 For latest version - Modified smali's

    Not modded for any user anymore * Please include your device name and android version if you want Me to Re-Mod your SystemUI
    *Try to upload here via XDA attachment uploader and not to link to any download server out of XDA unless there is no more option
    :p
    66
    NEW SMALI FILES AND LINES

    This new smali will show the KB/s meter only appear when you have data or wifi connection :D

    NEW VERSION *MODIFIED SMALI'S - TEST ONLY ON GB



    FOR FROYO ROM



    FOR GB ROM



    FOR MTK DEVICE



    FIX FC FOR JB



    Copy this line to res/layout/status_bar.xml


    Code:
    <com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Traffic" android:gravity="left|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />

    this line to add in res/values/ids.xml


    Code:
    <item type="id" name="traffic">false</item>

    and this one as usual res/values/styles.xml


    Code:
    <style name="TextAppearance.StatusBar.Traffic" parent="@style/TextAppearance.StatusBar.Clock">
            <item name="android:textSize">14.0dip</item>
            <item name="android:textStyle">normal</item>
            <item name="android:textColor">#ffffffff</item>
            <item name="android:textAllCaps">false</item>
        </style>

    Status_bar.xml for SCREENSHOT



    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:background="@drawable/status_bar_custom_background" android:focusable="true" android:descendantFocusability="afterDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
        <ViewFlipper android:id="@id/status_bar_flipper" android:layout_width="fill_parent" android:layout_height="fill_parent"
          xmlns:android="http://schemas.android.com/apk/res/android">
            <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
                <RelativeLayout android:id="@id/icons" android:paddingLeft="6.0dip" android:paddingRight="6.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
                    <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentLeft="true">
                    <ImageView android:gravity="right|center" android:id="@id/battery" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                       <TextView android:textAppearance="@style/TextAppearance.StatusBar.Traffic" android:layout_gravity="left|center" android:id="@id/battery_text" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" style="@style/StatusBarNotificationText" />
                        <LinearLayout android:orientation="horizontal" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
                            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
                            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" />
                        </LinearLayout>
                    </LinearLayout>
                    <DigitalClock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:id="@id/center_clock" android:layout_width="fill_parent" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" />
                    <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentRight="true">
                        <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
                            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                            <ImageView android:layout_gravity="center_vertical" android:id="@id/stat_no_sim" android:paddingLeft="4.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                            <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                           [COLOR="Blue"]     <com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Traffic" android:gravity="right|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" /> [/COLOR]
                                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                            </LinearLayout>
                            <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
                        </LinearLayout>
                    </RelativeLayout>
                </RelativeLayout>
                <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">
                    <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginRight="4.0dip">
                        <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                        <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="center" />
                    </ImageSwitcher>
                    <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:paddingRight="10.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
                        <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
                        <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
                    </com.android.systemui.statusbar.phone.TickerView>
                </LinearLayout>
            </LinearLayout>
            <RelativeLayout android:layout_width="fill_parent" android:layout_height="@*android:dimen/status_bar_height" android:layout_alignParentLeft="true">
                <DigitalClock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:paddingLeft="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
                <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
                    <com.serajr.dataspeedmeter.DataSpeedMeter android:textAppearance="@style/TextAppearance.StatusBar.Traffic" android:gravity="center" android:id="@id/data_speed_meter" android:layout_width="wrap_content" android:layout_height="fill_parent" />
                    <View android:layout_width="8.0dip" android:layout_height="fill_parent" />
                    <include android:id="@id/signal_cluster_2" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                    <View android:layout_width="4.0dip" android:layout_height="fill_parent" />
                </LinearLayout>
            </RelativeLayout>
        </ViewFlipper>
    </com.android.systemui.statusbar.phone.PhoneStatusBarView>

    Screenshot_2013_06_04_15_43_42.png


    New smali : Works even better, no more traffic spam in catlog..excellent work!

    copy the smali files to this
    smali/com/android/systemui/statusbar/policy/here


    Yup, that's pretty much it.

    framework-res.apk is what I call a "resource apk". It contains information that is needed to be able to decompile certain system apk's.

    To make matters more confusing, the creator of apktool (the tool used by most people to decompile apk files) calls these sort of files "framework apk's".

    Hopefully you'll start experimenting with decompiling apk's yourself before too long and you'll understand what this is all about. I was a newbie when I registered here and none of this made any sense to me at all! But keep with it, and it will all become second nature to you. :cool:
    15
    Modified version

    Based on the .smalis in this post, I've reconstructed the source code in Java as accurately as possible (right down to the line number) - see the Traffic_Reconstructed.java attachment (only of interest to those who build from source). However, because the .smalis have evidently been modified before, things may not match up 100% though these differences are fairly trivial and do not actually affect the way the code executes. To compile it, grab my Eclipse/ADT project and replace the Traffic.java file with the reconstructed one. Things should just work (I hope?).
    Name mappings (again, only of interest to those who build from source and are curious about the reconstruction):
    Code:
    [B]Traffic_Reconstructed.java (compiled and smali-ed) ↔ TRAFFIC.zip[/B]
                                Traffic$Receiver.smali ↔ Traffic$1.smali
                                       Traffic$1.smali ↔ Traffic$2.smali
                                    Traffic$Task.smali ↔ Traffic$3.smali
                        Traffic$SettingsObserver.smali ↔ Traffic$SettingsObserver.smali
                                         Traffic.smali ↔ Traffic.smali

    From the reconstructed code, I've modified it to remove unnecessary code and make it more efficient and (hopefully) less memory hungry. The changes are as follows:
    • Dynamically switches between the download and upload rates depending on whichever is higher
    • Text colorization depending on which rate is being displayed (green for download and red for upload, adjustable)
    • Dynamically hides the counter if the rate is below a configurable value to save space (defaults to 18 bytes/second)
    • Supports poll rate adjustments (defaults to once every two seconds)
    • Favors displaying smaller units of measurement (e.g. 999B/s instead of 0.99K/s, 999.00K/s instead of 0.99M/s)
    • Bytes are displayed as integers (whole numbers), kibibytes and mebibytes are displayed as decimal fractions accurate to two decimal places
    • Removed unnecessary code and SettingsObserver subclass
    Previews:
    attachment.php
    attachment.php


    Sounds good? There's (unfortunately) a catch: the abovementioned customizability means that manual linking has to be done. The integration instructions further below will guide you through the process.

    Disclaimer: This has only been tested with an Xperia go on Gingerbread 2.3.7. Your mileage may vary, though I don't see any reason why it shouldn't work for any newer version. Try out the test app I've attached to this post to see it in action for yourself and to determine if it will work for you before taking the plunge.
    traffic_demo.apk, SHA-1 hash: 531F02DC710EA41E059E2C0F654AA5E1EACE2C78 | source code and Eclipse/ADT project

    Integration procedure [brace yourself, it's long]:
    (these instructions supercede those given in the OP since they are specific to my version)

    0. Common sense dictates that you should have a working backup before meddling around with things, and I'd recommend you to heed its advice
    1. Decompile SystemUI.apk
    2. Extract the four .smali files from traffic_rw_smali.zip and copy them to smali/com/android/systemui/statusbar/policy
    3. Edit res/layout/status_bar.xml and insert the following line (preferably within the LinearLayout containing android:id="@id/icons"):
      Code:
      <com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Traffic" android:gravity="left|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
    4. Edit res/values/ids.xml and add the following line:
      Code:
      <item type="id" name="traffic">false</item>
    5. Edit res/values/styles.xml and add the following lines (alter textSize and/or typeface if desired):
      Code:
          <style name="TextAppearance.StatusBar.Traffic" parent="@*android:style/TextAppearance.StatusBar.Icon">
              <item name="android:textColor">@color/traffic_text_color_default</item>
              <item name="android:textSize">10sp</item>
              <item name="android:typeface">monospace</item>
          </style>
    6. Edit res/values/colors.xml and add the following lines (and adjust the colors if desired):
      Code:
          <color name="traffic_text_color_default">#ffd0d0d0</color>
          <color name="traffic_text_color_download">#ffbeffbe</color>
          <color name="traffic_text_color_upload">#ffffbebe</color>
    7. Edit res/values/integers.xml and add the following lines (changing the values if desired):
      Code:
          [COLOR="SeaGreen"]<!-- The counter will only be shown if transfer rates exceed this amount in bytes per second. Set to -1 to always show -->[/COLOR]
          <integer name="minimum_threshold_bps">18</integer>
          [COLOR="SeaGreen"]<!-- This determines the interval in seconds between consecutive polls (updates). The smaller the value, the more accurate it
               will be, but the more power it will consume. Clamped to a minimum of 1 (i.e. once per second) -->[/COLOR]
          <integer name="poll_rate">2</integer>
    8. Edit res/values/public.xml and add the following lines (please first verify that the id= values do not already exist, otherwise change them to something else if they do clash AND keep track of them - we'll need to fix them up again in step 9)*:
      Code:
          <public type="color" name="traffic_text_color_default" id="0x7f0c0000" />
          <public type="color" name="traffic_text_color_download" id="0x7f0c0001" />
          <public type="color" name="traffic_text_color_upload" id="0x7f0c0002" />
          <public type="integer" name="minimum_threshold_bps" id="0x7f060001" />
          <public type="integer" name="poll_rate" id="0x7f060002" />
    9. Edit smali/com/android/systemui/statusbar/policy/Traffic.smali and perform the following changes (and read the green text for further details):

      Line 155, change from:
      Code:
          const/high16 v2, 0x7f04
      to:
      Code:
          const v2, 0x7f0c0000		[COLOR="SeaGreen"]# <- Change this to match whatever [I]id=[/I] value was set in step 8 for [B]traffic_text_color_default[/B] [U]IF[/U] there was a clash[/COLOR]
      Line 170, change from:
      Code:
          const v2, 0x7f040001
      to:
      Code:
          const v2, 0x7f0c0001		[COLOR="SeaGreen"]# <- Change this to match whatever [I]id=[/I] value was set in step 8 for [B]traffic_text_color_download[/B] [U]IF[/U] there was a clash[/COLOR]
      Line 185, change from:
      Code:
          const v2, 0x7f040002
      to:
      Code:
          const v2, 0x7f0c0002		[COLOR="SeaGreen"]# <- Change this to match whatever [I]id=[/I] value was set in step 8 for [B]traffic_text_color_upload[/B] [U]IF[/U] there was a clash[/COLOR]
      Line 213, change from:
      Code:
          const/high16 v1, 0x7f06
      to:
      Code:
          const v1, 0x7f060001		[COLOR="SeaGreen"]# <- Change this to match whatever [I]id=[/I] value was set in step 8 for [B]minimum_threshold_bps[/B] [U]IF[/U] there was a clash[/COLOR]
      Line 226, change from:
      Code:
          const v1, 0x7f060001
      to:
      Code:
          const v1, 0x7f060002		[COLOR="SeaGreen"]# <- Change this to match whatever [I]id=[/I] value was set in step 8 for [B]poll_rate[/B] [U]IF[/U] there was a clash[/COLOR]
    10. Recompile SystemUI, paste the signature back in and install as usual

    *: When dealing with id clashes, first check if there are any entries that share the same type= value. For example, if the following line:
    Code:
        <public type="integer" name="minimum_threshold_bps" id="[COLOR="DarkRed"]0x7f060000[/COLOR]" />
    clashes with another line (observe that their ids are identical):
    Code:
        <public type="integer" name="config_clock_am_pm_style" id="[COLOR="DarkRed"]0x7f060000[/COLOR]" />
    then the line to be added (i.e. minimum_threshold_bps) should have its id adjusted to the largest value + 1. In this case, there is only one other entry, so the line is changed to become:
    Code:
        <public type="integer" name="minimum_threshold_bps" id="[COLOR="DarkRed"]0x7f060001[/COLOR]" />

    On the other hand, if there are no other entries that share the same type= value, then (assuming the list of entries have their ids in ascending order) take the id of the last entry and modify it to create your own type code. This is mandatory, or aapt will complain with an error along the lines of "res\values\public.xml:205: error: Public resource color/traffic_text_color_download has conflicting type codes for its public identifiers (0x4 vs 0xc)". For example, the following entries represent the contents of the res/values/public.xml file:
    Code:
        <public type="layout" name="status_bar_tracking" id="0x7f030005" />
        <public type="[COLOR="DarkRed"]xml[/COLOR]" name="bookmarks" id="[COLOR="DarkRed"]0x7f040000[/COLOR]" />
        <public type="bool" name="config_hspa_data_distinguishable" id="0x7f050000" />
        ...
        <public type="id" name="content" id="0x7f0b0014" />
        <public type="id" name="close" id="0x7f0b0015" />
    The following line is to be added to the above list:
    Code:
        <public type="[COLOR="DarkRed"]color[/COLOR]" name="traffic_text_color_default" id="[COLOR="DarkRed"]0x7f040000[/COLOR]" />
    The first issue is that the id= value clashes (with bookmarks). Unfortunately, it isn't as easy as simply using 0x7f040001 instead because aapt will complain that the type codes are the same (0x4) since one is an xml and the other is a color. To fix this, look at the id for close (0x7f0b0015, focus on the b within that number). Obviously, we can't use 0x7f0b0016 because we'd run into the exact same error again. Instead, increment b by one (it's in hexadecimal, so the number after that is c. If this makes no sense to you, I suggest you start learning it before proceeding) and reset the four digits after it to 0. The resultant value: 0x7f0c0000. Now the entry can be added to the list, like so:
    Code:
        <public type="layout" name="status_bar_tracking" id="0x7f030005" />
        <public type="xml" name="bookmarks" id="0x7f040000" />
        <public type="bool" name="config_hspa_data_distinguishable" id="0x7f050000" />
        ...
        <public type="id" name="content" id="0x7f0b0014" />
        <public type="id" name="close" id="0x7f0b0015" />
        <public type="color" name="traffic_text_color_default" id="[COLOR="DarkRed"]0x7f0c0000[/COLOR]" />

    Credits:
    Dzol Cp for providing the .smalis from which my version was derived
    smali developers for smali/baksmali
    Brut.alll, Connor Tumbleson for APKTool
    12
    Finally! Figured out how to fix the SystemUI FC error and got it to run on my JB 4.1 Slim Bean ROM. Yay!

    To all those who are having issues with their SystemUI FCing, these are all the steps you have to follow :

    1. Get Apktool apktool1.5.2.tar.bz2 and apktool-install-windows-r05-ibot.tar.bz2 from here (https://code.google.com/p/android-apktool/downloads/list). Extract the files, and place all three files in any folder on your computer (lets name the folder apktool).

    2. Take original SystemUI.apk and framework-res.apk from your device and place them both in the apktool folder along with the 3 files downloaded earlier.

    3. Open command prompt and navigate to your apktool directory, and enter the following command :

    Code:
    apktool if framework-res.apk

    This installs your framework-res.apk file to your system so you can mod your SystemUI without any problems.

    4. After the framework-res.apk files have been installed, enter the following command to decompile your SystemUI.apk :

    Code:
    apktool d SystemUI.apk

    5. When the process ends, a SystemUI folder should be created in the apktools folder, where you can add the smali files and add the lines of code as mentioned by the OP. The order of the line matters in res/layout/status_bar.xml as this determines where in the status bar the traffic meter appears.

    6. (Optional) For those who have been asking to change the font size and the color, you have to modify these lines in res/values/styles.xml :

    Code:
    <style name="TextAppearance.StatusBar.Traffic" parent="@style/TextAppearance.StatusBar.Clock">
            [B][U]<item name="android:textSize">14.0dip</item>[/U][/B]
            <item name="android:textStyle">normal</item>
            [B][U]<item name="android:textColor">#ffffffff</item>[/U][/B]
            <item name="android:textAllCaps">false</item>
        </style>

    I personally used a text size of 10.0dip and since I wanted holo blue instead of white color, I replaced the line
    Code:
    <item name="android:textColor">#ffffffff</item>
    with
    Code:
    <item name="android:textColor">@*android:color/holo_blue_light</item>

    You can google for the hex code if you want any other color.

    7. After you are done editing the files, recompile it with the following command in the command prompt :

    Code:
    apktool b SystemUI

    8. A folder called dist will be created inside SystemUI folder in apktool folder, which contains the modded SystemUI.apk.

    9. You have to open this modded SystemUI.apk file using winrar/7zip, and also open the original SystemUI.apk file witn winrar/7zip.

    10. Drag and drop the META-INF folder and AndroidManifest.xml file from the original to the modded apk.

    11. <IMPORTANT> Since this is a system app, you do not need to sign it. But you should zipalign the apk before pushing it to your device. For zipaligning, see the following steps :

    1. You should have the Android SDK

    2. Go to C:\Program Files\Android\android-sdk\tools

    3. Copy zipalign.exe and draw9patch.bat and make a new folder and paste them both there.

    4. Paste the modded SystemUI.apk file in the zipalign folder

    5. Open cmd and nagivate to the zipalign folder and enter the command :

    zipalign -fv 4 SystemUI.apk SystemUI-new.apk

    6. Rename SystemUI-new.apk to SystemUI.apk and push to system/app in your phone, set permissions and reboot!


    Edit : Check out the screenshot in the attachment!



    Click thanks if you found this helpful! :)
    7
    Hi @Dzol Cp!

    I success add network speed meter on statusbar as your guide. Thanks sir!

    My phone using MTK chipset, and I've been found that with MTK devices, the code must be add into res/layout/zzz_status_bar_gemini.xml:

    Code:
    <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                [COLOR="red"]<com.android.systemui.statusbar.policy.Traffic android:textAppearance="@style/TextAppearance.StatusBar.Traffic" android:gravity="left|center" android:id="@id/traffic" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" style="@style/StatusBarNotificationText" />[/COLOR]
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/zzz_signal_cluster_view_gemini" />
                <TextView android:layout_gravity="left|center" android:id="@id/battery_text" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" style="@style/StatusBarNotificationText" />
                <ImageView android:id="@id/battery" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>

    You can add this note in post#1 and #2 for MTK Devices User. Thanks!