From 48cd9b608e54f78c07ed32401f7110622978d8dc Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 3 Feb 2017 21:09:20 +0100 Subject: [PATCH] mark current day on weekly view with primary color --- .../com/simplemobiletools/calendar/fragments/WeekFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 f58f9e9ba..78e56b0ea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt @@ -23,6 +23,7 @@ import com.simplemobiletools.calendar.models.Event import com.simplemobiletools.calendar.views.MyScrollView import kotlinx.android.synthetic.main.fragment_week.* import kotlinx.android.synthetic.main.fragment_week.view.* +import org.joda.time.DateTime import kotlin.comparisons.compareBy class WeekFragment : Fragment(), WeeklyCalendar { @@ -97,11 +98,13 @@ class WeekFragment : Fragment(), WeeklyCalendar { private fun setupDayLabels() { var curDay = Formatter.getDateTimeFromTS(mWeekTimestamp) val textColor = context.config.textColor + val todayCode = Formatter.getDayCodeFromDateTime(DateTime()) for (i in 0..6) { + val dayCode = Formatter.getDayCodeFromDateTime(curDay) val dayLetter = getDayLetter(curDay.dayOfWeek) (mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView).apply { text = "$dayLetter\n${curDay.dayOfMonth}" - setTextColor(textColor) + setTextColor(if (todayCode == dayCode) context.config.primaryColor else textColor) } curDay = curDay.plusDays(1) }