public void onLoadMore(boolean scrollEnd) { long lastid = -1; if (cachedData != null) { if (cachedData.size() > 0) { DataItem g = cachedData.get(cachedData.size() - 1); lastid = g.json.getLong("Id", -1); } } loadMoreData(mCount, lastid, scrollEnd); }
@Override public void onResp(int id, Resp resp, Object... obj) { if (id != requestId) return; boolean scrollEnd = (Boolean) obj[0]; if (resp.success) { if (cachedData == null) { cachedData = new DataArray(resp); } else { cachedData.append(resp); } adapter.notifyDataSetChanged(); if (scrollEnd && mReachEnd) { list.postDelayed( new Runnable() { public void run() { UI.toast(null); list.smoothScrollToPosition(adapter.getCount() - 1); } }, 500); // list.setSelection(); } } loadingEnd(); }