From 729ff88de5576b910b66c1262f00d455c589e3c9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 May 2018 23:40:10 +0200 Subject: [PATCH] avoid constantly recreating the event list --- .../simplemobiletools/calendar/fragments/EventListFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 d38dc7433..764205552 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt @@ -34,6 +34,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { private var mEvents = ArrayList() private var minFetchedTS = 0 private var maxFetchedTS = 0 + private var wereInitialEventsAdded = false private var use24HourFormat = false @@ -64,6 +65,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { use24HourFormat = use24Hour (mView.calendar_events_list.adapter as? EventListAdapter)?.toggle24HourFormat(use24HourFormat) } + wereInitialEventsAdded = true } override fun onPause() { @@ -81,7 +83,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { maxFetchedTS += FETCH_INTERVAL context!!.dbHelper.getEvents(minFetchedTS, maxFetchedTS) { mEvents = it - receivedEvents(mEvents, false, true) + receivedEvents(mEvents, false, !wereInitialEventsAdded) } } }