fix #489, mark the current week number at the monthly view
This commit is contained in:
parent
09471a3d11
commit
e6198963cb
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue