Class ChannelConfig

  • All Implemented Interfaces:

    
    public class ChannelConfig
    
                        

    Configuration for the conversation (channel) screen.

    Obtain the singleton instance via channelConfig.

    • Constructor Detail

    • Method Detail

      • setConversationHistoryMessageCount

         void setConversationHistoryMessageCount(int conversationHistoryMessageCount)

        Sets the maximum number of history messages to show in the channel screen.

        Parameters:
        conversationHistoryMessageCount - maximum message count
      • setConversationRemoteMessageCount

         void setConversationRemoteMessageCount(int conversationRemoteMessageCount)

        Sets the maximum number of messages to fetch from the remote server.

        Parameters:
        conversationRemoteMessageCount - maximum remote message count
      • 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 position
        action - 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 replace
        provider - 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 - context
        messageContent - 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 - context
        channel - 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:

        true to show the sender name; false otherwise

      • 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:

        true to show the title; false otherwise

      • isShowMoreClickAction

         boolean isShowMoreClickAction()
        Returns:

        whether to show the "more" option on long-press

      • isShowNewMessageBar

         boolean isShowNewMessageBar(ChannelType type)

        Returns whether to show the new-message unread bubble (direct and group channels only).

        Parameters:
        type - channel type
        Returns:

        false for 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:

        false for 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:

        false for 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 null if 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
      • isShowReadReceipt

         boolean isShowReadReceipt(ChannelType type)

        Returns whether to show the read receipt indicator (direct channels only).

        Parameters:
        type - channel type
        Returns:

        false for 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:

        false for 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 - true to enable sync; false to 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:

        true if remote messages are deleted

      • isNeedRefreshWhenListIsEmptyAfterDelete

         boolean isNeedRefreshWhenListIsEmptyAfterDelete()

        Returns whether to refresh the list when it becomes empty after deleting messages.

        Returns:

        true to 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 - true to delete remote messages
      • setNeedRefreshWhenListIsEmptyAfterDelete

         void setNeedRefreshWhenListIsEmptyAfterDelete(boolean needRefreshWhenListIsEmptyAfterDelete)

        Sets whether to refresh the list when it becomes empty after deleting messages.

        Parameters:
        needRefreshWhenListIsEmptyAfterDelete - true to refresh the page