@Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub BmobRecent recent = adapter.getItem(position); showDeleteDialog(recent); return true; }
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub BmobRecent recent = adapter.getItem(position); // 重置未读消息 BmobDB.create(getActivity()).resetUnread(recent.getTargetid()); // 组装聊天对象 BmobChatUser user = new BmobChatUser(); user.setAvatar(recent.getAvatar()); user.setNick(recent.getNick()); user.setUsername(recent.getUserName()); user.setObjectId(recent.getTargetid()); Intent intent = new Intent(getActivity(), ChatActivity.class); intent.putExtra("user", user); startAnimActivity(intent); }
/** * 删除会话 deleteRecent * * @param @param recent * @return void * @throws */ private void deleteRecent(BmobRecent recent) { adapter.remove(recent); BmobDB.create(getActivity()).deleteRecent(recent.getTargetid()); BmobDB.create(getActivity()).deleteMessages(recent.getTargetid()); }