OSDN Git Service

ZenMode rules: Show days list in the correct order
authorLuis Vidal <lvidal@cyngn.com>
Wed, 27 Jul 2016 18:42:45 +0000 (11:42 -0700)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Thu, 28 Jul 2016 16:03:41 +0000 (09:03 -0700)
Populate the days list based on what the first day of the week is
for the current locale. Ex. Sunday is the first item in the
list for US, whereas Monday is for UK

Change-Id: Ib3c03a59cee73cfcd809fb115a5d49e5eb7c2e45
TICKET: CYNGNOS-3181

src/com/android/settings/notification/ZenModeScheduleDaysSelection.java

index 3e88046..a0af03f 100644 (file)
@@ -61,8 +61,9 @@ public class ZenModeScheduleDaysSelection extends ScrollView {
         }
         mLayout.setOrientation(LinearLayout.VERTICAL);
         final Calendar c = Calendar.getInstance();
+        int i = c.getFirstDayOfWeek() - 1;
         final LayoutInflater inflater = LayoutInflater.from(context);
-        for (int i = 0; i < DAYS.length; i++) {
+        for (int d = 0; d < DAYS.length; d++) {
             final int day = DAYS[i];
             final CheckBox checkBox = (CheckBox) inflater.inflate(R.layout.zen_schedule_rule_day,
                     this, false);
@@ -77,6 +78,7 @@ public class ZenModeScheduleDaysSelection extends ScrollView {
                 }
             });
             mLayout.addView(checkBox);
+            i = ++i % DAYS.length;
         }
     }