FORUMS

[How to] Add a custom text to Status bar 11.09.2013

n/a posts
Thanks Meter: 0
 
By ivn888, Guest on 11th September 2013, 08:32 PM
Post Reply Email Thread
Hello there

Here is a simple guide to add a Custom name to top-left status bar.

All You need is:

- Know how to decompile/recompiling Apk file
- notepad++
- Tool for decompiling, : apkmanager/apktool/Virtous/apkmultitools ...

1. Decompile SystemUI.apk

2. navigate to res/layout/status_bar.xml

3.Open Status_bar.xml with notepad++

4.Copy this line like the following example:

Code:
 <TextView android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/hello" android:singleLine="true" />



Code:
<?xml version="1.0" encoding="utf-8"?>
<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">
    <ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
    <LinearLayout android:orientation="horizontal" android:id="@id/status_bar_contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip" android:paddingEnd="6.0dip">
        <LinearLayout android:orientation="horizontal" android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/hello" android:singleLine="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_alignParentStart="true" />
        </LinearLayout>
        <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent">
            <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
        </LinearLayout>
        <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <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" />
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/signal_cluster_view" />
                <TextView android:textAppearance="@style/TextAppearance.StatusBar.Battery" android:gravity="center" android:id="@id/battery_text" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
                <com.erryy.BatteryText android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textSize="12.0dip" android:gravity="center" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="-3.0dip" android:singleLine="true" />
                <ImageView android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="4.0dip" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
    <LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingStart="6.0dip">
        <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginEnd="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:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0" android:paddingEnd="10.0dip">
            <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>

"android:textAppearance="@style/TextAppearance.StatusBar.Clock" means that your custom text will have same colors and dimensions defined for clock (these are defined in /values/styles: 16dip and Holo Blue Light ).

If You want to add Your dip and your preferred color, just replaces above line with this:

android:textSize="15.0dip" android:textColor="#ffa6a6a6"

Code:
 <TextView android:textSize="15.0dip" android:textColor="#ffa6a6a6" android:gravity="left|center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/hello" android:singleLine="true" />


You can change text color and size to fit your needs.

android:textSize="x.0dip"

and android:textColor="#hex code of Your preferred color"

for example #DD4814 is Ubuntu Orange



5) Now, the last step:
Navigate to res/values/string

and add this at the end of the file:

Code:
<string name="hello">Your text here</string>
ex:
Code:
<string name="hello">ivn888</string>
Like this example:

Code:
... <string name="quick_settings_rssi_label">RSSI</string>
    <string name="quick_settings_rssi_emergency_only">Emergency Calls Only</string>
    <string name="quick_settings_settings_label">Settings</string>
    <string name="quick_settings_time_label">Time</string>
    <string name="quick_settings_user_label">Me</string>
    <string name="quick_settings_wifi_label">Wi-Fi</string>
    <string name="quick_settings_wifi_not_connected">Not Connected</string>
    <string name="quick_settings_wifi_no_network">No Network</string>
    <string name="quick_settings_wifi_off_label">Wi-Fi Off</string>
    <string name="quick_settings_wifi_display_label">Wi-Fi Display</string>
    <string name="quick_settings_wifi_display_no_connection_label">Wireless Display</string>
    <string name="quick_settings_brightness_dialog_title">Brightness</string>
    <string name="quick_settings_brightness_dialog_auto_brightness_label">AUTO</string>
    <string name="status_bar_help_title">Notifications appear here</string>
    <string name="status_bar_help_text">"Access them anytime by swiping down.
Swipe down again for system controls."</string>
    <string name="accessibility_sleep_button">Sleep button.</string>
    <string name="hello">Your text here</string>
</resources>
6) Recompile back ... enjoy!!



CREDITS:
enricocid
The Following 3 Users Say Thank You to ivn888 For This Useful Post: [ View ] Gift ivn888 Ad-Free
12th September 2013, 08:06 PM |#2  
H4CK_H0PP3R's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 43
 
More
Nice share bro ..will try some day ..

Sent from my Nexus 7 using xda premium
15th September 2013, 09:04 AM |#3  
armyboy11b's Avatar
Senior Member
new orleans
Thanks Meter: 951
 
More
Thanks for the info,could be useful to others

Sent from my Nexus 7 using XDA Premium 4 mobile app
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