|
1 | 1 | package com.bumptech.glide.load.model.stream;
|
2 | 2 |
|
3 | 3 | import android.net.Uri;
|
4 |
| -import androidx.annotation.NonNull; |
5 |
| -import com.bumptech.glide.load.Options; |
6 | 4 | import com.bumptech.glide.load.model.GlideUrl;
|
7 | 5 | import com.bumptech.glide.load.model.ModelLoader;
|
8 |
| -import com.bumptech.glide.load.model.ModelLoaderFactory; |
9 |
| -import com.bumptech.glide.load.model.MultiModelLoaderFactory; |
| 6 | +import com.bumptech.glide.load.model.UrlUriLoader; |
10 | 7 | import java.io.InputStream;
|
11 |
| -import java.util.Arrays; |
12 |
| -import java.util.Collections; |
13 |
| -import java.util.HashSet; |
14 |
| -import java.util.Set; |
15 | 8 |
|
16 |
| -/** Loads {@link InputStream}s from http or https {@link Uri}s. */ |
17 |
| -public class HttpUriLoader implements ModelLoader<Uri, InputStream> { |
18 |
| - private static final Set<String> SCHEMES = |
19 |
| - Collections.unmodifiableSet(new HashSet<>(Arrays.asList("http", "https"))); |
20 |
| - |
21 |
| - private final ModelLoader<GlideUrl, InputStream> urlLoader; |
| 9 | +/** |
| 10 | + * Loads {@link InputStream}s from http or https {@link Uri}s. |
| 11 | + * |
| 12 | + * @deprecated Use {@link UrlUriLoader} instead |
| 13 | + */ |
| 14 | +@Deprecated |
| 15 | +public class HttpUriLoader extends UrlUriLoader<InputStream> { |
22 | 16 |
|
23 | 17 | // Public API.
|
24 | 18 | @SuppressWarnings("WeakerAccess")
|
25 | 19 | public HttpUriLoader(ModelLoader<GlideUrl, InputStream> urlLoader) {
|
26 |
| - this.urlLoader = urlLoader; |
27 |
| - } |
28 |
| - |
29 |
| - @Override |
30 |
| - public LoadData<InputStream> buildLoadData( |
31 |
| - @NonNull Uri model, int width, int height, @NonNull Options options) { |
32 |
| - return urlLoader.buildLoadData(new GlideUrl(model.toString()), width, height, options); |
| 20 | + super(urlLoader); |
33 | 21 | }
|
34 | 22 |
|
35 |
| - @Override |
36 |
| - public boolean handles(@NonNull Uri model) { |
37 |
| - return SCHEMES.contains(model.getScheme()); |
38 |
| - } |
39 |
| - |
40 |
| - /** Factory for loading {@link InputStream}s from http/https {@link Uri}s. */ |
41 |
| - public static class Factory implements ModelLoaderFactory<Uri, InputStream> { |
42 |
| - |
43 |
| - @NonNull |
44 |
| - @Override |
45 |
| - public ModelLoader<Uri, InputStream> build(MultiModelLoaderFactory multiFactory) { |
46 |
| - return new HttpUriLoader(multiFactory.build(GlideUrl.class, InputStream.class)); |
47 |
| - } |
48 |
| - |
49 |
| - @Override |
50 |
| - public void teardown() { |
51 |
| - // Do nothing. |
52 |
| - } |
| 23 | + /** |
| 24 | + * Factory for loading {@link InputStream}s from http/https {@link Uri}s. |
| 25 | + * |
| 26 | + * @deprecated Use {@link UrlUriLoader.StreamFactory} instead |
| 27 | + */ |
| 28 | + @Deprecated |
| 29 | + public static class Factory extends StreamFactory { |
| 30 | + // Defer to StreamFactory's implementation |
53 | 31 | }
|
54 | 32 | }
|
0 commit comments