public void sendInfoToUmeng(String content) { String contact = currentAccount.getPhone() == null ? currentAccount.getEmail() : currentAccount.getPhone(); UserInfo info = new UserInfo(); Map<String, String> map = info.getContact(); if (map == null) map = new HashMap<String, String>(); map.put("plain", contact); info.setContact(map); agent.setUserInfo(info); defaultConversation = agent.getDefaultConversation(); defaultConversation.addUserReply(content); defaultConversation.sync(this); }
// 数据同步 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()); }
// 数据同步 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 adapter.notifyDataSetChanged(); scrollToBottom(); } }); }
// 数据同步 private void sync() { mComversation.sync( new SyncListener() { @Override public void onSendUserReply(List<Reply> replyList) {} @Override public void onReceiveDevReply(List<Reply> replyList) { AppLockApplication appLockApplication = AppLockApplication.getInstance(); int count = appLockApplication.getReplySize(); if (replyList != null) { count += replyList.size(); } appLockApplication.setReplySize(count); setReplySize(count); } }); }