diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ReactionInfoSimpleItem.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ReactionInfoSimpleItem.kt index 7c7e2531..647af4b0 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ReactionInfoSimpleItem.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ReactionInfoSimpleItem.kt @@ -1,5 +1,6 @@ package im.vector.riotredesign.features.home.room.detail.timeline.action +import android.graphics.Typeface import android.widget.TextView import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute @@ -8,7 +9,9 @@ import com.airbnb.epoxy.EpoxyModelWithHolder import im.vector.riotredesign.R import im.vector.riotredesign.core.epoxy.VectorEpoxyHolder - +/** + * Item displaying an emoji reaction (single line with emoji, author, time) + */ @EpoxyModelClass(layout = R.layout.item_simple_reaction_info) abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder() { @@ -19,8 +22,12 @@ abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder(R.id.itemSimpleReactionInfoKey) + val emojiReactionView by bind(R.id.itemSimpleReactionInfoKey) val displayNameView by bind(R.id.itemSimpleReactionInfoMemberName) val timeStampView by bind(R.id.itemSimpleReactionInfoTime) } diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionBottomSheet.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionBottomSheet.kt index a53dc3bd..308c68bf 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionBottomSheet.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionBottomSheet.kt @@ -11,24 +11,27 @@ import butterknife.BindView import butterknife.ButterKnife import com.airbnb.epoxy.EpoxyRecyclerView import com.airbnb.mvrx.MvRx -import com.airbnb.mvrx.args import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState +import im.vector.riotredesign.EmojiCompatFontProvider import im.vector.riotredesign.R import im.vector.riotredesign.features.home.room.detail.timeline.item.MessageInformationData import kotlinx.android.synthetic.main.bottom_sheet_display_reactions.* +import org.koin.android.ext.android.inject - +/** + * Bottom sheet displaying list of reactions for a given event ordered by timestamp + */ class ViewReactionBottomSheet : BaseMvRxBottomSheetDialog() { private val viewModel: ViewReactionViewModel by fragmentViewModel(ViewReactionViewModel::class) - private val eventArgs: TimelineEventFragmentArgs by args() + private val emojiCompatFontProvider by inject() @BindView(R.id.bottom_sheet_display_reactions_list) lateinit var epoxyRecyclerView: EpoxyRecyclerView - private val epoxyController by lazy { ViewReactionsEpoxyController() } + private val epoxyController by lazy { ViewReactionsEpoxyController(emojiCompatFontProvider.typeface) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val view = inflater.inflate(R.layout.bottom_sheet_display_reactions, container, false) diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionsEpoxyController.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionsEpoxyController.kt index a3d146a2..461fec2b 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/action/ViewReactionsEpoxyController.kt @@ -1,15 +1,19 @@ package im.vector.riotredesign.features.home.room.detail.timeline.action +import android.graphics.Typeface import com.airbnb.epoxy.TypedEpoxyController - -class ViewReactionsEpoxyController : TypedEpoxyController() { +/** + * Epoxy controller for reaction event list + */ +class ViewReactionsEpoxyController(private val emojiCompatTypeface: Typeface?) : TypedEpoxyController() { override fun buildModels(state: DisplayReactionsViewState) { val map = state.mapReactionKeyToMemberList() ?: return map.forEach { reactionInfoSimpleItem { id(it.eventId) + emojiTypeFace(emojiCompatTypeface) timeStamp(it.timestamp) reactionKey(it.reactionKey) authorDisplayName(it.authorName ?: it.authorId)