public class ConversationListFragment extends UriFragment implements android.widget.AdapterView.OnItemClickListener, android.widget.AdapterView.OnItemLongClickListener, ConversationListAdapter.OnPortraitItemClick, RongSwipeRefreshLayout.OnLoadListener, RongSwipeRefreshLayout.OnFlushListener
UriFragment.IActionBarHandler
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
TAG |
RONG_URI
UI_RESTORE
构造器和说明 |
---|
ConversationListFragment() |
限定符和类型 | 方法和说明 |
---|---|
void |
focusUnreadItem()
定位会话列表中的某一条未读会话。
|
void |
getConversationList(ConversationType[] conversationTypes,
IHistoryDataResultCallback<java.util.List<Conversation>> callback,
boolean isLoadMore)
开发者可以重写此方法,来填充自定义数据到会话列表界面。
|
boolean |
getGatherState(Conversation.ConversationType conversationType) |
protected void |
initFragment(android.net.Uri uri) |
protected java.util.List<android.view.View> |
onAddHeaderView()
会话列表添加头部
|
boolean |
onBackPressed() |
void |
onCreate(android.os.Bundle savedInstanceState) |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
onDestroy() |
void |
onEventMainThread(ConversationStatus[] conversationStatus) |
void |
onEventMainThread(Discussion discussion) |
void |
onEventMainThread(Event.AudioListenedEvent event) |
void |
onEventMainThread(Event.MessageLeftEvent event) |
void |
onEventMainThread(Event.MessageRecallEvent event) |
void |
onEventMainThread(Event.OnReceiveMessageEvent event) |
void |
onEventMainThread(Event.ReadReceiptEvent event)
仅处理非聚合状态,显示已读回执标志。
|
void |
onEventMainThread(Event.RemoteMessageRecallEvent event) |
void |
onEventMainThread(Event.SyncReadStatusEvent event) |
void |
onEventMainThread(Group groupInfo) |
void |
onEventMainThread(Message message) |
void |
onEventMainThread(PublicServiceProfile profile) |
void |
onEventMainThread(RongIMClient.ConnectionStatusListener.ConnectionStatus status) |
void |
onEventMainThread(UserInfo userInfo) |
void |
onFinishLoadConversationList(int leftOfflineMsg)
当会话列表加载完成时回调此方法,告诉加载完成的时机
|
void |
onFlush() |
void |
onItemClick(android.widget.AdapterView<?> parent,
android.view.View view,
int position,
long id) |
boolean |
onItemLongClick(android.widget.AdapterView<?> parent,
android.view.View view,
int position,
long id) |
void |
onLoad() |
void |
onPortraitItemClick(android.view.View v,
UIConversation data) |
boolean |
onPortraitItemLongClick(android.view.View v,
UIConversation data) |
void |
onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults) |
ConversationListAdapter |
onResolveAdapter(android.content.Context context)
提供 ListView 的 Adapter 适配器。
|
void |
onResume() |
void |
onUIConversationCreated(UIConversation uiConversation)
UIConversation 被创建成功,adapter 会根据 UIConversation 中的数据展示在 UI 上
|
void |
onUnreadCountChanged()
会话列表未读数发生变化时回调此方法,告诉未读数变化的时机
可以重写此方法,当未读数发生变化时,通过 adapter 中的 item 数据计算未读数量
|
void |
setAdapter(ConversationListAdapter adapter)
已过时。
此方法已经废弃,可以使用
onResolveAdapter(Context) 代替 |
boolean |
shouldFilterConversation(ConversationType type,
java.lang.String targetId)
会话列表界面是否过滤某一会话,过滤之后,用户往该会话发送消息,也不会在会话列表展示
|
boolean |
shouldUpdateConversation(Message message,
int left)
接收到消息,先调用此方法,检查是否可以更新消息对应的会话。
|
void |
updateListItem(UIConversation uiConversation)
根据指定的 uiconversation 刷新 list view 中 item
|
getActionBarHandler, getUri, obtainUriBundle, onPause, onRestoreUI, onSaveInstanceState, onViewCreated, setActionBarHandler, setUri
findViewById, getHandler, handleMessage
public void onCreate(android.os.Bundle savedInstanceState)
onCreate
在类中 UriFragment
protected void initFragment(android.net.Uri uri)
initFragment
在类中 UriFragment
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
public void onResume()
onResume
在类中 UriFragment
public void getConversationList(ConversationType[] conversationTypes, IHistoryDataResultCallback<java.util.List<Conversation>> callback, boolean isLoadMore)
注意:通过 callback 返回的数据要保证在 UI 线程返回。
conversationTypes
- 当前会话列表已配置显示的会话类型。public void focusUnreadItem()
public boolean onBackPressed()
onBackPressed
在类中 UriFragment
protected java.util.List<android.view.View> onAddHeaderView()
@Deprecated public void setAdapter(ConversationListAdapter adapter)
onResolveAdapter(Context)
代替adapter
- 适配器public ConversationListAdapter onResolveAdapter(android.content.Context context)
ConversationListFragment
并重写此方法。
注意:提供的适配器,要继承自 ConversationListAdapter
public void onEventMainThread(Event.SyncReadStatusEvent event)
public void onEventMainThread(Event.ReadReceiptEvent event)
event
- 已读回执事件public void onEventMainThread(Event.AudioListenedEvent event)
public boolean shouldUpdateConversation(Message message, int left)
message
- 接收到的消息体。left
- 剩余的消息数量。public boolean shouldFilterConversation(ConversationType type, java.lang.String targetId)
type
- 会话类型targetId
- 会话的目标Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。public void onUnreadCountChanged()
public void onFinishLoadConversationList(int leftOfflineMsg)
leftOfflineMsg
- 剩余离线消息数量public void onUIConversationCreated(UIConversation uiConversation)
uiConversation
- public void updateListItem(UIConversation uiConversation)
uiConversation
- 指定的 uiconversationpublic void onEventMainThread(Event.OnReceiveMessageEvent event)
public void onEventMainThread(Event.MessageLeftEvent event)
public void onEventMainThread(Event.MessageRecallEvent event)
public void onEventMainThread(Event.RemoteMessageRecallEvent event)
public void onEventMainThread(Message message)
public void onEventMainThread(RongIMClient.ConnectionStatusListener.ConnectionStatus status)
public void onEventMainThread(Group groupInfo)
public void onEventMainThread(Discussion discussion)
public void onEventMainThread(UserInfo userInfo)
public void onEventMainThread(PublicServiceProfile profile)
public void onPortraitItemClick(android.view.View v, UIConversation data)
public boolean onPortraitItemLongClick(android.view.View v, UIConversation data)
public void onItemClick(android.widget.AdapterView<?> parent, android.view.View view, int position, long id)
onItemClick
在接口中 android.widget.AdapterView.OnItemClickListener
public boolean onItemLongClick(android.widget.AdapterView<?> parent, android.view.View view, int position, long id)
onItemLongClick
在接口中 android.widget.AdapterView.OnItemLongClickListener
public boolean getGatherState(Conversation.ConversationType conversationType)
public void onLoad()
onLoad
在接口中 RongSwipeRefreshLayout.OnLoadListener
public void onFlush()
public void onDestroy()
onDestroy
在类中 BaseFragment
public void onRequestPermissionsResult(int requestCode, java.lang.String[] permissions, int[] grantResults)
public void onEventMainThread(ConversationStatus[] conversationStatus)