示例#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();
 }