From 2d4ea903d15d6dcfd6f0649bb620e5338c07c535 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 28 Mar 2018 23:16:50 +0200 Subject: [PATCH] fix #23, sort week days at the edit alarm dialog properly with sunday as first day --- .../simplemobiletools/clock/dialogs/EditAlarmDialog.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt index 836f3012..153db725 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt @@ -48,14 +48,15 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba edit_alarm_label.setText(alarm.label) val dayLetters = activity.resources.getStringArray(R.array.week_day_letters).toList() as ArrayList + val dayIndexes = arrayListOf(0, 1, 2, 3, 4, 5, 6) if (activity.config.isSundayFirst) { - dayLetters.moveLastItemToFront() + dayIndexes.moveLastItemToFront() } - for (i in 0..6) { - val pow = Math.pow(2.0, i.toDouble()).toInt() + dayIndexes.forEach { + val pow = Math.pow(2.0, it.toDouble()).toInt() val day = activity.layoutInflater.inflate(R.layout.alarm_day, edit_alarm_days_holder, false) as TextView - day.text = dayLetters[i] + day.text = dayLetters[it] val isDayChecked = alarm.days and pow != 0 day.background = getProperDayDrawable(isDayChecked)