@Override public void onLoad() { lv_main_will.stopRefresh(); lv_main_will.stopLoadMore(); adapter.notifyDataSetChanged(); // lv_main_will.setSelection((pullpage * 10) - 1); }
@Override public void ReturnVolleyString(String response, String type) { // Log.v("+++++++++++++", response); try { txt_going.setVisibility(View.GONE); JSONObject obj = new JSONObject(response); int code = obj.getInt("code"); if (code == 200) { JSONObject obj_ = obj.getJSONObject("datas"); hasmore = obj_.getInt("hasmore"); array = obj_.getJSONArray("list"); if (array.length() == 0) { // Toast.makeText(getActivity(), "没有更多数据了", // Toast.LENGTH_SHORT).show(); Intent intent = new Intent(getActivity(), LoadFalse.class); Bundle bund = new Bundle(); bund.putInt("from", 0); intent.putExtras(bund); startActivity(intent); if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).finish(); } } else { for (int i = 0; i < array.length(); i++) { try { JSONObject item = array.getJSONObject(i); Timer timer = new Timer( (long) item.getInt("date") * 24 * 60 * 60 * 1000 + (long) item.getInt("hours") * 60 * 60 * 1000 + (long) item.getInt("minutes") * 60 * 1000 + (long) item.getInt("seconds") * 1000); times.add(timer); } catch (JSONException e) { e.printStackTrace(); } } adapter = new ShouYeMainListAdapter(getActivity(), array, times, 1); lv_main_will.setPullRefreshEnable(true); lv_main_will.setPullLoadEnable(true); lv_main_will.setXListViewListener(this); lv_main_will.setAdapter(adapter); if (index == 0) { handler.sendEmptyMessage(1); index++; } } } else { GlobalUtil.showToast(getActivity(), Globals.NOINFO); } } catch (JSONException e) { GlobalUtil.showToast(getActivity(), Globals.NOINFO); } }
@Override public void onLoadMore() { if (bolg) { lv_main_will.setRefreshTime(":" + DateTimeUtil.getNowTime()); bolg = false; } else { lv_main_will.setRefreshTime(":" + date); } date = DateTimeUtil.getNowTime(); if (hasmore == 0) { Toast.makeText(getActivity(), R.string.load_ok, Toast.LENGTH_SHORT).show(); } else { init(eachnum + ""); eachnum += 10; Toast.makeText(getActivity(), R.string.load_ok, Toast.LENGTH_SHORT).show(); } onLoad(); }