File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
library/src/main/java/com/daimajia/slider/library/SliderTypes Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ public abstract class BaseSliderView {
47
47
48
48
private String mDescription ;
49
49
50
+ private Picasso mPicasso ;
51
+
50
52
/**
51
53
* Scale type of the image.
52
54
*/
@@ -205,7 +207,7 @@ public void onClick(View v) {
205
207
mLoadListener .onStart (me );
206
208
}
207
209
208
- Picasso p = Picasso .with (mContext );
210
+ Picasso p = ( mPicasso != null ) ? mPicasso : Picasso .with (mContext );
209
211
RequestCreator rq = null ;
210
212
if (mUrl !=null ){
211
213
rq = p .load (mUrl );
@@ -304,4 +306,23 @@ public interface ImageLoadListener{
304
306
public void onEnd (boolean result ,BaseSliderView target );
305
307
}
306
308
309
+ /**
310
+ * Get the last instance set via setPicasso(), or null if no user provided instance was set
311
+ *
312
+ * @return The current user-provided Picasso instance, or null if none
313
+ */
314
+ public Picasso getPicasso () {
315
+ return mPicasso ;
316
+ }
317
+
318
+ /**
319
+ * Provide a Picasso instance to use when loading pictures, this is useful if you have a
320
+ * particular HTTP cache you would like to share.
321
+ *
322
+ * @param picasso The Picasso instance to use, may be null to let the system use the default
323
+ * instance
324
+ */
325
+ public void setPicasso (Picasso picasso ) {
326
+ mPicasso = picasso ;
327
+ }
307
328
}
You can’t perform that action at this time.
0 commit comments