From 35afd48f42171ecdd5c3a31d440a21ee2a486a57 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 25 Mar 2018 20:56:49 +0200 Subject: [PATCH] use the array of week day letters at the week fragment --- .../calendar/fragments/WeekFragment.kt | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt index ab37b8062..661e9656f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt @@ -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 + val dayLetter = dayLetters[curDay.dayOfWeek - 1] + mView.findViewById(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