optimize monthly layout drawing
This commit is contained in:
parent
381b2bc999
commit
b8f53d97c2
|
@ -18,6 +18,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
|
|||
|
||||
private val mToday: String = DateTime().toString(Formatter.DAYCODE_PATTERN)
|
||||
private var mEvents = ArrayList<Event>()
|
||||
private var days = ArrayList<DayMonthly>(DAYS_CNT)
|
||||
var mFilterEventTypes = true
|
||||
|
||||
lateinit var mTargetDate: DateTime
|
||||
|
@ -37,8 +38,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
|
|||
}
|
||||
|
||||
fun getDays() {
|
||||
val days = ArrayList<DayMonthly>(DAYS_CNT)
|
||||
|
||||
if (days.isEmpty()) {
|
||||
val currMonthDays = mTargetDate.dayOfMonth().maximumValue
|
||||
var firstDayIndex = mTargetDate.withDayOfMonth(1).dayOfWeek
|
||||
if (!mContext.config.isSundayFirst)
|
||||
|
@ -76,9 +76,14 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
|
|||
days.add(day)
|
||||
value++
|
||||
}
|
||||
}
|
||||
|
||||
if (mEvents.isEmpty()) {
|
||||
mCallback.updateMonthlyCalendar(monthName, days)
|
||||
} else {
|
||||
markDaysWithEvents(days)
|
||||
}
|
||||
}
|
||||
|
||||
// it works more often than not, dont touch
|
||||
private fun markDaysWithEvents(days: ArrayList<DayMonthly>) {
|
||||
|
|
Loading…
Reference in New Issue