Quantcast
Channel: xda-developers - Verizon Galaxy S III Android Development
Viewing all articles
Browse latest Browse all 352

[MOD][GUIDE] How-to add abbreviated day of week in stsatus bar

$
0
0
This will add an abbreviated day of the week (Mon, Tue, Wed, etc) to your status bar

This will modify the status bar on the lock screen status bar, regular screen status bar, and expanded status bar.

This will work for LG7 and the new leak too i believe.

Here is the guide:

 


This will cover two scenarios.

1. Center Clock Applications
2. Stock Clock Applications

First one will be for Center Clock....

Decompile SystemUI and navigate to res/layout/tw_status_bar.xml

Find the following code
 
Code:

<com.android.systemui.statusbar.policy.Clock


Right above this line paste the following code
 
Code:

<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="right" android:id="@id/date" android:paddingRight="2.0dip" android:paddingTop="7.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" android:layout_weight="1.0" />


Navigate to smali/com/android/systemui/statusbar/policy/dateview.smali

Find the following code
 
Code:

.method private final updateClock()V


Starting with and including the very next line, delete everything all the way to and including the first "end Method you come to and paste the following code in its place
 
Code:

.locals 9

    .prologue
    const v8, 0x7f080002

    const/4 v5, 0x2

    const/4 v7, 0x1

    const/4 v6, 0x0


    .line 92
    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;

    move-result-object v0


    .line 93
    .local v0, context:Landroid/content/Context;
    new-instance v3, Ljava/util/Date;

    invoke-direct {v3}, Ljava/util/Date;-><init>()V


    .line 94
    .local v3, now:Ljava/util/Date;
    const-string v4, "EEE"

    invoke-static {v4, v3}, Landroid/text/format/DateFormat;->format(Ljava/lang/CharSequence;Ljava/util/Date;)Ljava/lang/CharSequence;

    move-result-object v2


    .line 95
    .local v2, dow:Ljava/lang/CharSequence;
    invoke-static {v0}, Landroid/text/format/DateFormat;->getLongDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;

    move-result-object v4

    invoke-virtual {v4, v3}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v1


    .line 98
    .local v1, date:Ljava/lang/CharSequence;
    sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->useTouchWizGUI:Z

    if-eqz v4, :cond_1

    .line 99
    sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->canStatusBarHide:Z

    if-eqz v4, :cond_0

    .line 100

    new-array v4, v5, [Ljava/lang/Object;

    aput-object v1, v4, v6

    aput-object v2, v4, v7

    invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V

    .line 108
    :goto_0
    return-void

    .line 102
       
    :cond_0
    const v4, 0x7f080003

    new-array v5, v5, [Ljava/lang/Object;

    aput-object v2, v5, v6

    aput-object v1, v5, v7

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

    move-result-object v4

    invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0


    .line 105
    :cond_1


    new-array v4, v5, [Ljava/lang/Object;

    aput-object v2, v4, v6

    aput-object v1, v4, v7

    invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0
.end method



Pay attention to the code above in RED. Those ID's must match up to the date ID's in your res/values/public.xml. If they dont you will need to change them.

Since this will also change the layout of the date in your dropdown menu, you may want to delete the date reference from there. If you do, this is how you delete it

Navigate to res/layout/tw_status_bar_expanded

Find the code that begins with the following and delete the entire line
 
Code:

<com.android.systemui.statusbar.policy.DateView



Thats it, recompile, chmod 644, and push to /system/app.

The next steps are for a stock clock setup. I have mine setup as a center clock so I will give you the basics for the stock clock. You may have to add some padding to tweak your location in the status bar. I will assume if you know how to de/recompile, you know how to pad your code.

In SystemUI Navigate to res/layout/tw_status_bar

Find the following code
 
Code:

<com.android.systemui.statusbar.policy.Clock


Add the following code on top of it
 
Code:

<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_toLeftOf="@id/clock" />


Navigate to smali/com/android/systemui/statusbar/policy/dateview.smali

Find the following code
 
Code:

.method private final updateClock()V


Starting with and including the very next line, delete everything all the way to and including the first "end Method you come to and paste the following code in its place
 
Code:

.locals 9

    .prologue
    const v8, 0x7f080002

    const/4 v5, 0x2

    const/4 v7, 0x1

    const/4 v6, 0x0


    .line 92
    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;

    move-result-object v0


    .line 93
    .local v0, context:Landroid/content/Context;
    new-instance v3, Ljava/util/Date;

    invoke-direct {v3}, Ljava/util/Date;-><init>()V


    .line 94
    .local v3, now:Ljava/util/Date;
    const-string v4, "EEE"

    invoke-static {v4, v3}, Landroid/text/format/DateFormat;->format(Ljava/lang/CharSequence;Ljava/util/Date;)Ljava/lang/CharSequence;

    move-result-object v2


    .line 95
    .local v2, dow:Ljava/lang/CharSequence;
    invoke-static {v0}, Landroid/text/format/DateFormat;->getLongDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;

    move-result-object v4

    invoke-virtual {v4, v3}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v1


    .line 98
    .local v1, date:Ljava/lang/CharSequence;
    sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->useTouchWizGUI:Z

    if-eqz v4, :cond_1

    .line 99
    sget-boolean v4, Lcom/android/systemui/statusbar/StatusBar;->canStatusBarHide:Z

    if-eqz v4, :cond_0

    .line 100

    new-array v4, v5, [Ljava/lang/Object;

    aput-object v1, v4, v6

    aput-object v2, v4, v7

    invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V

    .line 108
    :goto_0
    return-void

    .line 102
       
    :cond_0
    const v4, 0x7f080003

    new-array v5, v5, [Ljava/lang/Object;

    aput-object v2, v5, v6

    aput-object v1, v5, v7

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

    move-result-object v4

    invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0


    .line 105
    :cond_1


    new-array v4, v5, [Ljava/lang/Object;

    aput-object v2, v4, v6

    aput-object v1, v4, v7

    invoke-virtual {v0, v8, v4}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {p0, v4}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0
.end method



Pay attention to the code above in RED. Those ID's must match up to the date ID's in your res/values/public.xml. If they dont you will need to change them.

Since this will also change the layout of the date in your dropdown menu, you may want to delete the date reference from there. If you do, this is how you delete it

Navigate to res/layout/tw_status_bar_expanded

Find the code that begins with the following and delete the entire line
 
Code:

<com.android.systemui.statusbar.policy.DateView



Thats it, recompile, chmod 644, and push to /system/app.


Hit the thanks button if this has been helpful to you!

Attached Thumbnails
Click image for larger version

Name:	Screenshot_2012-10-09-13-50-28.jpg
Views:	N/A
Size:	38.4 KB
ID:	1388660  

Viewing all articles
Browse latest Browse all 352

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>