Class ChannelConfig
-
- All Implemented Interfaces:
public class ChannelConfigConfiguration for the conversation (channel) screen.
Obtain the singleton instance via channelConfig.
-
-
Field Summary
Fields Modifier and Type Field Description public static booleanenableMultiDeviceSyncpublic booleanrc_enable_recall_messagepublic booleanrc_enable_resend_messagepublic intrc_message_recall_intervalpublic intrc_message_recall_edit_intervalpublic intrc_chatroom_first_pull_message_countpublic booleanrc_is_show_warning_notificationpublic booleanrc_play_audio_continuouspublic booleanrc_enable_mentioned_messagepublic intrc_read_receipt_request_intervalpublic booleanrc_media_selector_contain_videopublic booleanrc_enable_automatic_download_voice_msgpublic intrc_gifmsg_auto_download_sizepublic intrc_max_message_selected_countpublic booleanrc_enable_send_combine_messagepublic intconversationHistoryMessageCountpublic intconversationRemoteMessageCountpublic intconversationShowUnreadMessageCount
-
Method Summary
Modifier and Type Method Description intgetConversationHistoryMessageCount()Returns the maximum number of history messages to show in the channel screen. voidsetConversationHistoryMessageCount(int conversationHistoryMessageCount)Sets the maximum number of history messages to show in the channel screen. intgetConversationRemoteMessageCount()Returns the maximum number of messages to fetch from the remote server. voidsetConversationRemoteMessageCount(int conversationRemoteMessageCount)Sets the maximum number of messages to fetch from the remote server. intgetConversationShowUnreadMessageCount()Returns the maximum number of unread messages to display. voidsetConversationShowUnreadMessageCount(int conversationShowUnreadMessageCount)Sets the maximum number of unread messages to display. voidinitConfig(Context context)Initializes this configuration from Android resource values. voidaddMoreClickAction(int index, IClickActions action)Inserts a click action at the specified position in the "more" actions list. voidremoveMoreClickAction(IClickActions action)Removes a click action from the "more" actions list. voidaddViewProcessor(IChannelUIRenderer processor)Adds a UI renderer to the channel fragment. List<IChannelUIRenderer>getViewProcessors()voidaddMessageProvider(IMessageProvider provider)voidreplaceMessageProvider(Class oldProviderClass, IMessageProvider provider)Replaces an existing message item provider with a new one. ProviderManager<UiMessage>getMessageListProvider()SpannablegetMessageSummary(Context context, MessageContent messageContent)Returns the display summary spannable for a message content. SpannablegetMessageSummary(Context context, BaseChannel channel)Returns the display summary spannable for a channel's latest message. booleanshowSummaryWithName(MessageContent messageContent)Returns whether to show the sender name alongside the message summary. booleanisShowReceiverUserTitle(ChannelType type)Returns whether to show the receiver user title for the given channel type. booleanisShowMoreClickAction()booleanisShowHistoryDividerMessage()booleanisShowNewMessageBar(ChannelType type)Returns whether to show the new-message unread bubble (direct and group channels only). booleanisShowNewMentionMessageBar(ChannelType type)Returns whether to show the unread @mention count badge (group channels only). booleanisShowHistoryMessageBar(ChannelType type)Returns whether to show the history unread message bubble (direct and group channels only). ChannelClickListenergetChannelClickListener()Returns the current channel click listener. voidsetChannelClickListener(ChannelClickListener conversationClickListener)Sets the click event listener for the channel screen. List<IClickActions>getMoreClickActions()Returns the list of actions shown in the bottom panel when "more" is tapped after long-pressing a message. IChannelViewModelProcessorgetViewModelProcessor()Returns the custom ViewModel processor, or nullif not set.voidsetViewModelProcessor(IChannelViewModelProcessor viewModelProcessor)Sets a custom ViewModel processor to extend channel screen business logic. voidsetEnableReadReceipt(boolean enable)Enables or disables read receipts (direct and group channels only). booleanisEnableReadReceipt()Returns whether read receipts are enabled. voidsetSupportReadReceiptConversationType(Array<ChannelType> types)Sets the channel types that support read receipts. Set<ChannelType>getSupportReadReceiptConversationType()Returns the set of channel types that support read receipts. booleanisShowReadReceipt(ChannelType type)Returns whether to show the read receipt indicator (direct channels only). booleanisShowReadReceiptRequest(ChannelType type)Returns whether to show the read receipt request indicator (group channels only). booleanisEnableMultiDeviceSync(ChannelType type)Returns whether multi-device read status sync is enabled. voidsetEnableMultiDeviceSync(boolean enableMultiDeviceSync)Enables or disables multi-device unread count sync. voidsetChannelLoadMessageType(ChannelLoadMessageType conversationLoadMessageType)Sets the strategy for loading remote messages when entering a channel. ChannelLoadMessageTypegetChannelLoadMessageType()Returns the current remote-message loading strategy. booleanisNeedDeleteRemoteMessage()Returns whether remote messages are also deleted on long-press delete. booleanisNeedRefreshWhenListIsEmptyAfterDelete()Returns whether to refresh the list when it becomes empty after deleting messages. voidregisterFileSuffixTypes(HashMap<String, Integer> map)Registers icon resource mappings for file message suffixes. HashMap<String, Integer>getFileSuffixTypes()Internal use only. voidsetShowReceiverUserTitle(boolean showReceiverUserTitle)voidsetShowMoreClickAction(boolean showMoreClickAction)voidsetShowHistoryDividerMessage(boolean showHistoryDividerMessage)voidsetShowNewMessageBar(boolean showNewMessageBar)voidsetShowNewMentionMessageBar(boolean showNewMentionMessageBar)voidsetShowHistoryMessageBar(boolean showHistoryMessageBar)voidsetNeedDeleteRemoteMessage(boolean needDeleteRemoteMessage)Sets whether remote messages are also deleted on long-press delete. voidsetNeedRefreshWhenListIsEmptyAfterDelete(boolean needRefreshWhenListIsEmptyAfterDelete)Sets whether to refresh the list when it becomes empty after deleting messages. -
-
Method Detail
-
getConversationHistoryMessageCount
int getConversationHistoryMessageCount()
Returns the maximum number of history messages to show in the channel screen.
-
setConversationHistoryMessageCount
void setConversationHistoryMessageCount(int conversationHistoryMessageCount)
Sets the maximum number of history messages to show in the channel screen.
- Parameters:
conversationHistoryMessageCount- maximum message count
-
getConversationRemoteMessageCount
int getConversationRemoteMessageCount()
Returns the maximum number of messages to fetch from the remote server.
-
setConversationRemoteMessageCount
void setConversationRemoteMessageCount(int conversationRemoteMessageCount)
Sets the maximum number of messages to fetch from the remote server.
- Parameters:
conversationRemoteMessageCount- maximum remote message count
-
getConversationShowUnreadMessageCount
int getConversationShowUnreadMessageCount()
Returns the maximum number of unread messages to display.
-
setConversationShowUnreadMessageCount
void setConversationShowUnreadMessageCount(int conversationShowUnreadMessageCount)
Sets the maximum number of unread messages to display.
- Parameters:
conversationShowUnreadMessageCount- maximum unread message count to show
-
initConfig
void initConfig(Context context)
Initializes this configuration from Android resource values.
- Parameters:
context- application or activity context
-
addMoreClickAction
void addMoreClickAction(int index, IClickActions action)
Inserts a click action at the specified position in the "more" actions list.
- Parameters:
index- insertion positionaction- click action to add
-
removeMoreClickAction
void removeMoreClickAction(IClickActions action)
Removes a click action from the "more" actions list.
- Parameters:
action- click action to remove
-
addViewProcessor
void addViewProcessor(IChannelUIRenderer processor)
Adds a UI renderer to the channel fragment.
- Parameters:
processor- the UI renderer to add
-
getViewProcessors
List<IChannelUIRenderer> getViewProcessors()
- Returns:
list of registered channel fragment UI renderers
-
addMessageProvider
void addMessageProvider(IMessageProvider provider)
- Parameters:
provider- message list item provider
-
replaceMessageProvider
void replaceMessageProvider(Class oldProviderClass, IMessageProvider provider)
Replaces an existing message item provider with a new one.
- Parameters:
oldProviderClass- class of the provider to replaceprovider- new provider instance
-
getMessageListProvider
ProviderManager<UiMessage> getMessageListProvider()
- Returns:
the message item provider manager
-
getMessageSummary
Spannable getMessageSummary(Context context, MessageContent messageContent)
Returns the display summary spannable for a message content.
- Parameters:
context- contextmessageContent- message content- Returns:
summary spannable
-
getMessageSummary
Spannable getMessageSummary(Context context, BaseChannel channel)
Returns the display summary spannable for a channel's latest message.
- Parameters:
context- contextchannel- the channel- Returns:
message summary spannable
-
showSummaryWithName
boolean showSummaryWithName(MessageContent messageContent)
Returns whether to show the sender name alongside the message summary.
- Parameters:
messageContent- message content- Returns:
trueto show the sender name;falseotherwise
-
isShowReceiverUserTitle
boolean isShowReceiverUserTitle(ChannelType type)
Returns whether to show the receiver user title for the given channel type. Only the direct channel type is affected by this setting.
- Parameters:
type- channel type- Returns:
trueto show the title;falseotherwise
-
isShowMoreClickAction
boolean isShowMoreClickAction()
- Returns:
whether to show the "more" option on long-press
-
isShowHistoryDividerMessage
boolean isShowHistoryDividerMessage()
- Returns:
whether the history-divider message is shown
-
isShowNewMessageBar
boolean isShowNewMessageBar(ChannelType type)
Returns whether to show the new-message unread bubble (direct and group channels only).
- Parameters:
type- channel type- Returns:
falsefor unsupported types; otherwise the configured value
-
isShowNewMentionMessageBar
boolean isShowNewMentionMessageBar(ChannelType type)
Returns whether to show the unread @mention count badge (group channels only).
- Parameters:
type- channel type- Returns:
falsefor unsupported types; otherwise the configured value
-
isShowHistoryMessageBar
boolean isShowHistoryMessageBar(ChannelType type)
Returns whether to show the history unread message bubble (direct and group channels only).
- Parameters:
type- channel type- Returns:
falsefor unsupported types; otherwise the configured value
-
getChannelClickListener
ChannelClickListener getChannelClickListener()
Returns the current channel click listener.
-
setChannelClickListener
void setChannelClickListener(ChannelClickListener conversationClickListener)
Sets the click event listener for the channel screen.
- Parameters:
conversationClickListener- the ChannelClickListener to register
-
getMoreClickActions
List<IClickActions> getMoreClickActions()
Returns the list of actions shown in the bottom panel when "more" is tapped after long-pressing a message. Modify this list to customize the displayed actions.
- Returns:
the current list of "more" click actions
-
getViewModelProcessor
IChannelViewModelProcessor getViewModelProcessor()
Returns the custom ViewModel processor, or
nullif not set.
-
setViewModelProcessor
void setViewModelProcessor(IChannelViewModelProcessor viewModelProcessor)
Sets a custom ViewModel processor to extend channel screen business logic.
- Parameters:
viewModelProcessor- the processor to use
-
setEnableReadReceipt
void setEnableReadReceipt(boolean enable)
Enables or disables read receipts (direct and group channels only).
- Parameters:
enable- read receipt toggle
-
isEnableReadReceipt
boolean isEnableReadReceipt()
Returns whether read receipts are enabled.
- Returns:
read receipt toggle value
-
setSupportReadReceiptConversationType
void setSupportReadReceiptConversationType(Array<ChannelType> types)
Sets the channel types that support read receipts.
- Parameters:
types- channel types to enable read receipts for
-
getSupportReadReceiptConversationType
Set<ChannelType> getSupportReadReceiptConversationType()
Returns the set of channel types that support read receipts.
-
isShowReadReceipt
boolean isShowReadReceipt(ChannelType type)
Returns whether to show the read receipt indicator (direct channels only).
- Parameters:
type- channel type- Returns:
falsefor unsupported types; otherwise the configured value
-
isShowReadReceiptRequest
boolean isShowReadReceiptRequest(ChannelType type)
Returns whether to show the read receipt request indicator (group channels only).
- Parameters:
type- channel type- Returns:
falsefor unsupported types; otherwise the configured value
-
isEnableMultiDeviceSync
boolean isEnableMultiDeviceSync(ChannelType type)
Returns whether multi-device read status sync is enabled. When enabled, messages read on other devices will have their unread count cleared.
- Parameters:
type- channel type (direct, group, community, and system channels only)- Returns:
whether the feature is enabled for the given type
-
setEnableMultiDeviceSync
void setEnableMultiDeviceSync(boolean enableMultiDeviceSync)
Enables or disables multi-device unread count sync.
- Parameters:
enableMultiDeviceSync-trueto enable sync;falseto disable
-
setChannelLoadMessageType
void setChannelLoadMessageType(ChannelLoadMessageType conversationLoadMessageType)
Sets the strategy for loading remote messages when entering a channel.
- Parameters:
conversationLoadMessageType- the ChannelLoadMessageType to use
-
getChannelLoadMessageType
ChannelLoadMessageType getChannelLoadMessageType()
Returns the current remote-message loading strategy.
-
isNeedDeleteRemoteMessage
boolean isNeedDeleteRemoteMessage()
Returns whether remote messages are also deleted on long-press delete.
- Returns:
trueif remote messages are deleted
-
isNeedRefreshWhenListIsEmptyAfterDelete
boolean isNeedRefreshWhenListIsEmptyAfterDelete()
Returns whether to refresh the list when it becomes empty after deleting messages.
- Returns:
trueto refresh the page
-
registerFileSuffixTypes
void registerFileSuffixTypes(HashMap<String, Integer> map)
Registers icon resource mappings for file message suffixes.
- Parameters:
map- keys are file suffixes (e.g.
-
getFileSuffixTypes
HashMap<String, Integer> getFileSuffixTypes()
Internal use only.
- Returns:
the registered file-suffix icon map
-
setShowReceiverUserTitle
void setShowReceiverUserTitle(boolean showReceiverUserTitle)
- Parameters:
showReceiverUserTitle- whether to show the user title in direct chats
-
setShowMoreClickAction
void setShowMoreClickAction(boolean showMoreClickAction)
- Parameters:
showMoreClickAction- whether to show the "more" option on long-press
-
setShowHistoryDividerMessage
void setShowHistoryDividerMessage(boolean showHistoryDividerMessage)
- Parameters:
showHistoryDividerMessage- whether to show the history-divider message
-
setShowNewMessageBar
void setShowNewMessageBar(boolean showNewMessageBar)
- Parameters:
showNewMessageBar- whether to show the new-message unread bubble (direct and group only)
-
setShowNewMentionMessageBar
void setShowNewMentionMessageBar(boolean showNewMentionMessageBar)
- Parameters:
showNewMentionMessageBar- whether to show the unread @mention count badge (group only)
-
setShowHistoryMessageBar
void setShowHistoryMessageBar(boolean showHistoryMessageBar)
- Parameters:
showHistoryMessageBar- whether to show the history unread message bubble (direct and group only)
-
setNeedDeleteRemoteMessage
void setNeedDeleteRemoteMessage(boolean needDeleteRemoteMessage)
Sets whether remote messages are also deleted on long-press delete.
- Parameters:
needDeleteRemoteMessage-trueto delete remote messages
-
setNeedRefreshWhenListIsEmptyAfterDelete
void setNeedRefreshWhenListIsEmptyAfterDelete(boolean needRefreshWhenListIsEmptyAfterDelete)
Sets whether to refresh the list when it becomes empty after deleting messages.
- Parameters:
needRefreshWhenListIsEmptyAfterDelete-trueto refresh the page
-
-
-
-