From fe4174f005f7900d88a714f43333da8b228e18ea Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 11 Jul 2022 16:28:49 +0200 Subject: [PATCH] Small improvements in code --- .../detail/timeline/factory/MergedHeaderItemFactory.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt index 668c7cdd82..08d01c8614 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt @@ -46,8 +46,6 @@ import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import javax.inject.Inject -private const val MIN_NUMBER_OF_MERGED_EVENTS = 2 - class MergedHeaderItemFactory @Inject constructor( private val activeSessionHolder: ActiveSessionHolder, private val avatarRenderer: AvatarRenderer, @@ -215,8 +213,7 @@ class MergedHeaderItemFactory @Inject constructor( collapsedEventIds.removeAll(mergedEventIds) } val mergeId = mergedEventIds.joinToString(separator = "_") { it.toString() } - val summaryTitleResId = getSummaryTitleResId(event.root) - summaryTitleResId?.let { summaryTitle -> + getSummaryTitleResId(event.root)?.let { summaryTitle -> val attributes = MergedSimilarEventsItem.Attributes( summaryTitleResId = summaryTitle, isCollapsed = isCollapsed, @@ -345,4 +342,8 @@ class MergedHeaderItemFactory @Inject constructor( fun isCollapsed(localId: Long): Boolean { return collapsedEventIds.contains(localId) } + + companion object { + private const val MIN_NUMBER_OF_MERGED_EVENTS = 2 + } }