summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/format
diff options
context:
space:
mode:
authorEric Fischer <enf@google.com>2009-06-11 13:37:04 -0700
committerEric Fischer <enf@google.com>2009-06-11 13:37:04 -0700
commitaf0e7a7394bf1e2596c46f81c3b0302a56daab96 (patch)
treec9fd4667fbdbdbd5ec9b100c379f7fe6c5efec9f /core/java/android/text/format
parentfa699ea22a13a92694de75ef948a81da23e71642 (diff)
downloadframeworks_base-af0e7a7394bf1e2596c46f81c3b0302a56daab96.zip
frameworks_base-af0e7a7394bf1e2596c46f81c3b0302a56daab96.tar.gz
frameworks_base-af0e7a7394bf1e2596c46f81c3b0302a56daab96.tar.bz2
Hook the 12- or 24-hour time format checkbox back up.
The format strings are newly generated from CLDR. The code is once again the same as in cupcake: do the natural thing for the locale if the user has never specified, but follow the checkbox if the user has ever set it.
Diffstat (limited to 'core/java/android/text/format')
-rw-r--r--core/java/android/text/format/DateFormat.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/text/format/DateFormat.java b/core/java/android/text/format/DateFormat.java
index 3156d8b..963f429 100644
--- a/core/java/android/text/format/DateFormat.java
+++ b/core/java/android/text/format/DateFormat.java
@@ -242,12 +242,21 @@ public class DateFormat {
/**
* Returns a {@link java.text.DateFormat} object that can format the time according
- * to the current locale.
+ * to the current locale and the user's 12-/24-hour clock preference.
* @param context the application context
* @return the {@link java.text.DateFormat} object that properly formats the time.
*/
public static final java.text.DateFormat getTimeFormat(Context context) {
- return java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT);
+ boolean b24 = is24HourFormat(context);
+ int res;
+
+ if (b24) {
+ res = R.string.twenty_four_hour_time_format;
+ } else {
+ res = R.string.twelve_hour_time_format;
+ }
+
+ return new java.text.SimpleDateFormat(context.getString(res));
}
/**