do not scroll the event list anywhere, if the first event is already today/future

This commit is contained in:
tibbi 2018-05-05 23:07:23 +02:00
parent 9dad0d789c
commit 771f3af059
1 changed files with 6 additions and 4 deletions

View File

@ -39,19 +39,21 @@ class EventListAdapter(activity: SimpleActivity, val listItems: ArrayList<ListIt
private var use24HourFormat = activity.config.use24HourFormat
init {
var firstNonPastSectionIndex = 0
var firstNonPastSectionIndex = -1
listItems.forEachIndexed { index, listItem ->
if (firstNonPastSectionIndex == 0 && listItem is ListSection) {
if (firstNonPastSectionIndex == -1 && listItem is ListSection) {
if (!listItem.isPastSection) {
firstNonPastSectionIndex = index
}
}
}
if (firstNonPastSectionIndex != -1) {
activity.runOnUiThread {
recyclerView.scrollToPosition(firstNonPastSectionIndex)
}
}
}
override fun getActionMenuId() = R.menu.cab_event_list