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

Commit f7d5e0a5 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Migrate off timeFormat12 and timeFormat24.

libcore now offers a wider variety of 12-/24-hour time formats,
so be more specific about which one we want here.

(cherry-pick of 85f60d3a.)

Bug: 10361358
Change-Id: I846ab7a6f84cd49e876ad21e9366aff1600e0530
parent 04517286
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public class DateFormat {
     */
    public static String getTimeFormatString(Context context) {
        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
        return is24HourFormat(context) ? d.timeFormat24 : d.timeFormat12;
        return is24HourFormat(context) ? d.timeFormat_Hm : d.timeFormat_hm;
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -222,10 +222,10 @@ public class TextClock extends TextView {
        if (mFormat12 == null || mFormat24 == null) {
            LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
            if (mFormat12 == null) {
                mFormat12 = ld.timeFormat12;
                mFormat12 = ld.timeFormat_hm;
            }
            if (mFormat24 == null) {
                mFormat24 = ld.timeFormat24;
                mFormat24 = ld.timeFormat_Hm;
            }
        }

@@ -429,9 +429,9 @@ public class TextClock extends TextView {
        LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);

        if (format24Requested) {
            mFormat = abc(mFormat24, mFormat12, ld.timeFormat24);
            mFormat = abc(mFormat24, mFormat12, ld.timeFormat_Hm);
        } else {
            mFormat = abc(mFormat12, mFormat24, ld.timeFormat12);
            mFormat = abc(mFormat12, mFormat24, ld.timeFormat_hm);
        }

        boolean hadSeconds = mHasSeconds;
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ public class Clock extends TextView implements DemoMode {
        final char MAGIC2 = '\uEF01';

        SimpleDateFormat sdf;
        String format = is24 ? d.timeFormat24 : d.timeFormat12;
        String format = is24 ? d.timeFormat_Hm : d.timeFormat_hm;
        if (!format.equals(mClockFormatString)) {
            /*
             * Search for an unquoted "a" in the format string, so we can