[GUIDE] [4.1.1] [4.1.2] Small am/pm in statusbar + No ampm

gharrington

Senior Member
Apr 30, 2012
3,013
12,756
263
Brisbane
This guide will show you how to get small am\pm in status bar (Deodexed)

Things Needed:
Notepad ++
Tools
7zip

How to:
1. Unzip Tools folder to Desktop
2. Place Deodexed SystemUI.apk into folder
3. Hold shift key and Right click in folder. Then click `open command window here`
4. Type apktool d SystemUI.apk and hit enter. This will make a new folder called SystemUI
5. In that folder go to SystemUI/res/layout/tw_status_bar.xml and open with Notepad++
You will see this line:​

Code:
<com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ff33b5e5" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent"  android:singleLine="true" />



6. Add: systemui:ampmSmall="true" to the end just before /> so it looks like:


Code:
<com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" 
android:textColor="#ff33b5e5" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" systemui:ampmSmall="true" />



That is it. You have small am\pm trouble is its a bit too small so lets make it bigger.



7. Go to SystemUI/smali/com/android/systemui/statusbar/policy/Clock.smali and open with Notepad++
8. Scroll down to the end of the file and near the end you will see:

Code:
   invoke-direct {v4, v10}, Landroid/text/SpannableStringBuilder;-><init>(Ljava/lang/CharSequence;)V


    .local v4, formatted:Landroid/text/SpannableStringBuilder;


    const/high16 v7, 0x3f00


    .local v7, proportion:F
   invoke-virtual {v10, v1},Ljava/lang/String;->indexOf(Ljava/lang/String;)I



9. Change const/high16 v7, 0x3f00 to const/high16 v7, 0x3f33 so it looks like:


Code:
    invoke-direct {v4, v10}, Landroid/text/SpannableStringBuilder;-><init>(Ljava/lang/CharSequence;)V
 

    .local v4, formatted:Landroid/text/SpannableStringBuilder;
 
   const/high16 v7, 0x3f33

    .local v7, proportion:F

    invoke-virtual {v10, v1}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I




10. Save both files and close Notepad++
11. Hold shift key and right click folder again.
12. Type apktool b SystemUI nSystemUI.apk this will make a file called nSystemUI.apk
13. Open both files with 7zip and copy META-INF and AndroidManifest.xml form original apk to new apk

14. Flash, Enjoy and hit the thanks button.
 
Last edited:

gharrington

Senior Member
Apr 30, 2012
3,013
12,756
263
Brisbane
[GUIDE][4.1.1][4.1.2] Remove am/pm

Ok guys heres how to remove ampm from statusbar. I decided to re write the whole method to get rid of unwanted code and make it more efficient. You can still use both 12hr and 24hr.

Things Needed:
Notepad ++
Tools
7zip


How to:
1. Unzip Tools folder to Desktop
2. Place Deodexed SystemUI.apk into folder
3. Hold shift key and Right click in folder. Then click `open command window here`
4. Type apktool d SystemUI.apk and hit enter. This will make a new folder called SystemUI
5. Go to SystemUI/smali/com/android/systemui/statusbar/policy/Clock.smali and open with Notepad++
6. Scroll down to the end of the file and near the end you will see:​

Code:
[CENTER].method final updateClock()V[/CENTER]
 
 
[CENTER](CODE)[/CENTER]
 
 
 
[CENTER].end method[/CENTER]

Replace whole thing with:​


Code:
[LEFT].method final updateClock()V[/LEFT]
 
[LEFT]   .locals 7[/LEFT]
 
 
 
[LEFT]    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/Clock;->getContext()Landroid/content/Context;[/LEFT]
 
 
 
[LEFT]     move-result-object v3[/LEFT]
 
 
 
[LEFT]     .line 201[/LEFT]
 
[LEFT]     .local v3, context:Landroid/content/Context;[/LEFT]
 
[LEFT]     invoke-static {v3}, Landroid/text/format/DateFormat;->is24HourFormat(Landroid/content/Context;)Z[/LEFT]
 
 
 
 
 
 
 
[LEFT]     move-result v2[/LEFT]
 
 
 
[LEFT]     invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;[/LEFT]
 
 
 
[LEFT]     move-result-object v0[/LEFT]
 
 
 
[LEFT]    .line 37[/LEFT]
 
[LEFT]    .local v0, cal:Ljava/util/Calendar;[/LEFT]
 
 
 
 
 
[LEFT]    .line 38[/LEFT]
 
[LEFT]    .local v2, h:Z[/LEFT]
 
[LEFT]    const/4 v3, 0x0[/LEFT]
 
 
 
 
 
 
 
[LEFT]    .line 40[/LEFT]
 
[LEFT]    .local v3, sdf:Ljava/text/SimpleDateFormat;[/LEFT]
 
[LEFT]    if-nez v2, :cond_0[/LEFT]
 
 
 
 
 
 
 
[LEFT]    .line 41[/LEFT]
 
[LEFT]    new-instance v3, Ljava/text/SimpleDateFormat;[/LEFT]
 
 
 
 
 
[LEFT]    .end local v3           #sdf:Ljava/text/SimpleDateFormat;[/LEFT]
 
[LEFT]    const-string v5, "h:mm"[/LEFT]
 
 
 
 
 
