private void loadImage ( ) { List < Transformation > transformations = getTransformations ( ) ; boolean hasUrl = url != null ; boolean hasResourceId = resourceId != null ; boolean hasPlaceholder = placeholderId != null ; ListenerTarget listenerTarget = getLinearTarget ( listener ) ; if ( hasUrl ) { RequestCreator bitmapRequest = Picasso . with ( context ) . load ( url ) . tag ( PICASSO_IMAGE_LOADER_TAG ) ; applyPlaceholder ( bitmapRequest ) . resize ( size , size ) . transform ( transformations ) . into ( listenerTarget ) ; } else if ( hasResourceId || hasPlaceholder ) { Resources resources = context . getResources ( ) ; Drawable placeholder = null ; Drawable drawable = null ; if ( hasPlaceholder ) { placeholder = resources . getDrawable ( placeholderId ) ; listenerTarget . onPrepareLoad ( placeholder ) ; } if ( hasResourceId ) { drawable = resources . getDrawable ( resourceId ) ; listenerTarget . onDrawableLoad ( drawable ) ; } } else { throw new IllegalArgumentException ( "Review your request, you are trying to load an image without a url or a resource id." ) ; } }
Uses the configuration previously applied using this ImageLoader builder to download a resource asynchronously and notify the result to the listener .