From 907abbf5cfe6b376a4062926f69103451fa1f785 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Feb 2018 20:03:59 +0100 Subject: [PATCH] fix changing event filters at the Event List view --- .../calendar/fragments/EventListFragment.kt | 8 +------- .../simplemobiletools/calendar/helpers/CalDAVHandler.kt | 5 ++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt index f2c52dc31..0b6a93d10 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt @@ -27,7 +27,6 @@ import java.util.* class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { private var mEvents: List = ArrayList() private var prevEventsHash = 0 - private var lastHash = 0 private var use24HourFormat = false lateinit var mView: View @@ -66,14 +65,9 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { } private fun receivedEvents(events: MutableList) { - if (context == null || activity == null) - return - - val newHash = events.hashCode() - if (newHash == lastHash) { + if (context == null || activity == null) { return } - lastHash = newHash val filtered = context!!.getFilteredEvents(events) val hash = filtered.hashCode() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt index b87db1a5c..6f5cc1a35 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt @@ -17,7 +17,6 @@ import com.simplemobiletools.calendar.models.EventType import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALENDAR -import org.joda.time.DateTimeZone import java.util.* import kotlin.collections.ArrayList @@ -197,7 +196,7 @@ class CalDAVHandler(val context: Context) { val fetchedEventIds = ArrayList() val existingEvents = context.dbHelper.getEventsFromCalDAVCalendar(calendarId) existingEvents.forEach { - importIdsMap.put(it.importId, it) + importIdsMap[it.importId] = it } val uri = CalendarContract.Events.CONTENT_URI @@ -283,7 +282,7 @@ class CalDAVHandler(val context: Context) { if (title.isNotEmpty()) { context.dbHelper.insert(event, false) { - importIdsMap.put(event.importId, event) + importIdsMap[event.importId] = event } } }