simplify the month events getting

This commit is contained in:
tibbi 2017-01-15 21:15:41 +01:00
parent 80dd147799
commit 90c0a34c21
1 changed files with 5 additions and 5 deletions

View File

@ -23,8 +23,8 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
fun updateMonthlyCalendar(targetDate: DateTime) {
mTargetDate = targetDate
val startTS = Formatter.getDayStartTS(Formatter.getDayCodeFromDateTime(mTargetDate.minusMonths(1)))
val endTS = Formatter.getDayEndTS(Formatter.getDayCodeFromDateTime(mTargetDate.plusMonths(1)))
val startTS = (mTargetDate.minusMonths(1).millis / 1000).toInt()
val endTS = (mTargetDate.plusMonths(1).millis / 1000).toInt()
DBHelper(mContext).getEvents(startTS, endTS, this)
}
@ -81,9 +81,9 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
// it works more often than not, dont touch
private fun markDaysWithEvents(days: ArrayList<Day>) {
val eventCodes = ArrayList<String>()
for (event in mEvents) {
val startDateTime = DateTime().withMillis(event.startTS * 1000L)
val endDateTime = DateTime().withMillis(event.endTS * 1000L)
for ((id, startTS, endTS) in mEvents) {
val startDateTime = DateTime().withMillis(startTS * 1000L)
val endDateTime = DateTime().withMillis(endTS * 1000L)
val endCode = Formatter.getDayCodeFromDateTime(endDateTime)
var currDay = startDateTime