public void loadMore(final Boolean needClear) { if (!iDataSource.hasMore()) { iAction.onAlreadyEnd(); return; } iDataSource.cancleLoadTask(); iAction.onLoadBegin(); iDataSource.getLoadMoreData( new Interfaces.IGetDataCallBack() { @Override public void onSuccess(List dataList) { if (needClear) { Model.this.dataList.clear(); } Model.this.dataList.addAll(dataList); iAction.onLoadSuccess(Model.this.dataList); } @Override public void onFail() { iAction.onLoadFailed(); } @Override public void onError() { iAction.onLoadError(); } }); }
public void firstIn() { this.dataList.clear(); iDataSource.onGetRefreshData(); if (null != iDataSource.getFirstInData() && 0 != iDataSource.getFirstInData().size()) { dataList.addAll(iDataSource.getFirstInData()); iAction.onLoadSuccess(Model.this.dataList); } loadMore(true); }
public void refresh() { iDataSource.onGetRefreshData(); loadMore(true); }