scroll Event List View to Today by default

This commit is contained in:
tibbi 2018-05-05 21:11:50 +02:00
parent 5c4014c76e
commit 432a624ad1

View File

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