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

Commit ae8bcce1 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Alarm: Bind start-of-week to the locale

Instead of relying on a manual setting that's only initialized once
with the bootstrap/post-setupwizard locale, dynamically bind the
days-of-week order to the active locale, in real time.

Change-Id: Ied25a867241a3269a7e69e16c3038c87cf5d2aa9
JIRA: CYNGNOS-1822
parent a1de334a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -298,6 +298,12 @@ public class SettingsActivity extends BaseActivity {
            weekStartPref.setSummary(weekStartPref.getEntries()[idx]);
            weekStartPref.setOnPreferenceChangeListener(this);

            // Remove this. We're dynamically binding week start to the locale, but
            // piggybacking on the backing code for this setting
            PreferenceCategory alrmCategory = (PreferenceCategory)
                    getPreferenceScreen().findPreference(KEY_ALARM_SETTINGS);
            alrmCategory.removePreference(alrmCategory.findPreference(KEY_WEEK_START));

            final SwitchPreference showAlarmIconPref =
                    (SwitchPreference) findPreference(KEY_SHOW_ALARM_ICON);
            showAlarmIconPref.setOnPreferenceChangeListener(this);
+1 −3
Original line number Diff line number Diff line
@@ -745,9 +745,7 @@ public class Utils {
    // Return the first day of the week value corresponding to Calendar.<WEEKDAY> value, which is
    // 1-indexed starting with Sunday.
    public static int getFirstDayOfWeek(Context context) {
        return Integer.parseInt(PreferenceManager
                .getDefaultSharedPreferences(context)
                .getString(SettingsActivity.KEY_WEEK_START, String.valueOf(DEFAULT_WEEK_START)));
        return Calendar.getInstance(Locale.getDefault()).getFirstDayOfWeek();
    }

    // Return the first day of the week value corresponding to a week with Sunday at 0 index.