Model
- The type of the model.public abstract class BaseGlideUrlLoader<Model> extends Object implements ModelLoader<Model,InputStream>
InputStream
data.ModelLoader.LoadData<Data>
Modifier | Constructor and Description |
---|---|
protected |
BaseGlideUrlLoader(ModelLoader<GlideUrl,InputStream> concreteLoader) |
protected |
BaseGlideUrlLoader(ModelLoader<GlideUrl,InputStream> concreteLoader,
ModelCache<Model,GlideUrl> modelCache) |
Modifier and Type | Method and Description |
---|---|
ModelLoader.LoadData<InputStream> |
buildLoadData(Model model,
int width,
int height,
Options options)
Returns a
ModelLoader.LoadData containing a
DataFetcher required to decode the resource
represented by this model, as well as a set of Keys that
identify the data loaded by the DataFetcher as well as an
optional list of alternate keys from which equivalent data can be loaded. |
protected List<String> |
getAlternateUrls(Model model,
int width,
int height,
Options options)
Returns a list of alternate urls for the given model, width, and height from which equivalent
data can be obtained (usually the same image with the same aspect ratio, but in a larger size)
as the primary url.
|
protected Headers |
getHeaders(Model model,
int width,
int height,
Options options)
Returns the headers for the given model and dimensions as a map of strings to sets of strings,
or null if no headers should be added.
|
protected abstract String |
getUrl(Model model,
int width,
int height,
Options options)
Returns a valid url http:// or https:// for the given model and dimensions as a string.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handles
protected BaseGlideUrlLoader(ModelLoader<GlideUrl,InputStream> concreteLoader)
protected BaseGlideUrlLoader(ModelLoader<GlideUrl,InputStream> concreteLoader, @Nullable ModelCache<Model,GlideUrl> modelCache)
@Nullable public ModelLoader.LoadData<InputStream> buildLoadData(Model model, int width, int height, Options options)
ModelLoader
ModelLoader.LoadData
containing a
DataFetcher
required to decode the resource
represented by this model, as well as a set of Keys
that
identify the data loaded by the DataFetcher
as well as an
optional list of alternate keys from which equivalent data can be loaded. The
DataFetcher
will not be used if the resource is already cached.
Note - If no valid data fetcher can be returned (for example if a model has a null URL), then it is acceptable to return a null data fetcher from this method.
buildLoadData
in interface ModelLoader<Model,InputStream>
model
- The model representing the resource.width
- The width in pixels of the view or target the resource will be loaded into, or
Target.SIZE_ORIGINAL
to indicate that
the resource should be loaded at its original width.height
- The height in pixels of the view or target the resource will be loaded into, or
Target.SIZE_ORIGINAL
to indicate that
the resource should be loaded at its original height.protected abstract String getUrl(Model model, int width, int height, Options options)
model
- The model.width
- The width in pixels of the view/target the image will be loaded into.height
- The height in pixels of the view/target the image will be loaded into.protected List<String> getAlternateUrls(Model model, int width, int height, Options options)
Implementing this method allows Glide to fulfill requests for bucketed images in smaller bucket sizes using already cached data for larger bucket sizes.
width
- The width in pixels of the view/target the image will be loaded into.height
- The height in pixels of the view/target the image will be loaded into.@Nullable protected Headers getHeaders(Model model, int width, int height, Options options)
model
- The model.width
- The width in pixels of the view/target the image will be loaded into.height
- The height in pixels of the view/target the image will be loaded into.