fix #23, sort week days at the edit alarm dialog properly with sunday as first day

This commit is contained in:
tibbi 2018-03-28 23:16:50 +02:00
parent 3dd7ffddc5
commit 2d4ea903d1
1 changed files with 5 additions and 4 deletions

View File

@ -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<String>
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)