예제 #1
0
 @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());
   }
 }
예제 #2
0
 public void onSwipeRefreshPrepared() {
   if (pageTask.isLoadingFirstPage()) {
     if (hasView()) {
       getView().showRefreshing();
     }
   } else if (!pageTask.hasLoadedResources()) {
     loadInitialResources();
   }
 }
예제 #3
0
 @Override
 public void onStarted(Tasks.SafeTask task) {
   if (!hasView()) {
     return;
   }
   PageTask pageTask = (PageTask) task;
   if (pageTask.isFirstPage()) {
     getView().showRefreshing();
   } else {
     getView().updateLoadingMore();
   }
 }
예제 #4
0
 protected void refresh(PageInteractor<E> interactor) {
   pageTask.loadFirstPage(interactor);
   refreshInteractor = interactor;
   if (hasView()) {
     getView().disableSwipeRefreshing();
   }
 }
예제 #5
0
 @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);
 }
예제 #6
0
 @Override
 protected void onClose() {
   super.onClose();
   pageTask.cancel(true);
 }
예제 #7
0
 @Override
 protected void onDropView(V view) {
   super.onDropView(view);
   pageTask.setLifecycleListener(null);
 }
예제 #8
0
 @Override
 protected void onTakeView(V view) {
   super.onTakeView(view);
   pageTask.setLifecycleListener(this);
 }
예제 #9
0
 public boolean isFailedToLoadNextPage() {
   return pageTask.isFailedToLoadNextPage();
 }
예제 #10
0
 public boolean isLoadingNextPage() {
   return pageTask.isLoadingNextPage();
 }
예제 #11
0
 public PageTask.LoadState loadNextPage() {
   return pageTask.loadNextPage();
 }
예제 #12
0
 public boolean hasNextPage() {
   return pageTask.hasNextPage();
 }