fix #489, mark the current week number at the monthly view

This commit is contained in:
tibbi 2018-06-12 22:02:08 +02:00
parent 09471a3d11
commit e6198963cb
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,4 @@
package com.simplemobiletools.calendar.models
data class DayMonthly(val value: Int, val isThisMonth: Boolean, val isToday: Boolean, val code: String, val weekOfYear: Int, var dayEvents: ArrayList<Event>,
var indexOnMonthView: Int) {
}
var indexOnMonthView: Int)

View File

@ -185,10 +185,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
weekNumberPaint.textAlign = Paint.Align.RIGHT
for (i in 0 until ROW_COUNT) {
val weekDays = days.subList(i * 7, i * 7 + 7)
weekNumberPaint.color = if (weekDays.any { it.isToday }) primaryColor else textColor
// fourth day of the week matters
val weekOfYear = days.getOrNull(i * 7 + 3)?.weekOfYear ?: 1
val id = "$weekOfYear:"
val yPos = i * dayHeight + weekDaysLetterHeight
canvas.drawText(id, horizontalOffset.toFloat() * 0.9f, yPos + paint.textSize, weekNumberPaint)
}