@Test public void intoTargetWithNullThrows() { try { new RequestCreator(picasso, URI_1, 0).into((Target) null); fail("Calling into() with null Target should throw exception"); } catch (IllegalArgumentException ignored) { } }
public void into(@NonNull Target target) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with a Target."); } if (!data.hasImage()) { picasso.cancelRequest(target); target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); return; } Request request = createRequest(started); String requestKey = createKey(request); if (shouldReadFromMemoryCache(memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(requestKey); if (bitmap != null) { picasso.cancelRequest(target); target.onBitmapLoaded(bitmap, MEMORY); return; } } target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); Action action = new TargetAction(picasso, target, request, memoryPolicy, networkPolicy, errorDrawable, requestKey, tag, errorResId); picasso.enqueueAndSubmit(action); }
RequestCreator { public void into(@NonNull Target target) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with a Target."); } if (!data.hasImage()) { picasso.cancelRequest(target); target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); return; } Request request = createRequest(started); String requestKey = createKey(request); if (shouldReadFromMemoryCache(memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(requestKey); if (bitmap != null) { picasso.cancelRequest(target); target.onBitmapLoaded(bitmap, MEMORY); return; } } target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); Action action = new TargetAction(picasso, target, request, memoryPolicy, networkPolicy, errorDrawable, requestKey, tag, errorResId); picasso.enqueueAndSubmit(action); } }
RequestCreator { public void into(@NonNull Target target) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with a Target."); } if (!data.hasImage()) { picasso.cancelRequest(target); target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); return; } Request request = createRequest(started); String requestKey = createKey(request); if (shouldReadFromMemoryCache(memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(requestKey); if (bitmap != null) { picasso.cancelRequest(target); target.onBitmapLoaded(bitmap, MEMORY); return; } } target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); Action action = new TargetAction(picasso, target, request, memoryPolicy, networkPolicy, errorDrawable, requestKey, tag, errorResId); picasso.enqueueAndSubmit(action); } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); }
RequestCreator { public void into(@NonNull Target target) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with a Target."); } if (!data.hasImage()) { picasso.cancelRequest(target); target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); return; } Request request = createRequest(started); String requestKey = createKey(request); if (shouldReadFromMemoryCache(memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(requestKey); if (bitmap != null) { picasso.cancelRequest(target); target.onBitmapLoaded(bitmap, MEMORY); return; } } target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); Action action = new TargetAction(picasso, target, request, memoryPolicy, networkPolicy, errorDrawable, requestKey, tag, errorResId); picasso.enqueueAndSubmit(action); } 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 void into(@NonNull Target target) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with a Target."); } if (!data.hasImage()) { picasso.cancelRequest(target); target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); return; } Request request = createRequest(started); String requestKey = createKey(request); if (shouldReadFromMemoryCache(memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(requestKey); if (bitmap != null) { picasso.cancelRequest(target); target.onBitmapLoaded(bitmap, MEMORY); return; } } target.onPrepareLoad(setPlaceholder ? getPlaceholderDrawable() : null); Action action = new TargetAction(picasso, target, request, memoryPolicy, networkPolicy, errorDrawable, requestKey, tag, errorResId); picasso.enqueueAndSubmit(action); } 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);  }