[GUIDE][MOD]StatusBar-Add day of the week FI27

timmetal6669

Inactive Recognized Developer
Apr 15, 2012
2,761
2,029
0
Redlands CA
Status BarCenterClock and (Abbreviated). Day of the week MOD





Saw this Mod in the Galaxy S3 section.. Thought I'd port it over. I had to edit the code slightly to get it to look the way I wanted it to on our phone, but all credit for the original should give Thanks out to Didact74. Go to his thread HERE and give him some thanks!

If anyone has a busy schedule or just a plain bad memory like me, ya like to see the day of the week LOL, Anyway;

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

Find the following code
Code:

HTML:
 <com.android.systemui.statusbar.policy.Clock android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingLeft="6.0dip" android:gravity="left|center" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:singleLine="true"
Above this line paste the following code:

HTML:
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="center|left" android:id="@id/date"  android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_toLeftOf="@id/clock" android:includeFontPadding="false" />
Recompile System UI and Set aside.

Baksmali the SystemUI classes.dex

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

Find the following code:

HTML:
.method private final updateClock()V
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:

HTML:
.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
Add back your drawable hdpi folder and Meta Inf folder back into your System ui you recompiled earlier,
Smali your classes.dex and add that to the system UI.. done.

Status BarCenterClock and (Abbreviated). Day of the week MOD (FI27)
 

DEF3NDER

Senior Member
Jul 3, 2012
1,465
1,442
0
I think this is a great mod. I sometimes forget what day it is lol. Maybe you, Dan, and tdunham should work together on adding all of your mods together.

Sent from my SPH-D710 using xda premium
+1. Would be amazing. Also, I think this mod is sweet. Thank you.

Sent from my SPH-D710 using xda premium
 

rockernaxo

Senior Member
Mar 25, 2012
629
1,448
0
Pamplona
www.htcmania.com
Hi mate!!!

I followed your fantastic guide to the letter and it worked but... Instead of having the day of the week (Sun.) it appears the date (12 May. 2013). I'm missing something but don't know what.

I'm on stock 4.1.2 Jelly Bean.

Any advise would be hugely appreciated.

Thanks for the tutorial and your support.

EDIT: I have uploaded a picture of what happens.
 

Attachments

Last edited:

bilgerryan

Inactive Recognized Developer
Oct 23, 2011
22,148
38,015
263
Garrett, IN
Hi mate!!!

I followed your fantastic guide to the letter and it worked but... Instead of having the day of the week (Sun.) it appears the date (12 May. 2013). I'm missing something but don't know what.

I'm on stock 4.1.2 Jelly Bean.

Any advise would be hugely appreciated.

Thanks for the tutorial and your support.

EDIT: I have uploaded a picture of what happens.
Your problem is most likely that FI27 is Ice Cream Sandwich and you are on Jelly Bean