本文整理汇总了Java中com.hyphenate.chat.EMConversation类的典型用法代码示例。如果您正苦于以下问题:Java EMConversation类的具体用法?Java EMConversation怎么用?Java EMConversation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMConversation类属于com.hyphenate.chat包,在下文中一共展示了EMConversation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sortConversationByLastChatTime
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* sort conversations according time stamp of last message
*
* @param conversationList
*/
private void sortConversationByLastChatTime(List<Pair<Long, EMConversation>> conversationList) {
Collections.sort(conversationList, new Comparator<Pair<Long, EMConversation>>() {
@Override
public int compare(final Pair<Long, EMConversation> con1, final Pair<Long, EMConversation> con2) {
if (con1.first.equals(con2.first)) {
return 0;
} else if (con2.first.longValue() > con1.first.longValue()) {
return 1;
} else {
return -1;
}
}
});
}
开发者ID:turoDog,项目名称:KTalk,代码行数:22,代码来源:EaseConversationListFragment.java
示例2: getAllUnReadMessageNum
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
private void getAllUnReadMessageNum(){
int total = 0;
if(mConversationList != null){
for (int i = 0; i < mConversationList.size(); i++) {
EMConversation conversation = mConversationList.get(i);
int unreadMsgCount = conversation.getUnreadMsgCount();
total = total + unreadMsgCount;
}
}
UserSharedPreferences.putUnReadMessage(getContext(),total);
Intent unreadIntent = new Intent();
unreadIntent.setAction(ACTION_REFRESH_UNREAD_MSG);
getContext().sendBroadcast(unreadIntent);
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:17,代码来源:MessageFragment.java
示例3: sortConversationByLastChatTime
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* 根据最后一条消息的时间排序
*/
private void sortConversationByLastChatTime(List<Pair<Long, EMConversation>> conversationList) {
Collections.sort(conversationList, new Comparator<Pair<Long, EMConversation>>() {
@Override
public int compare(final Pair<Long, EMConversation> con1, final Pair<Long, EMConversation> con2) {
if (con1.first.equals(con2.first)) {
return 0;
} else if (con2.first.longValue() > con1.first.longValue()) {
return 1;
} else {
return -1;
}
}
});
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:20,代码来源:MessageFragment.java
示例4: loadAllConversations
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
public void loadAllConversations() {
ThreadUtils.runOnBackgroundThread(new Runnable() {
@Override
public void run() {
Map<String, EMConversation> conversations = EMClient.getInstance().chatManager().getAllConversations();
mEMConversations.clear();
mEMConversations.addAll(conversations.values());
//根据最后一条消息的时间进行排序
Collections.sort(mEMConversations, new Comparator<EMConversation>() {
@Override
public int compare(EMConversation o1, EMConversation o2) {
return (int) (o2.getLastMessage().getMsgTime() - o1.getLastMessage().getMsgTime());
}
});
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
mConversationView.onAllConversationsLoaded();
}
});
}
});
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:25,代码来源:ConversationPresenterImpl.java
示例5: loadMessages
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
public void loadMessages(final String userName) {
ThreadUtils.runOnBackgroundThread(new Runnable() {
@Override
public void run() {
EMConversation conversation = EMClient.getInstance().chatManager().getConversation(userName);
if (conversation != null) {
//获取此会话的所有消息
List<EMMessage> messages = conversation.getAllMessages();
mEMMessageList.addAll(messages);
//指定会话消息未读数清零
conversation.markAllMessagesAsRead();
}
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
mChatView.onMessagesLoaded();
}
});
}
});
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:23,代码来源:ChatPresenterImpl.java
示例6: sortConversationByLastChatTime
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* sort conversations according time stamp of last message
*
* @param conversationList
*/
private void sortConversationByLastChatTime(List<Pair<Long, EMConversation>> conversationList) {
Collections.sort(conversationList, new Comparator<Pair<Long, EMConversation>>() {
@Override
public int compare(final Pair<Long, EMConversation> con1, final Pair<Long, EMConversation> con2) {
if (con1.first.equals(con2.first)) {
return 0;
} else if (con2.first.longValue() > con1.first.longValue()) {
return 1;
} else {
return -1;
}
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:22,代码来源:EaseConversationListFragment.java
示例7: searchMessages
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
private void searchMessages(){
pd = new ProgressDialog(this);
pd.setMessage(getString(R.string.searching));
pd.setCanceledOnTouchOutside(false);
pd.show();
new Thread(new Runnable() {
public void run() {
EMConversation conversation = EMClient.getInstance().chatManager().getConversation(groupId);
List<EMMessage> resultList = conversation.searchMsgFromDB(query.getText().toString(), System.currentTimeMillis(), 50, null, EMSearchDirection.UP);
if(messageList == null){
messageList = resultList;
}else{
messageList.clear();
messageList.addAll(resultList);
}
onSearchResulted();
}
}).start();
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:20,代码来源:GroupSearchMessageActivity.java
示例8: sortConversationByLastChatTime
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* 根据最后一条消息的时间排序
*
* @param usernames
*/
private void sortConversationByLastChatTime(List<Pair<Long, EMConversation>> conversationList) {
Collections.sort(conversationList, new Comparator<Pair<Long, EMConversation>>() {
@Override
public int compare(final Pair<Long, EMConversation> con1, final Pair<Long, EMConversation> con2) {
if (con1.first == con2.first) {
return 0;
} else if (con2.first > con1.first) {
return 1;
} else {
return -1;
}
}
});
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:22,代码来源:EaseConversationListFragment.java
示例9: sortConversationByLastChatTime
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* sort conversations according time stamp of last message
*
* @param conversationList
*/
private void sortConversationByLastChatTime(List<Pair<Long, EMConversation>> conversationList) {
Collections.sort(conversationList, new Comparator<Pair<Long, EMConversation>>() {
@Override
public int compare(final Pair<Long, EMConversation> con1, final Pair<Long, EMConversation> con2) {
if (con1.first == con2.first) {
return 0;
} else if (con2.first > con1.first) {
return 1;
} else {
return -1;
}
}
});
}
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:22,代码来源:EaseConversationListFragment.java
示例10: onContextItemSelected
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
boolean deleteMessage = false;
if (item.getItemId() == R.id.delete_message) {
deleteMessage = true;
} else if (item.getItemId() == R.id.delete_conversation) {
deleteMessage = false;
}
EMConversation tobeDeleteCons = conversationListView.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
if (tobeDeleteCons == null) {
return true;
}
try {
// delete conversation
EMClient.getInstance().chatManager().deleteConversation(tobeDeleteCons.getUserName(), deleteMessage);
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteCons.getUserName());
} catch (Exception e) {
e.printStackTrace();
}
refresh();
// update unread count
((MainActivity) getActivity()).updateUnreadLabel();
return true;
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:27,代码来源:ConversationListFragment.java
示例11: sortConversationByLastChatTime
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* 根据最后一条消息的时间排序
*
* @param
*/
private void sortConversationByLastChatTime(List<Pair<Long, EMConversation>> conversationList) {
Collections.sort(conversationList, new Comparator<Pair<Long, EMConversation>>() {
@Override
public int compare(final Pair<Long, EMConversation> con1, final Pair<Long, EMConversation> con2) {
if (con1.first == con2.first) {
return 0;
} else if (con2.first > con1.first) {
return 1;
} else {
return -1;
}
}
});
}
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:22,代码来源:ChatListFragment.java
示例12: onCreate
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.activity_main);
unreadLabel = (TextView) findViewById(R.id.unread_msg_number);
mTabs = new Button[3];
mTabs[0] = (Button) findViewById(R.id.btn_conversation);
mTabs[1] = (Button) findViewById(R.id.btn_address_list);
mTabs[2] = (Button) findViewById(R.id.btn_setting);
// set first tab as selected
mTabs[0].setSelected(true);
conversationListFragment = new EaseConversationListFragment();
contactListFragment = new EaseContactListFragment();
settingFragment = new SettingsFragment();
contactListFragment.setContactsMap(getContacts());
conversationListFragment.setConversationListItemClickListener(new EaseConversationListItemClickListener() {
@Override
public void onListItemClicked(EMConversation conversation) {
startActivity(new Intent(MainActivity.this, ChatActivity.class).putExtra(EaseConstant.EXTRA_USER_ID, conversation.getUserName()));
}
});
contactListFragment.setContactListItemClickListener(new EaseContactListItemClickListener() {
@Override
public void onListItemClicked(EaseUser user) {
startActivity(new Intent(MainActivity.this, ChatActivity.class).putExtra(EaseConstant.EXTRA_USER_ID, user.getUsername()));
}
});
fragments = new Fragment[] { conversationListFragment, contactListFragment, settingFragment };
// add and show first fragment
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, conversationListFragment)
.add(R.id.fragment_container, contactListFragment).hide(contactListFragment).show(conversationListFragment)
.commit();
}
开发者ID:turoDog,项目名称:KTalk,代码行数:38,代码来源:MainActivity.java
示例13: EaseConversationAdapter
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
public EaseConversationAdapter(Context context, int resource,
List<EMConversation> objects) {
super(context, resource, objects);
conversationList = objects;
copyConversationList = new ArrayList<EMConversation>();
copyConversationList.addAll(objects);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:8,代码来源:EaseConversationAdapter.java
示例14: getItem
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
public EMConversation getItem(int arg0) {
if (arg0 < conversationList.size()) {
return conversationList.get(arg0);
}
return null;
}
开发者ID:turoDog,项目名称:KTalk,代码行数:8,代码来源:EaseConversationAdapter.java
示例15: publishResults
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
conversationList.clear();
if (results.values != null) {
conversationList.addAll((List<EMConversation>) results.values);
}
if (results.count > 0) {
notiyfyByFilter = true;
notifyDataSetChanged();
} else {
notifyDataSetInvalidated();
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:EaseConversationAdapter.java
示例16: loadConversationList
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
/**
* load conversation list
*
* @return
+ */
protected List<EMConversation> loadConversationList(){
// get all conversations
Map<String, EMConversation> conversations = EMClient.getInstance().chatManager().getAllConversations();
List<Pair<Long, EMConversation>> sortList = new ArrayList<Pair<Long, EMConversation>>();
/**
* lastMsgTime will change if there is new message during sorting
* so use synchronized to make sure timestamp of last message won't change.
*/
synchronized (conversations) {
for (EMConversation conversation : conversations.values()) {
if (conversation.getAllMessages().size() != 0) {
sortList.add(new Pair<Long, EMConversation>(conversation.getLastMessage().getMsgTime(), conversation));
}
}
}
try {
// Internal is TimSort algorithm, has bug
sortConversationByLastChatTime(sortList);
} catch (Exception e) {
e.printStackTrace();
}
List<EMConversation> list = new ArrayList<EMConversation>();
for (Pair<Long, EMConversation> sortItem : sortList) {
list.add(sortItem.second);
}
return list;
}
开发者ID:turoDog,项目名称:KTalk,代码行数:33,代码来源:EaseConversationListFragment.java
示例17: init
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
public void init(List<EMConversation> conversationList, EaseConversationListHelper helper){
conversations = conversationList;
if(helper != null){
this.conversationListHelper = helper;
}
adapter = new EaseConversationAdapter(context, 0, conversationList);
adapter.setCvsListHelper(conversationListHelper);
adapter.setPrimaryColor(primaryColor);
adapter.setPrimarySize(primarySize);
adapter.setSecondaryColor(secondaryColor);
adapter.setSecondarySize(secondarySize);
adapter.setTimeColor(timeColor);
adapter.setTimeSize(timeSize);
setAdapter(adapter);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:16,代码来源:EaseConversationList.java
示例18: initView
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
@Override
protected void initView() {
super.initView();
// 跳转到会话详情页面
setConversationListItemClickListener(new EaseConversationListItemClickListener() {
@Override
public void onListItemClicked(EMConversation conversation) {
Intent intent = new Intent(getActivity(), ChatActivity.class);
// 传递参数
intent.putExtra(EaseConstant.EXTRA_USER_ID, conversation.conversationId());
// 是否是群聊
if(conversation.getType() == EMConversation.EMConversationType.GroupChat) {
intent.putExtra(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_GROUP);
}
startActivity(intent);
}
});
// 清空集合数据
conversationList.clear();
// 监听会话消息
EMClient.getInstance().chatManager().addMessageListener(emMessageListener);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:29,代码来源:ChatFragment.java
示例19: init
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
public void init(List<EMConversation> conversationList, EaseConversationList.EaseConversationListHelper helper){
conversations = conversationList;
if(helper != null){
this.conversationListHelper = helper;
}
adapter = new EaseConversationAdapter(context, 0, conversationList,mConversationDeleteClickListener);
adapter.setCvsListHelper(conversationListHelper);
adapter.setPrimaryColor(primaryColor);
adapter.setPrimarySize(primarySize);
adapter.setSecondaryColor(secondaryColor);
adapter.setSecondarySize(secondarySize);
adapter.setTimeColor(timeColor);
adapter.setTimeSize(timeSize);
setAdapter(adapter);
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:16,代码来源:EaseConversationList.java
示例20: EaseConversationAdapter
import com.hyphenate.chat.EMConversation; //导入依赖的package包/类
public EaseConversationAdapter(Context context, int resource,
List<EMConversation> objects,
ConversationDeleteClickListener conversationDeleteClickListener) {
super(context, resource, objects);
mEaseUserModel = new EaseUserModel(context);
conversationList = objects;
copyConversationList = new ArrayList<EMConversation>();
copyConversationList.addAll(objects);
mConversationDeleteClickListener = conversationDeleteClickListener;
mOvLoad=new OvLoad();
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:12,代码来源:EaseConversationAdapter.java
注:本文中的com.hyphenate.chat.EMConversation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论