use the array of week day letters at the week fragment

This commit is contained in:
tibbi 2018-03-25 20:56:49 +02:00
parent 18d8fe5747
commit 35afd48f42
1 changed files with 3 additions and 13 deletions

View File

@ -143,7 +143,9 @@ class WeekFragment : Fragment(), WeeklyCalendar {
val todayCode = Formatter.getDayCodeFromDateTime(DateTime())
for (i in 0..6) {
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
val dayLetter = getDayLetter(curDay.dayOfWeek)
val dayLetters = mRes.getStringArray(R.array.week_day_letters).toList() as ArrayList<String>
val dayLetter = dayLetters[curDay.dayOfWeek - 1]
mView.findViewById<TextView>(mRes.getIdentifier("week_day_label_$i", "id", context!!.packageName)).apply {
text = "$dayLetter\n${curDay.dayOfMonth}"
setTextColor(if (todayCode == dayCode) primaryColor else textColor)
@ -155,18 +157,6 @@ class WeekFragment : Fragment(), WeeklyCalendar {
}
}
private fun getDayLetter(pos: Int): String {
return mRes.getString(when (pos) {
1 -> R.string.monday_letter
2 -> R.string.tuesday_letter
3 -> R.string.wednesday_letter
4 -> R.string.thursday_letter
5 -> R.string.friday_letter
6 -> R.string.saturday_letter
else -> R.string.sunday_letter
})
}
private fun checkScrollLimits(y: Int) {
if (minScrollY != -1 && y < minScrollY) {
mScrollView.scrollY = minScrollY