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

Commit cbfece82 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Switch over to getting 12-/24-hour time formats from CLDR via icu4c."

parents c8074612 4caba61e
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import java.util.Locale;
import java.util.TimeZone;
import java.text.SimpleDateFormat;

import libcore.icu.LocaleData;

/**
    Utility class for producing strings with formatted date/time.

@@ -265,16 +267,9 @@ public class DateFormat {
     * @return the {@link java.text.DateFormat} object that properly formats the time.
     */
    public static java.text.DateFormat getTimeFormat(Context context) {
        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));
        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
        boolean is24 = is24HourFormat(context);
        return new java.text.SimpleDateFormat(is24 ? d.timeFormat24 : d.timeFormat12);
    }

    /**
+1 −9
Original line number Diff line number Diff line
@@ -189,15 +189,7 @@ public class DateTimeView extends TextView {
    }

    private DateFormat getTimeFormat() {
        int res;
        Context context = getContext();
        if (android.text.format.DateFormat.is24HourFormat(context)) {
            res = R.string.twenty_four_hour_time_format;
        } else {
            res = R.string.twelve_hour_time_format;
        }
        String format = context.getString(res);
        return new SimpleDateFormat(format);
        return android.text.format.DateFormat.getTimeFormat(getContext());
    }

    private DateFormat getDateFormat() {
+0 −2
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@
    <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">%Y/%m/%d</string>
    <string name="numeric_date_format">yyyy/MM/dd</string>
    <string name="numeric_date_template">"%s/%s/%s"</string>
+0 −2
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@
    <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="numeric_date_template">"%s/%s/%s"</string>
+0 −2
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@
    <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="numeric_date_template">"%s/%s/%s"</string>
Loading