Exemplo n.º 1
0
  // 数据同步
  private void sync() {

    mComversation.sync(
        new SyncListener() {

          @Override
          public void onSendUserReply(List<Reply> replyList) {}

          @Override
          public void onReceiveDevReply(List<Reply> replyList) {
            // SwipeRefreshLayout停止刷新
            mSwipeRefreshLayout.setRefreshing(false);
            // 发送消息,刷新ListView
            mHandler.sendMessage(new Message());
            // 如果开发者没有新的回复数据,则返回
            if (replyList == null || replyList.size() < 1) {
              return;
            }
          }
        });
    // 更新adapter,刷新ListView
    adapter.notifyDataSetChanged();
    mListView.smoothScrollToPosition(mComversation.getReplyList().size());
  }
Exemplo n.º 2
0
 private void scrollToBottom() {
   if (adapter.getCount() > 0) {
     mListView.smoothScrollToPosition(adapter.getCount());
   }
 }
Exemplo n.º 3
0
 @Override
 public void handleMessage(Message msg) {
   adapter.notifyDataSetChanged();
 }