mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 12:20:51 +01:00
optimize event getting at month views a bit + fix some glitches
This commit is contained in:
parent
97a6b15430
commit
5943d0991e
@ -88,7 +88,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
||||
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBgColor()
|
||||
|
||||
MonthlyCalendarImpl(this, applicationContext).updateMonthlyCalendar(DateTime(), false)
|
||||
MonthlyCalendarImpl(this, applicationContext).updateMonthlyCalendar(DateTime().withDayOfMonth(1), false)
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
|
@ -72,7 +72,7 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
||||
|
||||
private fun getMonths(code: String): List<String> {
|
||||
val months = ArrayList<String>(PREFILLED_MONTHS)
|
||||
val today = Formatter.getDateTimeFromCode(code)
|
||||
val today = Formatter.getDateTimeFromCode(code).withDayOfMonth(1)
|
||||
for (i in -PREFILLED_MONTHS / 2..PREFILLED_MONTHS / 2) {
|
||||
months.add(Formatter.getDayCodeFromDateTime(today.plusMonths(i)))
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
|
||||
fun updateMonthlyCalendar(targetDate: DateTime, filterEventTypes: Boolean = true) {
|
||||
mFilterEventTypes = filterEventTypes
|
||||
mTargetDate = targetDate
|
||||
val startTS = mTargetDate.minusMonths(1).seconds()
|
||||
val endTS = mTargetDate.plusMonths(1).seconds()
|
||||
val startTS = mTargetDate.minusDays(7).seconds()
|
||||
val endTS = mTargetDate.plusDays(43).seconds()
|
||||
mContext.dbHelper.getEvents(startTS, endTS) {
|
||||
gotEvents(it as ArrayList<Event>)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
private val NEW_EVENT = "new_event"
|
||||
|
||||
companion object {
|
||||
private var targetDate = DateTime.now()
|
||||
private var targetDate = DateTime.now().withDayOfMonth(1)
|
||||
}
|
||||
|
||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user