private void updateTimeLineMessageCommentAndRepostData(List<MessageReCmtCountBean> value) { if (getList().getSize() <= value.size()) { return; } for (int i = 0; i < value.size(); i++) { MessageBean msg = getList().getItem(i); MessageReCmtCountBean count = value.get(i); if (msg != null && msg.getId().equals(count.getId())) { msg.setReposts_count(count.getReposts()); msg.setComments_count(count.getComments()); } } getAdapter().notifyDataSetChanged(); FriendsTimeLineDBTask.asyncReplace(getList(), accountBean.getUid(), currentGroupId); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // use Up instead of Back to reach this fragment if (data == null) { return; } final MessageBean msg = (MessageBean) data.getParcelableExtra("msg"); if (msg != null) { for (int i = 0; i < getList().getSize(); i++) { if (msg.equals(getList().getItem(i))) { MessageBean ori = getList().getItem(i); if (ori.getComments_count() != msg.getComments_count() || ori.getReposts_count() != msg.getReposts_count()) { ori.setReposts_count(msg.getReposts_count()); ori.setComments_count(msg.getComments_count()); FriendsTimeLineDBTask.asyncUpdateCount( msg.getId(), msg.getComments_count(), msg.getReposts_count()); getAdapter().notifyDataSetChanged(); } break; } } } }