@Override
    protected void onStartLoading() {
      super.onStartLoading();

      swipeRefreshLayout.setRefreshing(true);
      forceLoad();
    }
    /**
     * Called when there is new data to deliver to the client. The super class will take care of
     * delivering it; the implementation here just adds a little more logic.
     */
    @Override
    public void deliverResult(String notes) {
      if (isReset()) {
        // An async query came in while the loader is stopped.  We
        // don't need the result.
        if (notes != null) {
          onReleaseResources(notes);
        }
      }
      String oldNote = note;
      note = notes;

      if (isStarted()) {
        // If the Loader is currently started, we can immediately
        // deliver its results.
        super.deliverResult(notes);
      }

      // At this point we can release the resources associated with
      // 'oldApps' if needed; now that the new result is delivered we
      // know that it is no longer in use.
      if (oldNote != null) {
        onReleaseResources(oldNote);
      }
    }
    @Override
    protected void onStopLoading() {
      super.onStopLoading();

      // Attempt to cancel the current load task if possible.
      cancelLoad();
    }
  /**
   * Called when there is new data to deliver to the client. The super class will take care of
   * delivering it; the implementation here just adds a little more logic.
   */
  @Override
  public void deliverResult(T data) {
    if (isReset()) {
      // An async query came in while the loader is stopped.  We
      // don't need the result.
      if (data != null) {
        releaseResources(data);
      }
    }

    // Hold a reference to the old data so it doesn't get garbage collected.
    // We must protect it until the new data has been delivered.
    T oldData = mData;
    mData = data;

    if (isStarted()) {
      // If the Loader is currently started, we can immediately
      // deliver its results.
      super.deliverResult(data);
    }

    // Invalidate the old data as we don't need it any more.
    if (oldData != null && oldData != data) {
      releaseResources(oldData);
    }
  }
  /**
   * Called when there is new data to deliver to the client. The super class will take care of
   * delivering it; the implementation here just adds a little more logic.
   */
  @Override
  public void deliverResult(Bitmap imageCover) {
    if (isReset()) {
      // An async query came in while the loader is stopped.  We
      // don't need the result.
      if (imageCover != null) {
        onReleaseResources(imageCover);
      }
    }
    Bitmap oldImagesCover = mSeasonBanner;
    mSeasonBanner = imageCover;

    if (isStarted()) {
      // If the Loader is currently started, we can immediately
      // deliver its results.
      super.deliverResult(imageCover);
    }

    // At this point we can release the resources associated with
    // 'oldApps' if needed; now that the new result is delivered we
    // know that it is no longer in use.
    if (oldImagesCover != null) {
      onReleaseResources(oldImagesCover);
    }
  }
예제 #6
0
  @Override
  protected void onReset() {
    super.onReset();
    cancelLoad();

    mData = null;
  }
예제 #7
0
 @Override
 public void deliverResult(T data) {
   mResult = data;
   if (isStarted()) {
     super.deliverResult(data);
   }
 }
  @Override
  protected void onStopLoading() {
    wallet.removeEventListener(walletChangeListener);
    walletChangeListener.removeCallbacks();

    super.onStopLoading();
  }
    @Override
    protected void onReset() {
      super.onReset();

      // Ensure the loader is stopped
      onStopLoading();
    }
  @Override
  protected void onStartLoading() {
    super.onStartLoading();

    wallet.addEventListener(walletChangeListener, Threading.SAME_THREAD);

    forceLoad();
  }
    /** Handles a request to cancel a load. */
    @Override
    public void onCanceled(String note) {
      super.onCanceled(note);

      // At this point we can release the resources associated with 'note'
      // if needed.
      onReleaseResources(note);
    }
 @Override
 public void deliverResult(Drawable data) {
   /**
    * Called when there is new data to deliver to the client. The super class will take care of
    * delivering it; the implementation here just adds a little more logic.
    */
   super.deliverResult(data);
 }
예제 #13
0
  @Override
  protected void onStartLoading() {
    super.onStartLoading();

    wallet.addEventListener(walletChangeListener);

    forceLoad();
  }
  /** Handles a request to cancel a load. */
  @Override
  public void onCanceled(Bitmap imageCover) {
    super.onCanceled(imageCover);

    // At this point we can release the resources associated with 'apps'
    // if needed.
    onReleaseResources(imageCover);
  }
예제 #15
0
  @Override
  public void onCanceled(CarStats data) {
    super.onCanceled(data);

    cancelLoad();
    mData = null;
    mCancel = true;
  }
예제 #16
0
 @Override
 public Loader<Void> onCreateLoader(int arg0, Bundle arg1) {
   AsyncTaskLoader<Void> loader =
       new AsyncTaskLoader<Void>(getActivity()) {
         @Override
         public Void loadInBackground() {
           try {
             getPartInfo(mItemRevId);
           } catch (Exception e) {
             e.printStackTrace();
           }
           return null;
         }
       };
   loader.forceLoad();
   return loader;
 }
