From 6d1eddb6cd99c275df97b343f4ce9b631a769c65 Mon Sep 17 00:00:00 2001 From: Doozy Date: Fri, 1 Jul 2022 23:48:27 +0300 Subject: [PATCH] refactoring --- .../calendar/pro/adapters/DayEventsAdapter.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 058f161cb..6519dcaa8 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 @@ -93,14 +93,11 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r if (event.startTS != event.endTS && !event.getIsAllDay()) { val startDayCode = Formatter.getDayCodeFromTS(event.startTS) val endDayCode = Formatter.getDayCodeFromTS(event.endTS) - val startTimePostFix = if (startDayCode != dayCode) Formatter.getDayTitle(activity, startDayCode,false) else null - val endTimePostFix = if (endDayCode != dayCode) Formatter.getDayTitle(activity, endDayCode,false) else null - val timeString = "${event_item_time.text}" + - (if ( !startTimePostFix.isNullOrEmpty()) "(${startTimePostFix})" else "") + - " - ${Formatter.getTimeFromTS(context, event.endTS)}"+ - (if ( !endTimePostFix.isNullOrEmpty()) "(${endTimePostFix})" else "") - - event_item_time.text = timeString + val startTimeString = event_item_time.text + val startDayString = if (startDayCode != dayCode) "(${Formatter.getDayTitle(activity, startDayCode,false)})" else "" + val endTimeString = Formatter.getTimeFromTS(context, event.endTS) + val endDayString = if (endDayCode != dayCode) "(${Formatter.getDayTitle(activity, endDayCode,false)})" else "" + event_item_time.text = "$startTimeString$startDayString - $endTimeString$endDayString" } event_item_description.text = if (replaceDescriptionWithLocation) event.location else event.description.replace("\n", " ")