mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
fix events touching 2 years
This commit is contained in:
@@ -6,7 +6,7 @@ import com.simplemobiletools.calendar.models.Event
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import java.util.*
|
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) {
|
fun getEvents(year: Int) {
|
||||||
val startDateTime = DateTime().withTime(0, 0, 0, 0).withDate(year, 1, 1)
|
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)
|
if (arr[month] == null)
|
||||||
arr.put(month, ArrayList<Int>())
|
arr.put(month, ArrayList<Int>())
|
||||||
|
|
||||||
arr.get(month).add(day)
|
if (dateTime.year == year)
|
||||||
|
arr.get(month).add(day)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ class YearFragment : Fragment(), YearlyCalendar {
|
|||||||
mYear = arguments.getInt(Constants.YEAR_LABEL)
|
mYear = arguments.getInt(Constants.YEAR_LABEL)
|
||||||
setupMonths()
|
setupMonths()
|
||||||
|
|
||||||
mCalendar = YearlyCalendarImpl(this, context)
|
mCalendar = YearlyCalendarImpl(this, context, mYear)
|
||||||
|
|
||||||
return mView
|
return mView
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user