public void initNet() { HashMap<String, String> reqMap = new HashMap<String, String>(); reqMap.put("mode", "1"); reqMap.put(BaseApiConstant.CONNECTION_TIMEOUT, "" + 5000); reqMap.put(BaseApiConstant.SOCKET_TIMEOUT, "" + 5000); jsonHelper.updateParams( getString(R.string.base_url), reqMap, "com.dns.taxchina.service.model.LoadingModel"); asyncTask = new DataJsonAsyncTask(TAG, dataServiceHelper, jsonHelper); dataPool.execute(asyncTask); }
// 下拉刷新加载数据 public void onRefresh() { HashMap<String, String> reqMap = new HashMap<String, String>(); reqMap.put("mode", "5"); reqMap.put("id", id); reqMap.put("nowPage", 1 + ""); reqMap.put("pageSize", PAGE_SIZE + ""); jsonHelper.updateParams( getString(R.string.base_url), reqMap, "com.dns.taxchina.service.model.CourseListModel"); asyncTask = new DataJsonAsyncTask(TAG, dataServiceHelper, jsonHelper, DataMode.SERVER, true); dataPool.execute(asyncTask, REFRESH_MODE); }
// 点击更多加载数据 public void onLoadMore() { HashMap<String, String> reqMap = new HashMap<String, String>(); reqMap.put("mode", "5"); reqMap.put("id", id); reqMap.put("nowPage", pageNum + 1 + ""); reqMap.put("pageSize", PAGE_SIZE + ""); jsonHelper.updateParams( getString(R.string.base_url), reqMap, "com.dns.taxchina.service.model.CourseListModel"); asyncTask = new DataJsonAsyncTask(TAG, dataServiceHelper, jsonHelper, DataMode.SERVER); // 加载更多不需要缓存 dataPool.execute(asyncTask, MORE_MODE); }
// 程序加载数据 private void onLoadEvent() { if (loadingDialog != null && !loadingDialog.isShowing()) { loadingDialog.show(); } HashMap<String, String> reqMap = new HashMap<String, String>(); reqMap.put("mode", "5"); reqMap.put("id", id); reqMap.put("nowPage", 1 + ""); reqMap.put("pageSize", PAGE_SIZE + ""); jsonHelper.updateParams( getString(R.string.base_url), reqMap, "com.dns.taxchina.service.model.CourseListModel"); asyncTask = new DataJsonAsyncTask(TAG, dataServiceHelper, jsonHelper, DataMode.SERVER_LOCAL, true); dataPool.execute(asyncTask, LOAD_MODE); }
package com.dns.taxchina.ui.fragment;