This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ChatViewModel (private val sendChatMessageUseCase: CompletableUseCase<SendMessageParams>, | |
| private val openChatChannelUseCase: ObservableUseCase<String>){ | |
| var messages= mutableListOf<MessageItemUi>() | |
| var notifyNewMessageInsertedLiveData = MutableLiveData<Int>() | |
| fun openChatChannel() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyMessageViewHolder(val view: View) : MessageViewHolder<MessageItemUi>(view) { | |
| private val messageContent = view.findViewById<TextView>(R.id.message) | |
| override fun bind(item: MessageItemUi) { | |
| messageContent.text = item.content | |
| messageContent.textColor= item.textColor | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ChatAdapter(var data: MutableList<MessageItemUi>) : RecyclerView.Adapter<MessageViewHolder<*>>() { | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MessageViewHolder<*> { | |
| val context = parent.context | |
| return when (viewType) { | |
| TYPE_MY_MESSAGE -> { | |
| val view = LayoutInflater.from(context).inflate(R.layout.my_message_item, parent, false) | |
| MyMessageViewHolder(view) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Name: Flash | |
| Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc= | |
| if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676 | |
| Thank you! |