19
19
import android .graphics .BitmapFactory .Options ;
20
20
import android .os .Handler ;
21
21
import android .widget .ImageView ;
22
-
23
22
import com .nostra13 .universalimageloader .core .assist .ImageLoadingListener ;
24
23
import com .nostra13 .universalimageloader .core .assist .ImageScaleType ;
25
24
import com .nostra13 .universalimageloader .core .display .BitmapDisplayer ;
44
43
* <li>post-processor for image Bitmap (after caching in memory, before displaying)</li>
45
44
* <li>how decoded {@link Bitmap} will be displayed</li>
46
45
* </ul>
47
- *
46
+ * <p/>
48
47
* You can create instance:
49
48
* <ul>
50
49
* <li>with {@link Builder}:<br />
53
52
* {@link Builder#showStubImage(int) showStubImage()}.{@link Builder#build() build()}</code><br />
54
53
* </li>
55
54
* <li>or by static method: {@link #createSimple()}</li> <br />
56
- *
55
+ *
57
56
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
58
57
* @since 1.0.0
59
58
*/
@@ -173,7 +172,7 @@ public Handler getHandler() {
173
172
174
173
/**
175
174
* Builder for {@link DisplayImageOptions}
176
- *
175
+ *
177
176
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
178
177
*/
179
178
public static class Builder {
@@ -199,7 +198,7 @@ public Builder() {
199
198
200
199
/**
201
200
* Stub image will be displayed in {@link android.widget.ImageView ImageView} during image loading
202
- *
201
+ *
203
202
* @param stubImageRes Stub image resource
204
203
*/
205
204
public Builder showStubImage (int stubImageRes ) {
@@ -210,7 +209,7 @@ public Builder showStubImage(int stubImageRes) {
210
209
/**
211
210
* Incoming image will be displayed in {@link android.widget.ImageView ImageView} if empty URI (null or empty
212
211
* string) will be passed to <b>ImageLoader.displayImage(...)</b> method.
213
- *
212
+ *
214
213
* @param imageRes Image resource
215
214
*/
216
215
public Builder showImageForEmptyUri (int imageRes ) {
@@ -221,7 +220,7 @@ public Builder showImageForEmptyUri(int imageRes) {
221
220
/**
222
221
* Incoming image will be displayed in {@link android.widget.ImageView ImageView} if some error occurs during
223
222
* requested image loading/decoding.
224
- *
223
+ *
225
224
* @param imageRes Image resource
226
225
*/
227
226
public Builder showImageOnFail (int imageRes ) {
@@ -288,6 +287,7 @@ public Builder imageScaleType(ImageScaleType imageScaleType) {
288
287
289
288
/** Sets {@link Bitmap.Config bitmap config} for image decoding. Default value - {@link Bitmap.Config#ARGB_8888} */
290
289
public Builder bitmapConfig (Bitmap .Config bitmapConfig ) {
290
+ if (bitmapConfig == null ) throw new IllegalArgumentException ("bitmapConfig can't be null" );
291
291
decodingOptions .inPreferredConfig = bitmapConfig ;
292
292
return this ;
293
293
}
@@ -301,6 +301,7 @@ public Builder bitmapConfig(Bitmap.Config bitmapConfig) {
301
301
* option.
302
302
*/
303
303
public Builder decodingOptions (Options decodingOptions ) {
304
+ if (decodingOptions == null ) throw new IllegalArgumentException ("decodingOptions can't be null" );
304
305
this .decodingOptions = decodingOptions ;
305
306
return this ;
306
307
}
@@ -341,6 +342,7 @@ public Builder postProcessor(BitmapProcessor postProcessor) {
341
342
* {@link DefaultConfigurationFactory#createBitmapDisplayer()}
342
343
*/
343
344
public Builder displayer (BitmapDisplayer displayer ) {
345
+ if (displayer == null ) throw new IllegalArgumentException ("displayer can't be null" );
344
346
this .displayer = displayer ;
345
347
return this ;
346
348
}
@@ -389,7 +391,7 @@ public DisplayImageOptions build() {
389
391
* <li>{@link Bitmap.Config#ARGB_8888} bitmap config will be used for image decoding</li>
390
392
* <li>{@link SimpleBitmapDisplayer} will be used for image displaying</li>
391
393
* </ul>
392
- *
394
+ * <p/>
393
395
* These option are appropriate for simple single-use image (from drawables or from Internet) displaying.
394
396
*/
395
397
public static DisplayImageOptions createSimple () {
0 commit comments