aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Bird <sbird@cyngn.com>2016-06-13 15:17:04 -0700
committerStephen Bird <sbird@cyngn.com>2016-07-28 10:56:36 -0700
commit65407c7d8a399ad9b37fd4b871462155f4384898 (patch)
tree3cef5e5cc345bccc019e0baef5c9b569792b55ba /src
parentfdc1069ce5f040f1bf0610b48a5ab65ee15c9ef3 (diff)
downloadandroid_packages_apps_LockClock-65407c7d8a399ad9b37fd4b871462155f4384898.tar.gz
android_packages_apps_LockClock-65407c7d8a399ad9b37fd4b871462155f4384898.tar.bz2
android_packages_apps_LockClock-65407c7d8a399ad9b37fd4b871462155f4384898.zip
AM/PM: Fix incorrect am/pm text
When rolling over from AM to PM (or vice versa) the text will show the incorrect time eg: At 12:00 AM the clock will still show 12:00 PM At 12:00 PM the clock will show 12:00 AM This switches our time period to the TextClock for >= API 17 so that we can get the correct time period. This also cleans up the regular am/pm textview for devices < 17. Change-Id: I09de23a1ea559a570d7cac5ffb7dbe9266f5fb40 Ticket: OPO-767
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/lockclock/ClockWidgetService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/lockclock/ClockWidgetService.java b/src/com/cyanogenmod/lockclock/ClockWidgetService.java
index 9208cd3..ced9d8f 100644
--- a/src/com/cyanogenmod/lockclock/ClockWidgetService.java
+++ b/src/com/cyanogenmod/lockclock/ClockWidgetService.java
@@ -236,6 +236,8 @@ public class ClockWidgetService extends IntentService {
String hours = new SimpleDateFormat(getHourFormat(), locale).format(now);
String minutes = new SimpleDateFormat(getString(R.string.widget_12_hours_format_no_ampm_m),
locale).format(now);
+ String amPM = new SimpleDateFormat(getString(R.string.widget_12_hours_format_ampm),
+ locale).format(now);
// Hours
if (Preferences.useBoldFontForHours(this)) {
@@ -261,11 +263,14 @@ public class ClockWidgetService extends IntentService {
} else {
clockViews.setTextViewText(R.id.date, date);
}
+
+ if (!DateFormat.is24HourFormat(this) && Preferences.showAmPmIndicator(this)) {
+ clockViews.setTextViewText(R.id.clock_ampm, amPM);
+ }
}
private void refreshClockFont(RemoteViews clockViews, boolean smallWidget) {
int color = Preferences.clockFontColor(this);
- String amPM = new SimpleDateFormat("a", Locale.getDefault()).format(new Date());
// Hours
if (Preferences.useBoldFontForHours(this)) {
@@ -292,7 +297,6 @@ public class ClockWidgetService extends IntentService {
// Show the AM/PM indicator
if (!DateFormat.is24HourFormat(this) && Preferences.showAmPmIndicator(this)) {
clockViews.setViewVisibility(R.id.clock_ampm, View.VISIBLE);
- clockViews.setTextViewText(R.id.clock_ampm, amPM);
clockViews.setTextColor(R.id.clock_ampm, color);
} else {
clockViews.setViewVisibility(R.id.clock_ampm, View.GONE);