From dd39f9e7ca7fc1bfcf58b917a9ed0c209a4da8cf Mon Sep 17 00:00:00 2001 From: Kazuhiro Ito Date: Thu, 25 Nov 2021 00:49:50 +0900 Subject: [PATCH] Highlight weekends in printed matter too --- .../calendar/pro/fragments/WeekFragment.kt | 13 +++++-------- .../calendar/pro/views/MonthView.kt | 11 ++++------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index c83d1b4be..0273b23fc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -220,14 +220,11 @@ class WeekFragment : Fragment(), WeeklyCalendar { val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList val dayLetter = dayLetters[curDay.dayOfWeek - 1] - val textColor = if (isPrintVersion) { - resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color) - } else if (todayCode == dayCode) { - primaryColor - } else if (highlightWeekends && isWeekend(curDay.dayOfWeek)) { - config.highlightWeekendsColor - } else { - requireContext().getProperTextColor() + val textColor = when { + !isPrintVersion && todayCode == dayCode -> primaryColor + highlightWeekends && isWeekend(curDay.dayOfWeek) -> config.highlightWeekendsColor + isPrintVersion -> resources.getColor(com.simplemobiletools.commons.R.color.theme_light_text_color) + else -> requireContext().getProperTextColor() } val label = WeeklyViewDayLetterBinding.inflate(layoutInflater, binding.weekLettersHolder, false).root diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 3c9432024..375133716 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -329,13 +329,10 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con } private fun getTextPaint(startDay: DayMonthly): Paint { - var paintColor = textColor - if (!isPrintVersion) { - if (startDay.isToday) { - paintColor = primaryColor.getContrastColor() - } else if (highlightWeekends && startDay.isWeekend) { - paintColor = weekendsTextColor - } + var paintColor = when { + !isPrintVersion && startDay.isToday -> primaryColor.getContrastColor() + highlightWeekends && startDay.isWeekend -> weekendsTextColor + else -> textColor } if (!startDay.isThisMonth) {