private void doUnFavorite(final int position) { Map<String, Object> params = new LinkedHashMap<String, Object>(); params.put("feed_id", adapter.getItem(position).feed_id); UIHelper.reqGetData( act, DoUnFavoriteBean.class, params, null, new IResponseListener() { @Override public void onSuccess(Object o) { DoUnFavoriteBean bean = (DoUnFavoriteBean) o; if (bean.status == 1) { act.showToast("收藏成功"); adapter.getItem(position).iscoll.colled = "1"; adapter.notifyDataSetChanged(); } } @Override public void onReqStart() {} @Override public void onFinish() {} @Override public void onFailure(Object arg0) {} }); }
private void getData(final boolean isRefresh) { if (isRefresh) { pageNum = 1; } Map<String, Object> params = new LinkedHashMap<String, Object>(); // if (page == 2) { // params.put("uid", getMyApplication().userBean.data.profile.uid + ""); // } params.put("page", pageNum++ + ""); params.put("count", count + ""); if (page == 4) { params.put("t", "feed"); } else if (page == 5) { params.put("t", "comment"); } if (!StringUtils.isEmpty(fromUid)) params.put("uid", fromUid); UIHelper.reqGetData( act, WeiboBean.class, params, 3, new IResponseListener() { @Override public void onSuccess(Object o) { WeiboBean data = (WeiboBean) o; List<WeiboListItem> list = data.data.weibolist; if (list != null && list.size() > 0) { if (isRefresh) { if (list.size() < 10) { listview.setIsLoadFull(true); } else { listview.setIsLoadFull(false); } if (StringUtils.isEmpty(fromUid)) { new Thread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub db.deleteByWhere(WeiboDao.class, "type=" + page + " and uid=" + uid); WeiboDao dao = null; for (WeiboListItem item : adapter.getList()) { dao = new WeiboDao(); dao.setJson(gson.toJson(item)); dao.setType(page); dao.setUid(uid); db.save(dao); } } }) .start(); } adapter.clear(); adapter.addAllFirst(list); } else { if (list.size() < 10) { listview.setIsLoadFull(true); } else { listview.setIsLoadFull(false); } adapter.addAll(list); } adapter.notifyDataSetChanged(); } } @Override public void onReqStart() {} @Override public void onFinish() { listview.finishRefresh(); listview.finishLoadMore(); } @Override public void onFailure(Object arg0) {} }); }