From 40ac88dc836a560bd44b2fe0cdf9382494945f08 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 26 Mar 2018 14:09:21 +0200 Subject: [PATCH] small cleanup at MonthView --- .../com/simplemobiletools/calendar/views/MonthView.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/views/MonthView.kt index 362da75e0..869a0a349 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/views/MonthView.kt @@ -169,6 +169,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con val bgLeft = xPos + smallPadding val bgTop = backgroundY + smallPadding - eventTitleHeight var bgRight = xPos - smallPadding + dayWidth * event.daysCnt + val bgBottom = backgroundY + smallPadding * 2 if (bgRight > canvas.width.toFloat()) { bgRight = canvas.width.toFloat() - smallPadding val newStartDayIndex = (event.startDayIndex / 7 + 1) * 7 @@ -176,11 +177,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con drawEvent(newEvent, canvas) } - val bgBottom = backgroundY + smallPadding * 2 + val startDayIndex = days[event.originalStartDayIndex] + val endDayIndex = days[event.startDayIndex + event.daysCnt - 1] bgRectF.set(bgLeft, bgTop, bgRight, bgBottom) - canvas.drawRoundRect(bgRectF, BG_CORNER_RADIUS, BG_CORNER_RADIUS, getEventBackgroundColor(event, days[event.originalStartDayIndex], days[event.startDayIndex + event.daysCnt - 1])) + canvas.drawRoundRect(bgRectF, BG_CORNER_RADIUS, BG_CORNER_RADIUS, getEventBackgroundColor(event, startDayIndex, endDayIndex)) - drawEventTitle(event.title, canvas, xPos, yPos + verticalOffset, bgRight - bgLeft, event.color, days[event.originalStartDayIndex], days[event.startDayIndex + event.daysCnt - 1]) + drawEventTitle(event.title, canvas, xPos, yPos + verticalOffset, bgRight - bgLeft, event.color, startDayIndex, endDayIndex) dayVerticalOffsets.put(event.startDayIndex, verticalOffset + eventTitleHeight + smallPadding * 2) for (i in 0 until event.daysCnt) {