diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt index 236e2cd0b..447aac5e5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt @@ -20,7 +20,7 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.views.MyRecyclerView import kotlinx.android.synthetic.main.event_list_item.view.* -class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : +class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, recyclerView: MyRecyclerView, var dayCode: String, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private val allDayString = resources.getString(R.string.all_day) @@ -77,7 +77,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r } else { activity.getProperTextColor() } - + notifyDataSetChanged() } @@ -89,7 +89,15 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r event_item_title.checkViewStrikeThrough(event.isTaskCompleted()) event_item_time.text = if (event.getIsAllDay()) allDayString else Formatter.getTimeFromTS(context, event.startTS) if (event.startTS != event.endTS && !event.getIsAllDay()) { - event_item_time.text = "${event_item_time.text} - ${Formatter.getTimeFromTS(context, event.endTS)}" + val startDayCode = Formatter.getDayCodeFromTS(event.startTS) + val endDayCode = Formatter.getDayCodeFromTS(event.endTS) + val startDate = Formatter.getDayTitle(activity, startDayCode, false) + val endDate = Formatter.getDayTitle(activity, endDayCode, false) + val startTimeString = event_item_time.text + val endTimeString = Formatter.getTimeFromTS(context, event.endTS) + val startDayString = if (startDayCode != dayCode) " ($startDate)" else "" + val endDayString = if (endDayCode != dayCode) " ($endDate)" else "" + event_item_time.text = "$startTimeString$startDayString - $endTimeString$endDayString" } event_item_description.text = if (replaceDescriptionWithLocation) event.location else event.description.replace("\n", " ") @@ -103,7 +111,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r } else { dimPastEvents && event.isPastEvent && !isPrintVersion } - + if (adjustAlpha) { newTextColor = newTextColor.adjustAlpha(MEDIUM_ALPHA) } @@ -119,7 +127,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r } else { mediumMargin } - + (event_item_title.layoutParams as ConstraintLayout.LayoutParams).marginStart = startMargin } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt index 9fa293f48..eb448b089 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt @@ -112,7 +112,7 @@ class DayFragment : Fragment() { if (activity == null) return - DayEventsAdapter(activity as SimpleActivity, events, mHolder.day_events) { + DayEventsAdapter(activity as SimpleActivity, events, mHolder.day_events, mDayCode) { editEvent(it as Event) }.apply { mHolder.day_events.adapter = this