Example #1
0
  /**
   * Set the type of Service to use for the ImageModel implementation.
   *
   * @param serviceType Type of Service, i.e., STARTED_SERVICE.
   */
  public void setServiceType(ImageModel.ServiceType serviceType) {
    // Only set the new ServiceType if it's different than the one
    // that's already in place.
    if (mServiceType != serviceType) {
      mServiceType = serviceType;
      if (mImageModelImpl != null)
        // Destroy the existing implementation, if any.
        mImageModelImpl.onDestroy(false);

      switch (mServiceType) {
        case STARTED_SERVICE:
          // Create an implementation that uses a Started
          // Service.
          mImageModelImpl = new ImageModelImplStartedService();
          break;
      }

      // Initialize the ImageModel implementation.
      mImageModelImpl.onCreate(mImagePresenter.get());
    }
  }
Example #2
0
 /**
  * Start a download. When the download finishes its results are passed up to the Presentation
  * layer via the onDownloadComplete() method defined in RequiredPresenterOps.
  *
  * @param url URL of the image to download.
  * @param directoryPathname Uri of the directory to store the downloaded image.
  */
 @Override
 public void startDownload(Uri url, Uri directoryPathname) {
   mImageModelImpl.startDownload(url, directoryPathname);
 }
Example #3
0
 /** Hook method called to shutdown the Presenter layer. */
 @Override
 public void onDestroy(boolean isChangingConfigurations) {
   // Forward the onDestroy().
   mImageModelImpl.onDestroy(isChangingConfigurations);
 }