/** * @param mode * @param newStatus */ private void refreshList(int mode, List<Status> newStatus) { if (newStatus != null) { if (newStatus.size() > 0) { switch (mode) { case Task.TA_GETSTATUS_MODE_FIRSTTIME: currentStatus = newStatus; adapter = new TaskAdapter(this, currentStatus); xlist_task.setAdapter(adapter); lastestUpdata = TimeUtil.setLastestUpdata(); break; case Task.TA_GETSTATUS_MODE_LOADMORE: currentStatus.addAll(newStatus); adapter.notifyDataSetChanged(); break; default: break; } changeListData(); } else { LinearLayout layout = (LinearLayout) findViewById(R.id.layout_no_info); TextView txt_no_info = (TextView) findViewById(R.id.txt_no_info); txt_no_info.setText("还没有报名过任务"); layout.setVisibility(View.VISIBLE); } } else { xlist_task.stopRefresh(); } /*把标志设为false,这样才能再开获取status的网络连接*/ isRefresh = false; }
/* * 改变list相关的保存的数据 */ private void changeListData() { xlist_task.stopRefresh(); xlist_task.stopLoadMore(); xlist_task.setRefreshTime(lastestUpdata); if (currentStatus.size() >= 10) { oldestStatusId = currentStatus.get(currentStatus.size() - 1).getStatusId(); xlist_task.setPullLoadEnable(true); } }