Page Event Listening
Global IM UIKit supports listening to click and long-press events on the conversation list page and chat UI, allowing applications to intercept and implement custom requirements in the corresponding methods.
Listening to Conversation List Page Events
Global IM UIKit provides a conversation list listener [ChatListBehaviorListener] that can monitor long-press and click events on conversation items in the conversation list.
Use the ConfigCenter.getChatListConfig().setChatListBehaviorListener()
method to set the listener.
ConfigCenter.getChatListConfig().setChatListBehaviorListener(listener);
Long-Press Conversation Event
The following method is triggered when a single conversation is long-pressed in the conversation list. The SDK defaults to opening the multi-select mode.
boolean onChatLongClick(Context context, View view, BaseChatModel model)
Parameter | Type | Description |
---|---|---|
context | Context | Context |
view | View | The View that triggered the click |
model | BaseChatModel | The conversation that was long-pressed |
Return true
if you need to handle this long-press event customly; otherwise, return false
to continue with the SDK's default logic.
Click Conversation Event
The following method is triggered when a conversation item is clicked in the conversation list. When this click event is triggered, the SDK defaults to the following jump logic:
- If it is an aggregated conversation, jump to the aggregated conversation list page.
- If it is a non-aggregated conversation, jump to the chat UI.
boolean onChatClick(Context context, View view, BaseChatModel model)
Parameter | Type | Description |
---|---|---|
context | Context | Context |
view | View | The View that triggered the click |
model | BaseChatModel | The conversation that was clicked |
Return true
if you need to handle this long-press event customly; otherwise, return false
to continue with the SDK's default logic.
Listening to Chat UI Events
Global IM UIKit provides a conversation list listener [ChatBehaviorListener] that can monitor long-press and click events on message items and message avatars in the chat UI.
Use the ConfigCenter.getChatConfig().setChatBehaviorListener()
method to set the listener.
ConfigCenter.getChatConfig().setChatBehaviorListener(listener);
Click Message Event
boolean onMessageClick(Context context, View view, Message message);
Parameter | Type | Description |
---|---|---|
context | Context | Context |
view | View | The View that triggered the click |
message | Message | The entity information of the clicked message |
Return true
if you handle the click logic yourself; otherwise, return false
to continue with the SDK's default logic.
Long-Press Message Event
boolean onMessageLongClick(Context context, View view, Message message);
Parameter | Type | Description |
---|---|---|
context | Context | Context |
view | View | The View that triggered the click |
message | Message | The entity information of the clicked message |
Return true
if you handle the long-press logic yourself; otherwise, return false
to continue with the SDK's default logic.
Click Message Avatar Event
boolean onUserPortraitClick(Context context, Message message);
Parameter | Type | Description |
---|---|---|
context | Context | Context |
message | Message | The entity information of the clicked message |
Return true
if you handle the click logic yourself; otherwise, return false
to continue with the SDK's default logic.
Long-Press Message Avatar Event
The following method is triggered when the user avatar (icon) on a message is long-pressed. The SDK defaults to jumping to the @ function's user selection interface.
boolean onUserPortraitLongClick(Context context, Message message);
Parameter | Type | Description |
---|---|---|
context | Context | Context |
message | Message | The entity information of the clicked message |
Return true
if you handle the click logic yourself; otherwise, return false
to continue with the SDK's default logic.