diff --git a/app/src/main/java/im/vector/riotredesign/features/home/RoomSummaryViewHelper.kt b/app/src/main/java/im/vector/riotredesign/features/home/RoomSummaryViewHelper.kt deleted file mode 100644 index 4f59f0d6..00000000 --- a/app/src/main/java/im/vector/riotredesign/features/home/RoomSummaryViewHelper.kt +++ /dev/null @@ -1,19 +0,0 @@ -package im.vector.riotredesign.features.home - -import android.content.Context -import android.graphics.drawable.Drawable -import android.support.v4.content.ContextCompat -import com.amulyakhare.textdrawable.TextDrawable -import im.vector.matrix.android.api.session.room.model.RoomSummary -import im.vector.riotredesign.R -import im.vector.riotredesign.core.extensions.firstCharAsString - -class RoomSummaryViewHelper(private val roomSummary: RoomSummary) { - - fun avatarDrawable(context: Context): Drawable { - val avatarColor = ContextCompat.getColor(context, R.color.pale_teal) - return TextDrawable.builder().buildRound(roomSummary.displayName.firstCharAsString().toUpperCase(), avatarColor) - } - - -} \ No newline at end of file diff --git a/app/src/main/java/im/vector/riotredesign/features/home/room/detail/BlankItem.kt b/app/src/main/java/im/vector/riotredesign/features/home/room/detail/BlankItem.kt new file mode 100644 index 00000000..e6fe356f --- /dev/null +++ b/app/src/main/java/im/vector/riotredesign/features/home/room/detail/BlankItem.kt @@ -0,0 +1,8 @@ +package im.vector.riotredesign.features.home.room.detail + +import android.content.Context +import android.widget.FrameLayout +import com.airbnb.epoxy.ModelView + +@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT) +class BlankItem(context: Context) : FrameLayout(context) \ No newline at end of file diff --git a/app/src/main/java/im/vector/riotredesign/features/home/room/detail/TimelineEventController.kt b/app/src/main/java/im/vector/riotredesign/features/home/room/detail/TimelineEventController.kt index 580b1753..e62de70e 100644 --- a/app/src/main/java/im/vector/riotredesign/features/home/room/detail/TimelineEventController.kt +++ b/app/src/main/java/im/vector/riotredesign/features/home/room/detail/TimelineEventController.kt @@ -53,6 +53,10 @@ class TimelineEventController(private val context: Context) : EpoxyController( val event = data[index] val nextEvent = if (index + 1 < data.size) data[index + 1] else null + val date = event.root.localDateTime() + val nextDate = nextEvent?.root?.localDateTime() + val addDaySeparator = date.toLocalDate() != nextDate?.toLocalDate() + if (event.root.type == EventType.MESSAGE) { val messageContent = event.root.content() val roomMember = event.roomMember() @@ -60,10 +64,6 @@ class TimelineEventController(private val context: Context) : EpoxyController( continue } - val date = event.root.localDateTime() - val nextDate = nextEvent?.root?.localDateTime() - val addDaySeparator = date.toLocalDate() != nextDate?.toLocalDate() - val nextRoomMember = nextEvent?.roomMember() if (addDaySeparator || nextRoomMember != roomMember) { messagesDisplayedWithInformation.add(event.root.eventId) @@ -80,12 +80,15 @@ class TimelineEventController(private val context: Context) : EpoxyController( .onBind { timeline?.loadAround(index) } .id(event.root.eventId) .addTo(this) - - - if (addDaySeparator) { - val formattedDay = date.toLocalDate().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)) - TimelineDaySeparatorItem(formattedDay).id(formattedDay).addTo(this) - } + } else { + BlankItemModel_() + .id(event.root.eventId) + .onBind { _, _, _ -> timeline?.loadAround(index) } + .addTo(this) + } + if (addDaySeparator) { + val formattedDay = date.toLocalDate().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)) + TimelineDaySeparatorItem(formattedDay).id(formattedDay).addTo(this) } }