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

Commit 19b0da1c authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

alarms: Fix the labels on repeat days

Change I434510a0ad18c33d7e7f856d1db7eaff282d7197 makes everything
index to the locale first-day-of-week... except for the button
labels, which were also hard-indexed to a Sunday. Fixit.

Change-Id: I24bb728277354991c62773737d8d05da7888eb3e
JIRA: CYAN-3347, CYNGNOS-1822
parent 4ffb13d6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -777,11 +777,15 @@ public class Utils {
        final SimpleDateFormat shortFormat = new SimpleDateFormat(DATE_FORMAT_SHORT);
        final SimpleDateFormat longFormat = new SimpleDateFormat(DATE_FORMAT_LONG);

        final int firstDayOfWeek = Calendar.getInstance(Locale.getDefault()).getFirstDayOfWeek();
        final int dayOfWeekOffset = firstDayOfWeek - Calendar.SUNDAY;

        // Create a date (2014/07/20) that is a Sunday
        final long aSunday = new GregorianCalendar(2014, Calendar.JULY, 20).getTimeInMillis();


        for (int i = 0; i < DaysOfWeek.DAYS_IN_A_WEEK; i++) {
            final long dayMillis = aSunday + i * DateUtils.DAY_IN_MILLIS;
            final long dayMillis = aSunday + ( i + dayOfWeekOffset ) * DateUtils.DAY_IN_MILLIS;
            sShortWeekdays[i] = shortFormat.format(new Date(dayMillis));
            sLongWeekdays[i] = longFormat.format(new Date(dayMillis));
        }