예제 #17
0
 @Override
 public void deliverResult(CarStats data) {
   Util.Log("CarStatsLoader", "Deliviering Result");
   mData = data;
   mCancel = false;
   if (isStarted()) {
     super.deliverResult(mData);
   }
 }
  /** Handles a request to cancel a load. */
  @Override
  public void onCanceled(T data) {
    // Attempt to cancel the current asynchronous load.
    super.onCanceled(data);

    // The load has been canceled, so we should release the resources
    // associated with 'data'.
    releaseResources(data);
  }
  @Override
  public void deliverResult(Boolean data) {
    isBookmarked = data;

    if (isStarted()) {
      // If the Loader is currently started, we can immediately
      // deliver its results.
      super.deliverResult(data);
    }
  }
예제 #20
0
  public Loader<Void> onCreateLoader(int arg0, Bundle arg1) {
    mProgressDialog.setMessage("Loading...");
    mProgressDialog.show();
    AsyncTaskLoader<Void> loader =
        new AsyncTaskLoader<Void>(getActivity()) {

          public Void loadInBackground() {
            Log.d(TAG, "-----------loading-------------");
            JSVenuesLink mJSVenuesLink = new JSVenuesLink();
            mArrayListVenuesLink =
                mJSVenuesLink.getmArrayListVenuesLink(
                    SSSFApi.getAllVenuesLink(ISettings.BIT_FLY_URL));
            return null;
          }
        };

    loader.forceLoad();
    return loader;
  }
예제 #21
0
  @Override
  public void deliverResult(D data) {
    if (isReset())
      // An async query came in while the loader is stopped
      return;

    this.data = data;

    super.deliverResult(data);
  }
 @Override
 protected void onStartLoading() {
   if (isBookmarked != null) {
     // If we currently have a result available, deliver it
     // immediately.
     super.deliverResult(isBookmarked);
   } else {
     forceLoad();
   }
 }
  @Override
  protected void onReset() {
    super.onReset();

    onStopLoading();
    isBookmarked = null;

    LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
    lbm.unregisterReceiver(addBookmarkReceiver);
    lbm.unregisterReceiver(removeBookmarksReceiver);
  }
예제 #24
0
  @Override
  protected void onReset() {
    super.onReset();

    // Ensure the loader is stopped
    onStopLoading();

    //        if (mCursor != null && !mCursor.isClosed()) {
    //            mCursor.close();
    //        }
    mCursor = null;
  }
예제 #25
0
  @Override
  protected void onReset() {
    super.onReset();

    onStopLoading();

    if (mTorrentDetails != null) {
      onReleaseResources(mTorrentDetails);
    }

    // TODO: Stop monitoring for changes
  }
예제 #26
0
  public void deliverResult(LoaderResponse data) {
    LoaderResponse lastData = new LoaderResponse();

    if (mLoaderResponse != null) lastData.videos = new ArrayList<Video>(mLoaderResponse.videos);

    if (data != null) {
      for (int i = 0; i < data.videos.size(); i++) {
        lastData.videos.add(data.videos.get(i));
      }
    }
    mLoaderResponse = lastData;
    super.deliverResult(mLoaderResponse);
  }
  /** Handles a request to completely reset the Loader. */
  @Override
  protected void onReset() {
    super.onReset();

    // Ensure the loader is stopped
    onStopLoading();

    // At this point we can release resources
    if (mData != null) {
      onReleaseResources(mData);
      mData = null;
    }
  }
  /** Handles a request to completely reset the Loader. */
  @Override
  protected void onReset() {
    super.onReset();

    // Ensure the loader is stopped
    onStopLoading();

    // At this point we can release the resources associated with 'apps'
    // if needed.
    if (mSeasonBanner != null) {
      onReleaseResources(mSeasonBanner);
      mSeasonBanner = null;
    }
  }
예제 #29
0
  @Override
  public Loader<Cursor> onCreateLoader(int id, final Bundle args) {
    Log.d(TAG, "onCreateLoader");
    AsyncTaskLoader<Cursor> loader =
        new AsyncTaskLoader<Cursor>(getActivity()) {
          @Override
          public Cursor loadInBackground() {
            if (mainLogSource == null) {
              mainLogSource = new MainLogSource(getContext());
            }
            Cursor cursor;
            if (args == null) {
              cursor = mainLogSource.getCursor();
            } else {
              cursor = mainLogSource.getCursor(args.getString("filter"));
            }
            return cursor;
          }
        };
    loader.forceLoad();

    return loader;
  }
예제 #30
0
  @Override
  protected void onReset() {
    super.onReset();

    onStopLoading();

    onReleaseResources(mData);
    mData = null;

    if (mStarted) {
      // unregister from intent receiver
      getContext().unregisterReceiver(_receiver);
      mStarted = false;
    }
  }