fix changing event filters at the Event List view

This commit is contained in:
tibbi 2018-02-18 20:03:59 +01:00
parent 492ab31ce0
commit 907abbf5cf
2 changed files with 3 additions and 10 deletions

View File

@ -27,7 +27,6 @@ import java.util.*
class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
private var mEvents: List<Event> = ArrayList() private var mEvents: List<Event> = ArrayList()
private var prevEventsHash = 0 private var prevEventsHash = 0
private var lastHash = 0
private var use24HourFormat = false private var use24HourFormat = false
lateinit var mView: View lateinit var mView: View
@ -66,14 +65,9 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
} }
private fun receivedEvents(events: MutableList<Event>) { private fun receivedEvents(events: MutableList<Event>) {
if (context == null || activity == null) if (context == null || activity == null) {
return
val newHash = events.hashCode()
if (newHash == lastHash) {
return return
} }
lastHash = newHash
val filtered = context!!.getFilteredEvents(events) val filtered = context!!.getFilteredEvents(events)
val hash = filtered.hashCode() val hash = filtered.hashCode()

View File

@ -17,7 +17,6 @@ import com.simplemobiletools.calendar.models.EventType
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALENDAR import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALENDAR
import org.joda.time.DateTimeZone
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -197,7 +196,7 @@ class CalDAVHandler(val context: Context) {
val fetchedEventIds = ArrayList<String>() val fetchedEventIds = ArrayList<String>()
val existingEvents = context.dbHelper.getEventsFromCalDAVCalendar(calendarId) val existingEvents = context.dbHelper.getEventsFromCalDAVCalendar(calendarId)
existingEvents.forEach { existingEvents.forEach {
importIdsMap.put(it.importId, it) importIdsMap[it.importId] = it
} }
val uri = CalendarContract.Events.CONTENT_URI val uri = CalendarContract.Events.CONTENT_URI
@ -283,7 +282,7 @@ class CalDAVHandler(val context: Context) {
if (title.isNotEmpty()) { if (title.isNotEmpty()) {
context.dbHelper.insert(event, false) { context.dbHelper.insert(event, false) {
importIdsMap.put(event.importId, event) importIdsMap[event.importId] = event
} }
} }
} }