fix #270, make sure events on monthly view are sorted by time

This commit is contained in:
tibbi 2017-11-13 11:09:50 +01:00
parent 3a14475004
commit 5c33927754
2 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ ext {
}
dependencies {
compile 'com.simplemobiletools:commons:2.38.9'
compile 'com.simplemobiletools:commons:2.38.10'
compile 'joda-time:joda-time:2.9.9'
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View File

@ -294,11 +294,11 @@ private fun addTodaysBackground(textView: TextView, res: Resources, dayLabelHeig
textView.addResizedBackgroundDrawable(res, dayLabelHeight, mPrimaryColor, R.drawable.monthly_today_circle)
fun Context.addDayEvents(day: DayMonthly, linearLayout: LinearLayout, res: Resources, dividerMargin: Int) {
day.dayEvents.forEach {
val backgroundDrawable = res.getDrawable(R.drawable.day_monthly_event_background)
backgroundDrawable.mutate().setColorFilter(it.color, PorterDuff.Mode.SRC_IN)
val backgroundDrawable = res.getDrawable(R.drawable.day_monthly_event_background)
val eventLayoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
val eventLayoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
day.dayEvents.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title })).forEach {
backgroundDrawable.mutate().setColorFilter(it.color, PorterDuff.Mode.SRC_IN)
eventLayoutParams.setMargins(dividerMargin, 0, dividerMargin, dividerMargin)
var textColor = it.color.getContrastColor()