コード例 #1
0
    @Override
    public void attach(GraphObjectAdapter<GraphPlace> adapter) {
      super.attach(adapter);

      this.adapter.setDataNeededListener(
          new GraphObjectAdapter.DataNeededListener() {
            @Override
            public void onDataNeeded() {
              // Do nothing if we are currently loading data . We will get notified again when that
              // load finishes if the adapter still
              // needs more data. Otherwise, follow the next link.
              if (!loader.isLoading()) {
                loader.followNextLink();
              }
            }
          });
    }
コード例 #2
0
    @Override
    protected void onLoadFinished(
        GraphObjectPagingLoader<GraphPlace> loader, SimpleGraphObjectCursor<GraphPlace> data) {
      super.onLoadFinished(loader, data);

      // We could be called in this state if we are clearing data or if we are being re-attached
      // in the middle of a query.
      if (data == null || loader.isLoading()) {
        return;
      }

      hideActivityCircle();

      if (data.isFromCache()) {
        // Only the first page can be cached, since all subsequent pages will be round-tripped.
        // Force
        // a refresh of the first page before we allow paging to begin. If the first page produced
        // no data, launch the refresh immediately, otherwise schedule it for later.
        loader.refreshOriginalRequest(
            data.areMoreObjectsAvailable() ? CACHED_RESULT_REFRESH_DELAY : 0);
      }
    }