@ BindingAdapter ( value = { "sprockets_placeholder" , "sprockets_load" , "sprockets_resize" , "sprockets_transform" } , requireAll = false ) public static void load ( ImageView view , Drawable placeholder , Uri load , boolean resize , String transform ) { RequestCreator req = Picasso . with ( view . getContext ( ) ) . load ( load ) . placeholder ( placeholder ) ; if ( resize ) { req . fit ( ) . centerCrop ( ) ; // view width/height isn't available yet } if ( TextUtils . equals ( transform , "circle" ) ) { req . transform ( Transformations . circle ( ) ) ; } req . into ( view ) ; }
Set a placeholder before loading an image optionally resizing and transforming it . All attributes are optional .