From 771f3af0598851f771902d2161b20af8d0a5c774 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 5 May 2018 23:07:23 +0200 Subject: [PATCH] do not scroll the event list anywhere, if the first event is already today/future --- .../calendar/adapters/EventListAdapter.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt index 04c5a94ab..d6d694cc2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt @@ -39,17 +39,19 @@ class EventListAdapter(activity: SimpleActivity, val listItems: ArrayList - if (firstNonPastSectionIndex == 0 && listItem is ListSection) { + if (firstNonPastSectionIndex == -1 && listItem is ListSection) { if (!listItem.isPastSection) { firstNonPastSectionIndex = index } } } - activity.runOnUiThread { - recyclerView.scrollToPosition(firstNonPastSectionIndex) + if (firstNonPastSectionIndex != -1) { + activity.runOnUiThread { + recyclerView.scrollToPosition(firstNonPastSectionIndex) + } } }