fix events touching 2 years

This commit is contained in:
tibbi 2016-11-03 00:00:30 +01:00
parent 07505a53ab
commit 2e13642217
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import com.simplemobiletools.calendar.models.Event
import org.joda.time.DateTime
import java.util.*
class YearlyCalendarImpl(val callback: YearlyCalendar, val context: Context) : DBHelper.GetEventsListener {
class YearlyCalendarImpl(val callback: YearlyCalendar, val context: Context, val year: Int) : DBHelper.GetEventsListener {
fun getEvents(year: Int) {
val startDateTime = DateTime().withTime(0, 0, 0, 0).withDate(year, 1, 1)
@ -42,6 +42,7 @@ class YearlyCalendarImpl(val callback: YearlyCalendar, val context: Context) : D
if (arr[month] == null)
arr.put(month, ArrayList<Int>())
arr.get(month).add(day)
if (dateTime.year == year)
arr.get(month).add(day)
}
}

View File

@ -27,7 +27,7 @@ class YearFragment : Fragment(), YearlyCalendar {
mYear = arguments.getInt(Constants.YEAR_LABEL)
setupMonths()
mCalendar = YearlyCalendarImpl(this, context)
mCalendar = YearlyCalendarImpl(this, context, mYear)
return mView
}