make sure the events in day view are sorted by start time
This commit is contained in:
parent
ff1e2e3bb9
commit
8e4388c749
|
@ -25,6 +25,7 @@ import com.simplemobiletools.calendar.models.Event
|
|||
import kotlinx.android.synthetic.main.day_fragment.view.*
|
||||
import kotlinx.android.synthetic.main.top_navigation.view.*
|
||||
import java.util.*
|
||||
import kotlin.comparisons.compareBy
|
||||
|
||||
class DayFragment : Fragment(), DBHelper.EventsListener, AdapterView.OnItemClickListener, AbsListView.MultiChoiceModeListener, DBHelper.GetEventsListener {
|
||||
|
||||
|
@ -232,8 +233,9 @@ class DayFragment : Fragment(), DBHelper.EventsListener, AdapterView.OnItemClick
|
|||
}
|
||||
|
||||
override fun gotEvents(events: MutableList<Event>) {
|
||||
val sorted = ArrayList<Event>(events.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { it.description })))
|
||||
activity?.runOnUiThread {
|
||||
updateEvents(events)
|
||||
updateEvents(sorted)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class EventListFragment : Fragment(), DBHelper.GetEventsListener, AdapterView.On
|
|||
override fun gotEvents(events: MutableList<Event>) {
|
||||
val filtered = getEventsToShow(events)
|
||||
mListItems = ArrayList<ListItem>(filtered.size)
|
||||
val sorted = filtered.sortedWith(compareBy({ it.startTS }, { it.endTS }))
|
||||
val sorted = filtered.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { it.description }))
|
||||
var prevCode = ""
|
||||
sorted.forEach {
|
||||
val code = Formatter.getDayCodeFromTS(it.startTS)
|
||||
|
|
Loading…
Reference in New Issue