@Override protected void onLoad(@Nullable Bundle savedInstanceState, boolean reusing) { super.onLoad(savedInstanceState, reusing); if (pageTask.hasLoadedResources()) { getView() .showResources(pageTask.getLoadedResources(), 0, 0, pageTask.getLoadedResources().size()); } }
public void onSwipeRefreshPrepared() { if (pageTask.isLoadingFirstPage()) { if (hasView()) { getView().showRefreshing(); } } else if (!pageTask.hasLoadedResources()) { loadInitialResources(); } }
@Override public void onStarted(Tasks.SafeTask task) { if (!hasView()) { return; } PageTask pageTask = (PageTask) task; if (pageTask.isFirstPage()) { getView().showRefreshing(); } else { getView().updateLoadingMore(); } }
protected void refresh(PageInteractor<E> interactor) { pageTask.loadFirstPage(interactor); refreshInteractor = interactor; if (hasView()) { getView().disableSwipeRefreshing(); } }
@Override public void onPageChanged(PageTask pageTask, int start, int before, int count) { if (!hasView()) { return; } //noinspection unchecked Collection<E> resources = pageTask.getLoadedResources(); getView().showResources(resources, start, before, count); }
@Override protected void onClose() { super.onClose(); pageTask.cancel(true); }
@Override protected void onDropView(V view) { super.onDropView(view); pageTask.setLifecycleListener(null); }
@Override protected void onTakeView(V view) { super.onTakeView(view); pageTask.setLifecycleListener(this); }
public boolean isFailedToLoadNextPage() { return pageTask.isFailedToLoadNextPage(); }
public boolean isLoadingNextPage() { return pageTask.isLoadingNextPage(); }
public PageTask.LoadState loadNextPage() { return pageTask.loadNextPage(); }
public boolean hasNextPage() { return pageTask.hasNextPage(); }