Small improvements in code

This commit is contained in:
Maxime NATUREL 2022-07-11 16:28:49 +02:00
parent c9794d8280
commit fe4174f005
1 changed files with 5 additions and 4 deletions

View File

@ -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 org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import javax.inject.Inject import javax.inject.Inject
private const val MIN_NUMBER_OF_MERGED_EVENTS = 2
class MergedHeaderItemFactory @Inject constructor( class MergedHeaderItemFactory @Inject constructor(
private val activeSessionHolder: ActiveSessionHolder, private val activeSessionHolder: ActiveSessionHolder,
private val avatarRenderer: AvatarRenderer, private val avatarRenderer: AvatarRenderer,
@ -215,8 +213,7 @@ class MergedHeaderItemFactory @Inject constructor(
collapsedEventIds.removeAll(mergedEventIds) collapsedEventIds.removeAll(mergedEventIds)
} }
val mergeId = mergedEventIds.joinToString(separator = "_") { it.toString() } val mergeId = mergedEventIds.joinToString(separator = "_") { it.toString() }
val summaryTitleResId = getSummaryTitleResId(event.root) getSummaryTitleResId(event.root)?.let { summaryTitle ->
summaryTitleResId?.let { summaryTitle ->
val attributes = MergedSimilarEventsItem.Attributes( val attributes = MergedSimilarEventsItem.Attributes(
summaryTitleResId = summaryTitle, summaryTitleResId = summaryTitle,
isCollapsed = isCollapsed, isCollapsed = isCollapsed,
@ -345,4 +342,8 @@ class MergedHeaderItemFactory @Inject constructor(
fun isCollapsed(localId: Long): Boolean { fun isCollapsed(localId: Long): Boolean {
return collapsedEventIds.contains(localId) return collapsedEventIds.contains(localId)
} }
companion object {
private const val MIN_NUMBER_OF_MERGED_EVENTS = 2
}
} }