mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-22 06:56:46 +01:00
mark current day on weekly view with primary color
This commit is contained in:
parent
759beb985b
commit
48cd9b608e
@ -23,6 +23,7 @@ import com.simplemobiletools.calendar.models.Event
|
|||||||
import com.simplemobiletools.calendar.views.MyScrollView
|
import com.simplemobiletools.calendar.views.MyScrollView
|
||||||
import kotlinx.android.synthetic.main.fragment_week.*
|
import kotlinx.android.synthetic.main.fragment_week.*
|
||||||
import kotlinx.android.synthetic.main.fragment_week.view.*
|
import kotlinx.android.synthetic.main.fragment_week.view.*
|
||||||
|
import org.joda.time.DateTime
|
||||||
import kotlin.comparisons.compareBy
|
import kotlin.comparisons.compareBy
|
||||||
|
|
||||||
class WeekFragment : Fragment(), WeeklyCalendar {
|
class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
@ -97,11 +98,13 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||||||
private fun setupDayLabels() {
|
private fun setupDayLabels() {
|
||||||
var curDay = Formatter.getDateTimeFromTS(mWeekTimestamp)
|
var curDay = Formatter.getDateTimeFromTS(mWeekTimestamp)
|
||||||
val textColor = context.config.textColor
|
val textColor = context.config.textColor
|
||||||
|
val todayCode = Formatter.getDayCodeFromDateTime(DateTime())
|
||||||
for (i in 0..6) {
|
for (i in 0..6) {
|
||||||
|
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
|
||||||
val dayLetter = getDayLetter(curDay.dayOfWeek)
|
val dayLetter = getDayLetter(curDay.dayOfWeek)
|
||||||
(mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView).apply {
|
(mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView).apply {
|
||||||
text = "$dayLetter\n${curDay.dayOfMonth}"
|
text = "$dayLetter\n${curDay.dayOfMonth}"
|
||||||
setTextColor(textColor)
|
setTextColor(if (todayCode == dayCode) context.config.primaryColor else textColor)
|
||||||
}
|
}
|
||||||
curDay = curDay.plusDays(1)
|
curDay = curDay.plusDays(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user