forked from GitHub-Mirror/riotX-android
Fix / use emoji Compat font for view reaction screen
This commit is contained in:
parent
04576ba7fd
commit
3f1bf00fdd
@ -1,5 +1,6 @@
|
|||||||
package im.vector.riotredesign.features.home.room.detail.timeline.action
|
package im.vector.riotredesign.features.home.room.detail.timeline.action
|
||||||
|
|
||||||
|
import android.graphics.Typeface
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.epoxy.EpoxyAttribute
|
import com.airbnb.epoxy.EpoxyAttribute
|
||||||
@ -8,7 +9,9 @@ import com.airbnb.epoxy.EpoxyModelWithHolder
|
|||||||
import im.vector.riotredesign.R
|
import im.vector.riotredesign.R
|
||||||
import im.vector.riotredesign.core.epoxy.VectorEpoxyHolder
|
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)
|
@EpoxyModelClass(layout = R.layout.item_simple_reaction_info)
|
||||||
abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder<ReactionInfoSimpleItem.Holder>() {
|
abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder<ReactionInfoSimpleItem.Holder>() {
|
||||||
|
|
||||||
@ -19,8 +22,12 @@ abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder<ReactionInfoSimpleI
|
|||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
var timeStamp: CharSequence? = null
|
var timeStamp: CharSequence? = null
|
||||||
|
|
||||||
|
@EpoxyAttribute
|
||||||
|
var emojiTypeFace: Typeface? = null
|
||||||
|
|
||||||
override fun bind(holder: Holder) {
|
override fun bind(holder: Holder) {
|
||||||
holder.titleView.text = reactionKey
|
holder.emojiReactionView.text = reactionKey
|
||||||
|
holder.emojiReactionView.typeface = emojiTypeFace ?: Typeface.DEFAULT
|
||||||
holder.displayNameView.text = authorDisplayName
|
holder.displayNameView.text = authorDisplayName
|
||||||
timeStamp?.let {
|
timeStamp?.let {
|
||||||
holder.timeStampView.text = it
|
holder.timeStampView.text = it
|
||||||
@ -31,7 +38,7 @@ abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder<ReactionInfoSimpleI
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Holder : VectorEpoxyHolder() {
|
class Holder : VectorEpoxyHolder() {
|
||||||
val titleView by bind<TextView>(R.id.itemSimpleReactionInfoKey)
|
val emojiReactionView by bind<TextView>(R.id.itemSimpleReactionInfoKey)
|
||||||
val displayNameView by bind<TextView>(R.id.itemSimpleReactionInfoMemberName)
|
val displayNameView by bind<TextView>(R.id.itemSimpleReactionInfoMemberName)
|
||||||
val timeStampView by bind<TextView>(R.id.itemSimpleReactionInfoTime)
|
val timeStampView by bind<TextView>(R.id.itemSimpleReactionInfoTime)
|
||||||
}
|
}
|
||||||
|
@ -11,24 +11,27 @@ import butterknife.BindView
|
|||||||
import butterknife.ButterKnife
|
import butterknife.ButterKnife
|
||||||
import com.airbnb.epoxy.EpoxyRecyclerView
|
import com.airbnb.epoxy.EpoxyRecyclerView
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.MvRx
|
||||||
import com.airbnb.mvrx.args
|
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
|
import im.vector.riotredesign.EmojiCompatFontProvider
|
||||||
import im.vector.riotredesign.R
|
import im.vector.riotredesign.R
|
||||||
import im.vector.riotredesign.features.home.room.detail.timeline.item.MessageInformationData
|
import im.vector.riotredesign.features.home.room.detail.timeline.item.MessageInformationData
|
||||||
import kotlinx.android.synthetic.main.bottom_sheet_display_reactions.*
|
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() {
|
class ViewReactionBottomSheet : BaseMvRxBottomSheetDialog() {
|
||||||
|
|
||||||
private val viewModel: ViewReactionViewModel by fragmentViewModel(ViewReactionViewModel::class)
|
private val viewModel: ViewReactionViewModel by fragmentViewModel(ViewReactionViewModel::class)
|
||||||
|
|
||||||
private val eventArgs: TimelineEventFragmentArgs by args()
|
private val emojiCompatFontProvider by inject<EmojiCompatFontProvider>()
|
||||||
|
|
||||||
@BindView(R.id.bottom_sheet_display_reactions_list)
|
@BindView(R.id.bottom_sheet_display_reactions_list)
|
||||||
lateinit var epoxyRecyclerView: EpoxyRecyclerView
|
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? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
val view = inflater.inflate(R.layout.bottom_sheet_display_reactions, container, false)
|
val view = inflater.inflate(R.layout.bottom_sheet_display_reactions, container, false)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
package im.vector.riotredesign.features.home.room.detail.timeline.action
|
package im.vector.riotredesign.features.home.room.detail.timeline.action
|
||||||
|
|
||||||
|
import android.graphics.Typeface
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
|
|
||||||
|
/**
|
||||||
class ViewReactionsEpoxyController : TypedEpoxyController<DisplayReactionsViewState>() {
|
* Epoxy controller for reaction event list
|
||||||
|
*/
|
||||||
|
class ViewReactionsEpoxyController(private val emojiCompatTypeface: Typeface?) : TypedEpoxyController<DisplayReactionsViewState>() {
|
||||||
|
|
||||||
override fun buildModels(state: DisplayReactionsViewState) {
|
override fun buildModels(state: DisplayReactionsViewState) {
|
||||||
val map = state.mapReactionKeyToMemberList() ?: return
|
val map = state.mapReactionKeyToMemberList() ?: return
|
||||||
map.forEach {
|
map.forEach {
|
||||||
reactionInfoSimpleItem {
|
reactionInfoSimpleItem {
|
||||||
id(it.eventId)
|
id(it.eventId)
|
||||||
|
emojiTypeFace(emojiCompatTypeface)
|
||||||
timeStamp(it.timestamp)
|
timeStamp(it.timestamp)
|
||||||
reactionKey(it.reactionKey)
|
reactionKey(it.reactionKey)
|
||||||
authorDisplayName(it.authorName ?: it.authorId)
|
authorDisplayName(it.authorName ?: it.authorId)
|
||||||
|
Loading…
Reference in New Issue
Block a user