1515 */
1616package me .jessyan .art .http ;
1717
18+ import android .support .annotation .NonNull ;
19+
1820import com .bumptech .glide .load .Options ;
1921import com .bumptech .glide .load .model .GlideUrl ;
2022import com .bumptech .glide .load .model .ModelLoader ;
@@ -31,27 +33,31 @@ public class OkHttpUrlLoader implements ModelLoader<GlideUrl, InputStream> {
3133
3234 private final Call .Factory client ;
3335
34- public OkHttpUrlLoader (Call .Factory client ) {
36+ // Public API.
37+ @ SuppressWarnings ("WeakerAccess" )
38+ public OkHttpUrlLoader (@ NonNull Call .Factory client ) {
3539 this .client = client ;
3640 }
3741
3842 @ Override
39- public boolean handles (GlideUrl url ) {
43+ public boolean handles (@ NonNull GlideUrl url ) {
4044 return true ;
4145 }
4246
4347 @ Override
44- public LoadData <InputStream > buildLoadData (GlideUrl model , int width , int height ,
45- Options options ) {
48+ public LoadData <InputStream > buildLoadData (@ NonNull GlideUrl model , int width , int height ,
49+ @ NonNull Options options ) {
4650 return new LoadData <>(model , new OkHttpStreamFetcher (client , model ));
4751 }
4852
4953 /**
5054 * The default factory for {@link OkHttpUrlLoader}s.
5155 */
56+ // Public API.
57+ @ SuppressWarnings ("WeakerAccess" )
5258 public static class Factory implements ModelLoaderFactory <GlideUrl , InputStream > {
5359 private static volatile Call .Factory internalClient ;
54- private Call .Factory client ;
60+ private final Call .Factory client ;
5561
5662 private static Call .Factory getInternalClient () {
5763 if (internalClient == null ) {
@@ -76,10 +82,11 @@ public Factory() {
7682 *
7783 * @param client this is typically an instance of {@code OkHttpClient}.
7884 */
79- public Factory (Call .Factory client ) {
85+ public Factory (@ NonNull Call .Factory client ) {
8086 this .client = client ;
8187 }
8288
89+ @ NonNull
8390 @ Override
8491 public ModelLoader <GlideUrl , InputStream > build (MultiModelLoaderFactory multiFactory ) {
8592 return new OkHttpUrlLoader (client );
0 commit comments