/** * Asynchronously fulfills the request into the specified {@link RemoteViews} object with the * given {@code viewId}. This is used for loading bitmaps into a {@link Notification}. */ public void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId, @NonNull Notification notification, @Nullable String notificationTag, @Nullable Callback callback) { long started = System.nanoTime(); if (remoteViews == null) { throw new IllegalArgumentException("RemoteViews must not be null."); } if (notification == null) { throw new IllegalArgumentException("Notification must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with RemoteViews."); } if (placeholderDrawable != null || errorDrawable != null) { throw new IllegalArgumentException( "Cannot use placeholder or error drawables with remote views."); } Request request = createRequest(started); RemoteViewsAction action = new NotificationAction(picasso, request, errorResId, new RemoteViewsTarget(remoteViews, viewId), notificationId, notification, notificationTag, callback); performRemoteViewInto(request, action); }
/** * Asynchronously fulfills the request into the specified {@link RemoteViews} object with the * given {@code viewId}. This is used for loading bitmaps into all instances of a widget. */ public void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, @NonNull int[] appWidgetIds, @Nullable Callback callback) { long started = System.nanoTime(); if (remoteViews == null) { throw new IllegalArgumentException("remoteViews must not be null."); } if (appWidgetIds == null) { throw new IllegalArgumentException("appWidgetIds must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with remote views."); } if (placeholderDrawable != null || errorDrawable != null) { throw new IllegalArgumentException( "Cannot use placeholder or error drawables with remote views."); } Request request = createRequest(started); RemoteViewsAction action = new AppWidgetAction(picasso, request, errorResId, new RemoteViewsTarget(remoteViews, viewId), appWidgetIds, callback); performRemoteViewInto(request, action); }
/** * Synchronously fulfill this request. Must not be called from the main thread. */ @Nullable // TODO make non-null and always throw? 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 request = createRequest(started); Action action = new GetAction(picasso, request); RequestHandler.Result result = forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); Bitmap bitmap = result.getBitmap(); if (bitmap != null && shouldWriteToMemoryCache(request.memoryPolicy)) { picasso.cache.set(request.key, bitmap); } return bitmap; }
Request request = createRequest(started);
Request request = createRequest(started);
Request request = createRequest(started);