Skip to content

Commit 195a8cd

Browse files
tristan202randomlyjobless&bored
authored andcommitted
SystemUI: add back date style option (1/2)
* 0 - Regular style * 1 - Lowercase * 2 - Uppercase Change-Id: Ia7773b9754f8c2cb843b9377e4f8dd25f68d7a69 Signed-off-by: randomlyjobless&bored <[email protected]> Conflicts: packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
1 parent 1cf396d commit 195a8cd

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

core/java/android/provider/Settings.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,7 +3517,7 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
35173517
* @hide
35183518
*/
35193519
public static final String STATUS_BAR_AM_PM = "status_bar_am_pm";
3520-
3520+
35213521
/**
35223522
* Shows custom date before clock time
35233523
* 0 - No Date
@@ -3527,12 +3527,21 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
35273527
*/
35283528
public static final String STATUS_BAR_DATE = "status_bar_date";
35293529

3530+
/**
3531+
* Sets the date string style
3532+
* 0 - Regular style
3533+
* 1 - Lowercase
3534+
* 2 - Uppercase
3535+
* @hide
3536+
*/
3537+
public static final String STATUS_BAR_DATE_STYLE = "status_bar_date_style";
3538+
35303539
/**
35313540
* Stores the java DateFormat string for the date
35323541
* @hide
35333542
*/
35343543
public static final String STATUS_BAR_DATE_FORMAT = "status_bar_date_format";
3535-
3544+
35363545
/**
35373546
* Display style of the status bar battery information
35383547
* 0: Display the battery an icon in portrait mode
@@ -3544,23 +3553,15 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
35443553
* @hide
35453554
*/
35463555
public static final String STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style";
3547-
3556+
35483557
/**
35493558
* Sets the date string style
35503559
* 0 - Regular style
35513560
* 1 - Lowercase
35523561
* 2 - Uppercase
35533562
* @hide
35543563
*/
3555-
public static final String STATUS_BAR_DATE_STYLE = "status_bar_date_style";
35563564

3557-
/**
3558-
* Status bar battery %
3559-
* 0: Hide the battery percentage
3560-
* 1: Display the battery percentage inside the icon
3561-
* 2: Display the battery percentage next to the icon
3562-
* @hide
3563-
*/
35643565
public static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
35653566

35663567
/**

packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,19 @@ private final CharSequence getSmallTime() {
242242
Settings.System.STATUS_BAR_DATE_FORMAT);
243243

244244
if (clockDateFormat == null || clockDateFormat.isEmpty()) {
245+
// Set dateString to short uppercase Weekday (Default for AOKP) if empty
245246
dateString = DateFormat.format("EEE", now) + " ";
246247
} else {
247248
dateString = DateFormat.format(clockDateFormat, now) + " ";
248249
}
249-
result = dateString.toString().toLowerCase() + result;
250+
if (mClockDateStyle == CLOCK_DATE_STYLE_LOWERCASE) {
251+
// When Date style is small, convert date to uppercase
252+
result = dateString.toString().toLowerCase() + result;
253+
} else if (mClockDateStyle == CLOCK_DATE_STYLE_UPPERCASE) {
254+
result = dateString.toString().toUpperCase() + result;
255+
} else {
256+
result = dateString.toString() + result;
257+
}
250258
}
251259

252260
SpannableStringBuilder formatted = new SpannableStringBuilder(result);
@@ -341,7 +349,6 @@ void updateSettings() {
341349
mAmPmStyle = (Settings.System.getIntForUser(resolver,
342350
Settings.System.STATUS_BAR_AM_PM, 2, UserHandle.USER_CURRENT));
343351
mClockFormatString = "";
344-
345352
mClockDateDisplay = (Settings.System.getIntForUser(resolver,
346353
Settings.System.STATUS_BAR_DATE,
347354
CLOCK_DATE_DISPLAY_GONE, UserHandle.USER_CURRENT));
@@ -363,9 +370,12 @@ void updateSettings() {
363370

364371
getFontStyle(mClockFontStyle);
365372
mClockView.setTextColor(clockColor);
366-
mClockDateDisplay = Settings.System.getInt(resolver,
373+
mClockDateDisplay = (Settings.System.getIntForUser(resolver,
367374
Settings.System.STATUS_BAR_DATE,
368-
CLOCK_DATE_DISPLAY_GONE);
375+
CLOCK_DATE_DISPLAY_GONE, UserHandle.USER_CURRENT));
376+
mClockDateStyle = (Settings.System.getIntForUser(resolver,
377+
Settings.System.STATUS_BAR_DATE_STYLE, CLOCK_DATE_STYLE_REGULAR,
378+
UserHandle.USER_CURRENT));
369379
updateClock();
370380
}
371381

0 commit comments

Comments
 (0)