use the first events color at the monthly daily views dot

This commit is contained in:
tibbi 2021-02-23 09:56:44 +01:00
parent 92b8a521d2
commit 77e4fcde1e
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,5 @@
package com.simplemobiletools.calendar.pro.fragments
import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.os.Handler
@ -10,13 +9,10 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.EventActivity
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.adapters.EventListAdapter
import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.helpers.EVENT_ID
import com.simplemobiletools.calendar.pro.helpers.EVENT_OCCURRENCE_TS
import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.ListEvent

View File

@ -165,7 +165,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
if (isMonthDayView && day.dayEvents.isNotEmpty()) {
getCirclePaint(day).getTextBounds(dayNumber, 0, dayNumber.length, dayTextRect)
val height = dayTextRect.height() * 1.15f
canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getCirclePaint(day))
canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getDayEventColor(day.dayEvents.first()))
}
canvas.drawText(dayNumber, xPosCenter, yPos + textPaint.textSize, getTextPaint(day))
@ -329,6 +329,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
return curPaint
}
private fun getDayEventColor(event: Event): Paint {
val curPaint = Paint(Paint.ANTI_ALIAS_FLAG)
curPaint.color = event.color
return curPaint
}
private fun initWeekDayLetters() {
dayLetters = context.resources.getStringArray(R.array.week_day_letters).toMutableList() as ArrayList<String>
if (config.isSundayFirst) {