public abstract class BaseMessageItemProvider<T extends MessageContent> extends java.lang.Object implements IMessageProvider<T>
Modifier and Type | Class and Description |
---|---|
static class |
BaseMessageItemProvider.MessageViewHolder |
Modifier and Type | Field and Description |
---|---|
protected MessageItemProviderConfig |
mConfig |
Constructor and Description |
---|
BaseMessageItemProvider() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
bindMessageContentViewHolder(ViewHolder holder,
ViewHolder parentHolder,
T t,
UiMessage uiMessage,
int position,
java.util.List<UiMessage> list,
IViewProviderListener<UiMessage> listener)
设置消息视图里各 view 的值
|
void |
bindViewHolder(ViewHolder holder,
UiMessage uiMessage,
int position,
java.util.List<UiMessage> list,
IViewProviderListener<UiMessage> listener)
根据数据源绑定视图
|
boolean |
isItemViewType(UiMessage item) |
protected abstract boolean |
isMessageViewType(MessageContent messageContent)
根据消息内容,判断是否为本模板需要展示的消息类型
|
boolean |
isSummaryType(MessageContent messageContent)
是否为本模板处理的消息内容。
|
protected abstract ViewHolder |
onCreateMessageContentViewHolder(android.view.ViewGroup parent,
int viewType)
创建 ViewHolder
|
ViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType) |
protected abstract boolean |
onItemClick(ViewHolder holder,
T t,
UiMessage uiMessage,
int position,
java.util.List<UiMessage> list,
IViewProviderListener<UiMessage> listener) |
protected boolean |
onItemLongClick(ViewHolder holder,
T t,
UiMessage uiMessage,
int position,
java.util.List<UiMessage> list,
IViewProviderListener<UiMessage> listener) |
protected boolean |
showReadReceiptRequest(Message message) |
boolean |
showSummaryWithName()
是否需要在会话里拼接发送者名称。
此配置只对群组会话有效。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSummarySpannable
protected MessageItemProviderConfig mConfig
public ViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
onCreateViewHolder
in interface IViewProvider<UiMessage>
protected abstract ViewHolder onCreateMessageContentViewHolder(android.view.ViewGroup parent, int viewType)
parent
- 父 ViewGroupviewType
- 视图类型public boolean isItemViewType(UiMessage item)
isItemViewType
in interface IViewProvider<UiMessage>
item
- 数据public void bindViewHolder(ViewHolder holder, UiMessage uiMessage, int position, java.util.List<UiMessage> list, IViewProviderListener<UiMessage> listener)
IViewProvider
bindViewHolder
in interface IViewProvider<UiMessage>
holder
- 视图uiMessage
- 数据position
- 位置protected abstract void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, T t, UiMessage uiMessage, int position, java.util.List<UiMessage> list, IViewProviderListener<UiMessage> listener)
holder
- ViewHolderparentHolder
- 父布局的 ViewHoldert
- 此展示模板对应的消息uiMessage
- UiMessage
position
- 消息位置list
- 列表listener
- ViewModel 的点击事件监听器。如果某个子 view 的点击事件需要 ViewModel 处理,可通过此监听器回调。protected abstract boolean onItemClick(ViewHolder holder, T t, UiMessage uiMessage, int position, java.util.List<UiMessage> list, IViewProviderListener<UiMessage> listener)
holder
- ViewHoldert
- 自定义消息uiMessage
- UiMessage
position
- 位置list
- 列表数据listener
- ViewModel 的点击事件监听器。如果某个子 view 的点击事件需要 ViewModel 处理,可通过此监听器回调。protected boolean onItemLongClick(ViewHolder holder, T t, UiMessage uiMessage, int position, java.util.List<UiMessage> list, IViewProviderListener<UiMessage> listener)
protected boolean showReadReceiptRequest(Message message)
protected abstract boolean isMessageViewType(MessageContent messageContent)
messageContent
- 消息内容public boolean isSummaryType(MessageContent messageContent)
IConversationSummaryProvider
isSummaryType
in interface IConversationSummaryProvider<T extends MessageContent>
messageContent
- 待处理的消息内容IConversationSummaryProvider.getSummarySpannable(Context, MessageContent)
()} 获取资源。
false 代表不是本模板需要处理的消息。public boolean showSummaryWithName()
IConversationSummaryProvider
showSummaryWithName
in interface IConversationSummaryProvider<T extends MessageContent>