Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af0e7a73 authored by Eric Fischer's avatar Eric Fischer
Browse files

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.
parent fa699ea2
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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));
    }

    /**
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@
    <string name="hour_minute_24">%-k:%M</string>
    <string name="hour_minute_ampm">%-l:%M %p</string>
    <string name="hour_minute_cap_ampm">%-l:%M %p</string>
    <string name="twelve_hour_time_format">h:mm a</string>
    <string name="twenty_four_hour_time_format">H:mm</string>
    <string name="numeric_date">%-e/%-m/%Y</string>
    <string name="numeric_date_format">d/M/yyyy</string>
    <string name="month_day_year">%-e %B، %Y</string>
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@
    <string name="hour_minute_24">%-k:%M</string>
    <string name="hour_minute_ampm">%-l:%M %p</string>
    <string name="hour_minute_cap_ampm">%-l:%M %p</string>
    <string name="twelve_hour_time_format">h:mm a</string>
    <string name="twenty_four_hour_time_format">H:mm</string>
    <string name="numeric_date">%d.%m.%Y</string>
    <string name="numeric_date_format">dd.MM.yyyy</string>
    <string name="month_day_year">%d %B %Y</string>
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@
    <string name="hour_minute_24">%-k:%M</string>
    <string name="hour_minute_ampm">%-l:%M %p</string>
    <string name="hour_minute_cap_ampm">%-l:%M %^p</string>
    <string name="twelve_hour_time_format">h:mm a</string>
    <string name="twenty_four_hour_time_format">H:mm</string>
    <string name="numeric_date">%d/%m/%Y</string>
    <string name="numeric_date_format">dd/MM/yyyy</string>
    <string name="month_day_year">%-e de %B de %Y</string>
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@
    <string name="hour_minute_24">%-k:%M</string>
    <string name="hour_minute_ampm">%-l:%M %p</string>
    <string name="hour_minute_cap_ampm">%-l:%M %^p</string>
    <string name="twelve_hour_time_format">h:mm a</string>
    <string name="twenty_four_hour_time_format">H:mm</string>
    <string name="numeric_date">%-e.%-m.%Y</string>
    <string name="numeric_date_format">d.M.yyyy</string>
    <string name="month_day_year">%-e. %B %Y</string>
Loading