mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
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,17 +39,19 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.runOnUiThread {
|
if (firstNonPastSectionIndex != -1) {
|
||||||
recyclerView.scrollToPosition(firstNonPastSectionIndex)
|
activity.runOnUiThread {
|
||||||
|
recyclerView.scrollToPosition(firstNonPastSectionIndex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user