Exemplo n.º 1
0
  public void refreshSession(String uid) {

    for (ChattingPeople people : adapter.getChattingPeoples()) {

      if (people.getPeople().equals(uid)) {

        adapter.getChattingPeoples().remove(people);

        people = chattPeopleService.findByUid(uid, hostUid);

        adapter.getChattingPeoples().add(0, people);

        break;
      }
    }
  }
Exemplo n.º 2
0
        public void handleMessage(android.os.Message msg) {
          // 取得这个消息表明在聊天窗口,更新聊天记录
          if (msg.what == CustomConst.HANDLER_CHATPEOPLE_LIST_UPDATE) {

            String uid = (String) msg.obj;

            refreshSession(uid);

            adapter.notifyDataSetChanged();

            // 取得这个消息表明原先没有这个会话,在消息列添加
          } else if (msg.what == CustomConst.HANDLER_CHATPEOPLE_LIST_ADD) {

            String uid = (String) msg.obj;
            // 将该会话如果要打开聊天窗口,要获取的聊天记录页数
            PiLinApplication.mUsrChatMsgPage.put(uid, 1);

            cPeopleDAO.save(uid, hostUid);

            adapter.getChattingPeoples().add(chattPeopleService.findByUid(uid, hostUid));

            adapter.notifyDataSetChanged();
          }
        }