[LEFT]    invoke-direct {v3, v5}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V[/LEFT]
 
 
 
[LEFT]    .line 46[/LEFT]
 
[LEFT]    .restart local v3       #sdf:Ljava/text/SimpleDateFormat;[/LEFT]
 
 
 
 
[LEFT]   :goto_0[/LEFT]
 
[LEFT]    invoke-virtual {v0}, Ljava/util/Calendar;->getTime()Ljava/util/Date;[/LEFT]
 
 
 
[LEFT]    move-result-object v5[/LEFT]
 
 
 
[LEFT]    invoke-virtual {v3, v5}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;[/LEFT]
 
 
 
[LEFT]    move-result-object v1[/LEFT]
 
 
 
[LEFT]    .line 47[/LEFT]
 
[LEFT]    .local v1, dte:Ljava/lang/String;[/LEFT]
 
 
 
 
 
[LEFT]   invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/policy/Clock;->setText(Ljava/lang/CharSequence;)V[/LEFT]
 
 
 
 
[LEFT]    return-void[/LEFT]
 
 
 
[LEFT]    .line 43[/LEFT]
 
[LEFT]    .end local v1           #dte:Ljava/lang/String;[/LEFT]
 
[LEFT]    :cond_0[/LEFT]
 
 
 
 
 
 
 
[LEFT]    new-instance v3, Ljava/text/SimpleDateFormat;[/LEFT]
 
 
 
[LEFT]    .end local v3           #sdf:Ljava/text/SimpleDateFormat;[/LEFT]
 
 
 
[LEFT]    const-string v5, "HH:mm"[/LEFT]
 
 
 
[LEFT]    invoke-direct {v3, v5}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V[/LEFT]
 
 
 
[LEFT]    .restart local v3       #sdf:Ljava/text/SimpleDateFormat;[/LEFT]
 
[LEFT]    goto :goto_0[/LEFT]
 
 
 
 
 
[LEFT].end method[/LEFT]

7. Save both files and close Notepad++
8. Hold shift key and right click folder again.
9. Type apktool b SystemUI nSystemUI.apk this will make a file called nSystemUI.apk
10. Open both files with 7zip and copy META-INF and AndroidManifest.xml form original apk to new apk
11. Flash, Enjoy and hit the thanks button.​

Sorry for messy code. It changes the formatting when i post on here. Its good practice to keep code tidy:)

The attached apk is finished and is based on XXELL5. It has the theming show in screenshot.
 

Attachments

Last edited:

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
Very nice, thank you for this.
I've tried porting over the am/pm and clock toggles to our phone but haven't had any success. Would you or anyone happen to know how to just disable the am/pm without the toggle mod (JB 4.1.2)?
 
Last edited:

gharrington

Senior Member
Apr 30, 2012
3,013
12,756
263
Brisbane
Very nice, thank you for this.
I've tried porting over the am/pm and clock toggles to our phone but haven't had any success. Would you or anyone happen to know how to just disable the am/pm without the toggle mod (JB 4.1.2)?
I will try write somthing up for you soon:). I am going to add this as a toggle option in settings in a future rom so i will have to do it soon anyway.
 
Last edited:

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
No ampm Guide available in post #2​
Ok, this is going to be fun to port over. My method section is completely different. I'm d/ling the stock LL5 rom to run a diff on clock.smali to see the changes. Thanks for all the help and going to the trouble of doing this btw. :)
 

royalh

Senior Member
Feb 25, 2006
549
196
73
Portland
10. Open both files with 7zip and copy META-INF and AndroidManifest.xml form original apk to new apk
Quick question. . Why are you replacing the meta-inf and AndroidManifest.xml from the original apk into the newly compiled apk? I've never done that and my sysui seems to work fine (I'm a noob so pardon me if this is a lame question lol)

Sent from my giant i317 Pocket Monster
 

gharrington

Senior Member
Apr 30, 2012
3,013
12,756
263
Brisbane
Quick question. . Why are you replacing the meta-inf and AndroidManifest.xml from the original apk into the newly compiled apk? I've never done that and my sysui seems to work fine (I'm a noob so pardon me if this is a lame question lol)

Sent from my giant i317 Pocket Monster
META-INF is to sign apk AndroidManifest.xml is just good practice helps to ilimnate problems from de/recompile.

Sent from my GT-I9300 using xda premium
 
Last edited:

iXanza

Recognized Contributor
Apr 26, 2011
3,791
2,407
253
Subang Jaya
Could I request a guide, if you may. I want to keep the AM/PM in my status bar but remove it from the pulldown. Something AOKP ROMs have.
 

gharrington

Senior Member
Apr 30, 2012
3,013
12,756
263
Brisbane
4.1.2. Thanks mate.
Here mate there are many ways to do it but this is the easiest!
1. Decompile .apk and open clock.smali with notepad++
2. Search for const/high16 v7, 0x3f00 in updateClock()V .method and add this directly under it.

Code:
  iget-boolean v11, p0, Lcom/android/systemui/statusbar/policy/Clock;->mExpandedHeader:Z
 
 
 
  if-eqz v11, :cond_n1
 
 
 
 
 
 
  const/high16 v7, 0x0
 
 
 
 :cond_n1

3. Recompile (remember to copy over META-INF from original .apk to new one) and zipalign.
 
Last edited: