Exemplo n.º 1
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public void setDataAdapter(
      XListView xListView,
      KBaseAdapter adapter,
      List<?> showList,
      List resultlist,
      boolean isRefresh) {
    mRefreshTime = ToolUtils.getNowTime();
    xListView.setRefreshTime(mRefreshTime);
    stopLoad(xListView);

    if (null == resultlist || resultlist.size() == 0) {
      xListView.setPullLoadEnable(false);
      BToast.show(mActivity, "数据加载完毕");
      return;
    }

    if (resultlist.size() < PAGE_SIZE_ADD) {
      xListView.setPullLoadEnable(false);
      BToast.show(mActivity, "数据加载完毕");
    } else {
      xListView.setPullLoadEnable(true);
    }

    if (isRefresh) {
      showList.clear();
      isRefresh = false;
    }

    showList.addAll(resultlist);
    adapter.notifyDataSetChanged();
  }
Exemplo n.º 2
0
 /** 加载完成之后进行时间保存等方法 */
 @SuppressLint("SimpleDateFormat")
 private void stopLoad(XListView xListView) {
   xListView.stopRefresh();
   xListView.stopLoadMore();
 }