// Path: app/src/main/java/com/turo/ktalk/controller/activity/ChatActivity.java
// public class ChatActivity extends FragmentActivity {
// 
//     private String mHxid;
//     private EaseChatFragment easeChatFragment;
//     private LocalBroadcastManager mLocalBroadcastManager;
//     private int mChatType;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_chat);
// 
//         intiData();
// 
//         initListener();
//     }
// 
//     private void initListener() {
//         easeChatFragment.setChatFragmentListener(new EaseChatFragment.EaseChatFragmentHelper() {
//             @Override
//             public void onSetMessageAttributes(EMMessage message) {
// 
//             }
// 
//             @Override
//             public void onEnterToChatDetails() {
//                 Intent intent = new Intent(ChatActivity.this, GroupDetailActivity.class);
//                 // 群id
//                 intent.putExtra(Constant.GROUP_ID, mHxid);
//                 startActivity(intent);
//             }
// 
//             @Override
//             public void onAvatarClick(String username) {
// 
//             }
// 
//             @Override
//             public void onAvatarLongClick(String username) {
// 
//             }
// 
//             @Override
//             public boolean onMessageBubbleClick(EMMessage message) {
//                 return false;
//             }
// 
//             @Override
//             public void onMessageBubbleLongClick(EMMessage message) {
//             }
// 
//             @Override
//             public boolean onExtendMenuItemClick(int itemId, View view) {
//                 return false;
//             }
// 
//             @Override
//             public EaseCustomChatRowProvider onSetCustomChatRowProvider() {
//                 return null;
//             }
//         });
// 
//         // 如果当前类型为群聊
//         if(mChatType == EaseConstant.CHATTYPE_GROUP) {
// 
//             // 注册退群广播
//             BroadcastReceiver ExitGroupReceiver = new BroadcastReceiver() {
//                 @Override
//                 public void onReceive(Context context, Intent intent) {
// 
//                     if(mHxid.equals(intent.getStringExtra(Constant.GROUP_ID))) {
//                         // 结束当前页面
//                         finish();
//                     }
//                 }
//             };
// 
//             mLocalBroadcastManager.registerReceiver(ExitGroupReceiver, new IntentFilter(Constant.EXIT_GROUP));
//         }
//     }
// 
//     private void intiData() {
//         // 创建一个会话的fragment
//         easeChatFragment = new EaseChatFragment();
// 
//         mHxid = getIntent().getStringExtra(EaseConstant.EXTRA_USER_ID);
// 
//         // 获取聊天类型
//         mChatType = getIntent().getExtras().getInt(EaseConstant.EXTRA_CHAT_TYPE);
// 
//         easeChatFragment.setArguments(getIntent().getExtras());
// 
//         // 替换fragment
//         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//         transaction.replace(R.id.fl_chat, easeChatFragment).commit();
// 
//         // 获取发送广播的管理者
//         mLocalBroadcastManager = LocalBroadcastManager.getInstance(ChatActivity.this);
//     }
// }


import android.content.Intent;
import com.hyphenate.EMMessageListener;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMConversation;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.easeui.EaseConstant;
import com.hyphenate.easeui.controller.EaseUI;
import com.hyphenate.easeui.ui.EaseConversationListFragment;
import com.turo.ktalk.controller.activity.ChatActivity;
import java.util.List;
package com.turo.ktalk.controller.fragment;




/**
 * Created by YQ950209 on 2017/4/24.
 */
//会话列表页面
public class ChatFragment extends EaseConversationListFragment {

    @Override
    protected void initView() {
        super.initView();

        // 跳转到会话详情页面
        setConversationListItemClickListener(new EaseConversationListItemClickListener() {
            @Override
            public void onListItemClicked(EMConversation conversation) {
// Path: app/src/main/java/com/turo/ktalk/controller/activity/ChatActivity.java
// public class ChatActivity extends FragmentActivity {
// 
//     private String mHxid;
//     private EaseChatFragment easeChatFragment;
//     private LocalBroadcastManager mLocalBroadcastManager;
//     private int mChatType;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_chat);
// 
//         intiData();
// 
//         initListener();
//     }
// 
//     private void initListener() {
//         easeChatFragment.setChatFragmentListener(new EaseChatFragment.EaseChatFragmentHelper() {
//             @Override
//             public void onSetMessageAttributes(EMMessage message) {
// 
//             }
// 
//             @Override
//             public void onEnterToChatDetails() {
//                 Intent intent = new Intent(ChatActivity.this, GroupDetailActivity.class);
//                 // 群id
//                 intent.putExtra(Constant.GROUP_ID, mHxid);
//                 startActivity(intent);
//             }
// 
//             @Override
//             public void onAvatarClick(String username) {
// 
//             }
// 
//             @Override
//             public void onAvatarLongClick(String username) {
// 
//             }
// 
//             @Override
//             public boolean onMessageBubbleClick(EMMessage message) {
//                 return false;
//             }
// 
//             @Override
//             public void onMessageBubbleLongClick(EMMessage message) {
//             }
// 
//             @Override
//             public boolean onExtendMenuItemClick(int itemId, View view) {
//                 return false;
//             }
// 
//             @Override
//             public EaseCustomChatRowProvider onSetCustomChatRowProvider() {
//                 return null;
//             }
//         });
// 
//         // 如果当前类型为群聊
//         if(mChatType == EaseConstant.CHATTYPE_GROUP) {
// 
//             // 注册退群广播
//             BroadcastReceiver ExitGroupReceiver = new BroadcastReceiver() {
//                 @Override
//                 public void onReceive(Context context, Intent intent) {
// 
//                     if(mHxid.equals(intent.getStringExtra(Constant.GROUP_ID))) {
//                         // 结束当前页面
//                         finish();
//                     }
//                 }
//             };
// 
//             mLocalBroadcastManager.registerReceiver(ExitGroupReceiver, new IntentFilter(Constant.EXIT_GROUP));
//         }
//     }
// 
//     private void intiData() {
//         // 创建一个会话的fragment
//         easeChatFragment = new EaseChatFragment();
// 
//         mHxid = getIntent().getStringExtra(EaseConstant.EXTRA_USER_ID);
// 
//         // 获取聊天类型
//         mChatType = getIntent().getExtras().getInt(EaseConstant.EXTRA_CHAT_TYPE);
// 
//         easeChatFragment.setArguments(getIntent().getExtras());
// 
//         // 替换fragment
//         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//         transaction.replace(R.id.fl_chat, easeChatFragment).commit();
// 
//         // 获取发送广播的管理者
//         mLocalBroadcastManager = LocalBroadcastManager.getInstance(ChatActivity.this);
//     }
// }


// Path: app/src/main/java/com/turo/ktalk/controller/fragment/ChatFragment.java
import android.content.Intent;
import com.hyphenate.EMMessageListener;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMConversation;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.easeui.EaseConstant;
import com.hyphenate.easeui.controller.EaseUI;
import com.hyphenate.easeui.ui.EaseConversationListFragment;
import com.turo.ktalk.controller.activity.ChatActivity;
import java.util.List;

package com.turo.ktalk.controller.fragment;




/**
 * Created by YQ950209 on 2017/4/24.
 */
//会话列表页面
public class ChatFragment extends EaseConversationListFragment {

    @Override
    protected void initView() {
        super.initView();

        // 跳转到会话详情页面
        setConversationListItemClickListener(new EaseConversationListItemClickListener() {
            @Override
            public void onListItemClicked(EMConversation conversation) {
                Intent intent = new Intent(getActivity(), ChatActivity.class);