do not scroll the event list anywhere, if the first event is already today/future
This commit is contained in:
parent
9dad0d789c
commit
771f3af059
|
@ -39,19 +39,21 @@ class EventListAdapter(activity: SimpleActivity, val listItems: ArrayList<ListIt
|
||||||
private var use24HourFormat = activity.config.use24HourFormat
|
private var use24HourFormat = activity.config.use24HourFormat
|
||||||
|
|
||||||
init {
|
init {
|
||||||
var firstNonPastSectionIndex = 0
|
var firstNonPastSectionIndex = -1
|
||||||
listItems.forEachIndexed { index, listItem ->
|
listItems.forEachIndexed { index, listItem ->
|
||||||
if (firstNonPastSectionIndex == 0 && listItem is ListSection) {
|
if (firstNonPastSectionIndex == -1 && listItem is ListSection) {
|
||||||
if (!listItem.isPastSection) {
|
if (!listItem.isPastSection) {
|
||||||
firstNonPastSectionIndex = index
|
firstNonPastSectionIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (firstNonPastSectionIndex != -1) {
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
recyclerView.scrollToPosition(firstNonPastSectionIndex)
|
recyclerView.scrollToPosition(firstNonPastSectionIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_event_list
|
override fun getActionMenuId() = R.menu.cab_event_list
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue