Message Bubble

UIKit allows all types of message bubble to be replaced

Text Message Bubble

Image Massage Bubble

Audio Message Bubble


To customize message bubble, implement AmityMessageListAdapter.CustomViewHolder and pass a custom ViewHolder for the corresponding message type.

class MainActivity : AppCompatActivity(), AmityMessageListAdapter.CustomViewHolder {

   override fun onCreate(savedInstanceState: Bundle?) {
         * Implement [AmityMessageListAdapter.CustomViewHolder] if customization is required for messageViews
         * set the customView listener using [AmityChatRoomFragment] instance
       val chatRoomFragment = AmityChatRoomFragment
        val transaction = supportFragmentManager.beginTransaction()
        transaction.replace(, messageListFragment)

Override method getViewHolder() to pass a custom ViewHolder

override fun getViewHolder(
        inflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): AmityChatMessageBaseViewHolder? {
        return when(viewType) {
            MessageType.MESSAGE_ID_TEXT_RECEIVER -> TextReceiverViewHolder(
                inflater.inflate(R.layout.custom_item_text_receiver, parent, false), EkoChatMessageBaseViewModel())
            MessageType.MESSAGE_ID_TEXT_SENDER -> TextSenderViewHolder(
                inflater.inflate(R.layout.custom_item_text_sender, parent, false), EkoChatMessageBaseViewModel()
            //pass null for all the types where no customisation is required
            //Default UIKIT Ui will be rendered for all those types
            else -> null

Last updated