@Override public void onResume() { super.onResume(); if (!hidden) { refresh(); if (adapter != null) { conversationList.clear(); conversationList.addAll(loadConversationsWithRecentChat()); if (conversationList.size() == 0) { return; } if (data == null || data.getSaledetail() == null) { return; } for (int i = 0; i < conversationList.size(); i++) { EMConversation emcon = conversationList.get(i); if (TextUtils.equals(emcon.getUserName(), data.getSaledetail().getS_imid())) { if (headView != null) { listView.removeHeaderView(headView); listView.setAdapter(adapter); } } } } } }
@Override public void handleMsg(Message msg) { String json = msg.getData().getString(Constant.JSON_DATA); if (TextUtils.equals(json, getString(R.string.try_agin))) { setRefreFalse(); return; } switch (msg.what) { case TAG_SALE_BUSSINESS_LIST: data = JosnUtil.gson.fromJson(json, new TypeToken<KeFuData>() {}.getType()); if (TextUtils.equals("0", data.getResult())) { break; } if (listView.getHeaderViewsCount() < 1) { break; } ((TextView) headView.findViewById(R.id.name)).setText(data.getSaledetail().getS_showname()); ((TextView) headView.findViewById(R.id.time)) .setText(MethodUtils.returnTime(data.getSaledetail().getS_lastim())); if (TextUtils.equals("0", data.getSaledetail().getS_sex())) { ((ImageView) headView.findViewById(R.id.avatar)).setImageResource(R.mipmap.male_yewu); } else { ((ImageView) headView.findViewById(R.id.avatar)).setImageResource(R.mipmap.meal_yewu); } if (adapter != null) { conversationList.clear(); conversationList.addAll(loadConversationsWithRecentChat()); for (int i = 0; i < conversationList.size(); i++) { EMConversation emcon = conversationList.get(i); if (TextUtils.equals(emcon.getUserName(), data.getSaledetail().getS_imid())) { if (headView != null) { listView.removeHeaderView(headView); listView.setAdapter(adapter); } } } } break; } }