UIKit Android v3
UIKit Android
UIKit
Android
Home
/
UIKit
/
Android
This is the new Docs for UIKit v3 for Android. To see the previous Docs, click here.

Message threading

Message threading is a feature that allows users to reply to each other's messages in a channel. Users can ask questions, give feedback or add context to a specific message without interrupting the conversation flow. A message thread refers to a group of messages and their replies. Currently, Sendbird UIKit only supports quote reply type of message threading where users' messages and replies are all shown in the channel view.


Limitations

Message threading currently has the following limitations:

  • UIKit message threading is available for group channels only.
  • Quote reply is the only reply type that Sendbird UIKit provides.
  • Sendbird UIKit only supports 1-depth threads, meaning you can't reply to a quote reply message.

How to use

To enable message threading, set the reply filter to quote reply mode:

// Turn on the quote reply mode.
SendbirdUIKit.setReplyType(ReplyType.QUOTE_REPLY);
// Turn off the quote reply mode.
SendbirdUIKit.setReplyType(ReplyType.NONE);

Reply to messages

Users can reply to messages in a group channel. The messageListComponent of ChannelModule will allow the users to press and hold the message they wish to reply to. A Message menu will appear and once they tap Reply, they can start quote replying using the QUOTE_REPLY mode of MessageInputView. A message that already has a reply is called a quoted message and the replied message is called a reply. Both quoted messages and replies can be either user messages or file messages.

Message menu

The Message menu contains an Emoji reaction bar, a Copy button, and a Reply button. To view the menu, long tap on a message in channel view. Then, tap Reply in the menu to quote reply to the selected message. The sendUserMessage(UserMessageParams params) method of ChannelFragment is invoked and the selected message becomes a quoted message.

The Reply button of a message that is already a reply appears as deactivated because Sendbird UIkit only supports 1-depth replies.

The Delete button of a quoted message that has one or more replies appears as deactivated. To delete the quoted message, its replies must be deleted first.

Customize the UI for quote reply in Message menu

The UI for quote reply in the Message menu can be customized through string resource and icon resource.

String resource for Message menu

The Reply text in the Message menu can be customized through the string resource. The string resource is a set of strings used to compose a view. It’s a res/strings.xml file containing UIKit-defined string values.

<resources>
    <string name="sb_text_channel_anchor_reply">Reply</string>
</resources>

Icon resource for Message menu

The following table shows a customizable reply message icon.

Icon nameImageDescription

icon_reply

An icon used to indicate Reply.

Message input

Once the current user chooses to Reply in the Message menu, they will be able to start quote replying through the QUOTE_REPLY mode of MessageInputView. The preview of the quoted message is displayed above the messageInputComponent of ChannelModule. Type a message in the input field and Send. Then, the sendUserMessage(UserMessageParams params) method of ChannelFragment is called to send the reply message.

If the user closes the quoted message in MessageInputView, they can end QUOTE_REPLY mode and the preview of the quoted message disappears.

Customize the UI for message input

You can customize the UI for message input view using style resource, string resource, and icon resource.

Style resource for message input

To customize the style of items in the message input view, you have to change the UIKit-defined style values in the res/values/style.xml file as shown below. To learn how to customize the style, refer to Style resource.

<style name="Component.ChannelMessageInput">
</style>

String resource for message input

The text of the title in the message input view can be customized through the string resource. The string resource is a set of strings used to compose a view. It’s a res/strings.xml file containing UIKit-defined string values.

<resources>
    <string name="sb_text_reply_to">Reply to %s&#8230;</string>
</resources>

Icon resource for message input

The icon in the upper right corner of the message input view can be customized through the icon resource.

IconImageDescription

icon_close

An icon used to close the current page.


Show replies

Users can view all quoted messages in the channel through BaseQuotedMessageView, MyQuotedMessageView, and OtherQuotedMessageView. Both MyQuotedMessageView and OtherQuotedMessageView inherit the properties and methods of BaseQuotedMessageView. The BaseQuoteMessageView only shows the quoted message and the title that indicates a user replied to another user as all reply messages are considered individual messages in the channel that inherit BaseViewHolder<BaseMessage>.

There are two types of quoted message views in a channel: MyQuotedMessageView and OtherQuotedMessageView. When the current user replies to a message in the channel, the quoted message is shown using MyQuotedMessageView. When another user in the channel replies to a message in the channel, the quoted message is displayed through OtherQuotedMessageView.

Customize quoted message view

You can customize the UI for quoted messages in a channel using style resource, string resource, and icon resource.

Style resource for quoted message

To customize the style of items in the quoted message view, you have to change the UIKit-defined style values in the res/values/style.xml file as shown below. To learn how to customize the style, refer to Style resource.

<style name="Widget.Sendbird.Message.Me">
</style>
<style name="Widget.Sendbird.Message.Other">
</style>

String resource for quoted message

The texts in the quoted message view can be customized through the string resource. The string resource is a set of strings used to compose a view. It’s a res/strings.xml file containing UIKit-defined string values.

<resources>
    <string name="sb_text_you">You</string>
    <string name="sb_text_reply_to">Reply to %s</string>
    <string name="sb_text_replied_to">%s replied to %s</string>
    <string name="sb_text_error_original_message_not_found">Couldn\'t find the original message for this reply.</string>
</resources>

Icon resource for quoted message

The icon to the left of the title in the quoted message view can be customized through the icon resource.

IconImageDescription

icon_reply_filled

An icon indicating that a user replied to another user's message.


Event handler for quote reply

The quoted message view supports an event handler for tap gestures. When the current user taps or presses and holds the quoted message, the setOnQuoteReplyMessageClickListener() or setOnQuoteReplyMessageLongClickListener() method of MessageListComponent is called. To learn how to bind event handlers, refer to Bind event handlers to the view.

MethodDescription

setOnQuoteReplyMessageClickListener()

Called when the quoted message is tapped and redirects the current user to the original message in the channel.

setOnQuoteReplyMessageLongClickListener()

Called when the quoted message is long pressed and redirects the current user to the original message in the channel.