@Override void complete(RequestHandler.Result result) { if (callback != null) { callback.onSuccess(); } }
@Override public void complete(RequestHandler.Result result) { if (result == null) { throw new AssertionError( String.format("Attempted to complete action with no result!\n%s", this)); } boolean indicatorsEnabled = picasso.indicatorsEnabled; PicassoDrawable.setResult(target, picasso.context, result, noFade, indicatorsEnabled); if (callback != null) { callback.onSuccess(); } }
@Override void complete(RequestHandler.Result result) { target.remoteViews.setImageViewBitmap(target.viewId, result.getBitmap()); update(); if (callback != null) { callback.onSuccess(); } }
@Test public void intoImageViewWithQuickMemoryCacheCheckDoesNotSubmit() { PlatformLruCache cache = new PlatformLruCache(0); Picasso picasso = spy(new Picasso(RuntimeEnvironment.application, mock(Dispatcher.class), UNUSED_CALL_FACTORY, null, cache, null, NO_TRANSFORMERS, NO_HANDLERS, mock(Stats.class), ARGB_8888, false, false)); doReturn(bitmap).when(picasso).quickMemoryCacheCheck(URI_KEY_1); ImageView target = mockImageViewTarget(); Callback callback = mockCallback(); new RequestCreator(picasso, URI_1, 0).into(target, callback); verify(target).setImageDrawable(any(PicassoDrawable.class)); verify(callback).onSuccess(); verify(picasso).cancelRequest(target); verify(picasso, never()).enqueueAndSubmit(any(Action.class)); }
callback.onSuccess();
@Test public void invokesTargetAndCallbackSuccessIfTargetIsNotNull() { Bitmap bitmap = makeBitmap(); Dispatcher dispatcher = mock(Dispatcher.class); PlatformLruCache cache = new PlatformLruCache(0); Picasso picasso = new Picasso(RuntimeEnvironment.application, dispatcher, UNUSED_CALL_FACTORY, null, cache, null, NO_TRANSFORMERS, NO_HANDLERS, mock(Stats.class), Bitmap.Config.ARGB_8888, false, false); ImageView target = mockImageViewTarget(); Callback callback = mockCallback(); ImageViewAction request = new ImageViewAction(picasso, target, null, null, 0, false, callback); request.complete(new RequestHandler.Result(bitmap, MEMORY)); verify(target).setImageDrawable(any(PicassoDrawable.class)); verify(callback).onSuccess(); }
@Test public void completeSetsBitmapOnRemoteViews() { Callback callback = mockCallback(); Bitmap bitmap = makeBitmap(); RemoteViewsAction action = createAction(callback); action.complete(new RequestHandler.Result(bitmap, NETWORK)); verify(remoteViews).setImageViewBitmap(1, bitmap); verify(callback).onSuccess(); }
callback.onSuccess();