@Test public void getReturnsNullIfNullUriAndResourceId() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); final Bitmap[] result = new Bitmap[1]; new Thread(new Runnable() { @Override public void run() { try { result[0] = new RequestCreator(picasso, null, 0).get(); } catch (IOException e) { fail(e.getMessage()); } finally { latch.countDown(); } } }).start(); latch.await(); assertThat(result[0]).isNull(); verifyZeroInteractions(picasso); }
public Bitmap get() throws IOException { long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = createRequest(started); String key = createKey(finalData, new StringBuilder()); Action action = new GetAction(picasso, finalData, memoryPolicy, networkPolicy, tag, key); return forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); }
RequestCreator { public Bitmap get() throws IOException { long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = createRequest(started); String key = createKey(finalData, new StringBuilder()); Action action = new GetAction(picasso, finalData, memoryPolicy, networkPolicy, tag, key); return forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); } }
RequestCreator { public Bitmap get() throws IOException { long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = createRequest(started); String key = createKey(finalData, new StringBuilder()); Action action = new GetAction(picasso, finalData, memoryPolicy, networkPolicy, tag, key); return forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); }
RequestCreator { public Bitmap get() throws IOException { long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = createRequest(started); String key = createKey(finalData, new StringBuilder()); Action action = new GetAction(picasso, finalData, memoryPolicy, networkPolicy, tag, key); return forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); RequestCreator noPlaceholder(); RequestCreator placeholder(@DrawableRes int placeholderResId); RequestCreator placeholder(@NonNull Drawable placeholderDrawable); RequestCreator error(@DrawableRes int errorResId); RequestCreator error(@NonNull Drawable errorDrawable); RequestCreator tag(@NonNull Object tag); RequestCreator fit(); RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId); RequestCreator resize(int targetWidth, int targetHeight); RequestCreator centerCrop(); RequestCreator centerCrop(int alignGravity); RequestCreator centerInside(); RequestCreator onlyScaleDown(); RequestCreator rotate(float degrees); RequestCreator rotate(float degrees, float pivotX, float pivotY); RequestCreator config(@NonNull Bitmap.Config config); RequestCreator stableKey(@NonNull String stableKey); RequestCreator priority(@NonNull Priority priority); RequestCreator transform(@NonNull Transformation transformation); RequestCreator transform(@NonNull List<? extends Transformation> transformations); RequestCreator memoryPolicy(@NonNull MemoryPolicy policy,
      @NonNull MemoryPolicy... additional); RequestCreator networkPolicy(@NonNull NetworkPolicy policy,
      @NonNull NetworkPolicy... additional); RequestCreator purgeable(); RequestCreator noFade(); Bitmap get(); void fetch(); void fetch(@Nullable Callback callback); void into(@NonNull Target target); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag, Callback callback); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId,
      @NonNull int[] appWidgetIds); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, @NonNull int[] appWidgetIds,
      Callback callback); void into(ImageView target); void into(ImageView target, Callback callback); }
RequestCreator { public Bitmap get() throws IOException { long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = createRequest(started); String key = createKey(finalData, new StringBuilder()); Action action = new GetAction(picasso, finalData, memoryPolicy, networkPolicy, tag, key); return forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); RequestCreator noPlaceholder(); RequestCreator placeholder(@DrawableRes int placeholderResId); RequestCreator placeholder(@NonNull Drawable placeholderDrawable); RequestCreator error(@DrawableRes int errorResId); RequestCreator error(@NonNull Drawable errorDrawable); RequestCreator tag(@NonNull Object tag); RequestCreator fit(); RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId); RequestCreator resize(int targetWidth, int targetHeight); RequestCreator centerCrop(); RequestCreator centerCrop(int alignGravity); RequestCreator centerInside(); RequestCreator onlyScaleDown(); RequestCreator rotate(float degrees); RequestCreator rotate(float degrees, float pivotX, float pivotY); RequestCreator config(@NonNull Bitmap.Config config); RequestCreator stableKey(@NonNull String stableKey); RequestCreator priority(@NonNull Priority priority); RequestCreator transform(@NonNull Transformation transformation); RequestCreator transform(@NonNull List<? extends Transformation> transformations); RequestCreator memoryPolicy(@NonNull MemoryPolicy policy,
      @NonNull MemoryPolicy... additional); RequestCreator networkPolicy(@NonNull NetworkPolicy policy,
      @NonNull NetworkPolicy... additional); RequestCreator purgeable(); RequestCreator noFade(); Bitmap get(); void fetch(); void fetch(@Nullable Callback callback); void into(@NonNull Target target); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag, Callback callback); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId,
      @NonNull int[] appWidgetIds); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, @NonNull int[] appWidgetIds,
      Callback callback); void into(ImageView target); void into(ImageView target, Callback callback);  }