use of com.juns.wechat.MainActivity in project wechat by motianhuo.
the class Fragment_Msg method onItemClick.
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (adpter.PublicMsg != null && position == 0) {
// 打开订阅号列表页面
Utils.start_Activity(getActivity(), PublishMsgListActivity.class);
} else {
((MainActivity) getActivity()).updateUnreadLabel();
EMConversation conversation = conversationList.get(position);
Intent intent = new Intent(getActivity(), ChatActivity.class);
Hashtable<String, String> ChatRecord = adpter.getChatRecord();
if (ChatRecord != null) {
if (conversation.isGroup()) {
GroupInfo info = GloableParams.GroupInfos.get(conversation.getUserName());
if (info != null) {
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_GROUP);
intent.putExtra(Constants.GROUP_ID, info.getGroup_id());
// 设置标题
intent.putExtra(Constants.NAME, info.getGroup_name());
getActivity().startActivity(intent);
} else {
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_GROUP);
intent.putExtra(Constants.GROUP_ID, info.getGroup_id());
// 设置标题
intent.putExtra(Constants.NAME, R.string.group_chats);
getActivity().startActivity(intent);
}
} else {
User user = GloableParams.Users.get(conversation.getUserName());
if (user != null) {
// 设置昵称
intent.putExtra(Constants.NAME, user.getUserName());
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_SINGLE);
intent.putExtra(Constants.User_ID, conversation.getUserName());
getActivity().startActivity(intent);
} else {
intent.putExtra(Constants.NAME, "好友");
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_SINGLE);
intent.putExtra(Constants.User_ID, conversation.getUserName());
getActivity().startActivity(intent);
}
}
}
}
}
Aggregations