recheck week day letters in MonthView at updating items

This commit is contained in:
tibbi 2018-03-24 18:56:21 +01:00
parent 503d941d65
commit f59933564e
1 changed files with 9 additions and 4 deletions

View File

@ -41,14 +41,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
} }
weekDaysLetterHeight = 2 * normalTextSize.toInt() weekDaysLetterHeight = 2 * normalTextSize.toInt()
dayLetters = context.resources.getStringArray(R.array.week_day_letters).toList() as ArrayList<String> initWeekDayLetters()
if (context.config.isSundayFirst) {
dayLetters.moveLastItemToFront()
}
} }
fun updateDays(newDays: ArrayList<DayMonthly>) { fun updateDays(newDays: ArrayList<DayMonthly>) {
days = newDays days = newDays
initWeekDayLetters()
invalidate() invalidate()
} }
@ -112,4 +110,11 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
curPaint.color = paintColor curPaint.color = paintColor
return curPaint return curPaint
} }
private fun initWeekDayLetters() {
dayLetters = context.resources.getStringArray(R.array.week_day_letters).toList() as ArrayList<String>
if (context.config.isSundayFirst) {
dayLetters.moveLastItemToFront()
}
}
} }