/** * Sets the specific model to load data for. * * @param model The model to load data for, or null. * @return This request builder. */ @NonNull @CheckResult @SuppressWarnings("unchecked") @Override public RequestBuilder<TranscodeType> load(@Nullable Object model) { return loadGeneric(model); }
/** * Returns a request builder to load the given {@link URL}. * * @param url The URL representing the image. * @see #load(Object) * @deprecated The {@link java.net.URL} class has * <a href="http://goo.gl/c4hHNu">a number of performance problems</a> and should generally be * avoided when possible. Prefer {@link #load(android.net.Uri)} or {@link #load(String)}. */ @Deprecated @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable URL url) { return loadGeneric(url); }
/** * Returns a request builder to load the given {@link java.lang.String}. * * <p> Note - this method caches data using only the given String as the cache key. If the data is * a Uri outside of your control, or you otherwise expect the data represented by the given String * to change without the String identifier changing, Consider using * {@link com.bumptech.glide.request.RequestOptions#signature(com.bumptech.glide.load.Key)} to * mixin a signature you create that identifies the data currently at the given String that will * invalidate the cache if that data changes. Alternatively, using * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} and/or * {@link com.bumptech.glide.request.RequestOptions#skipMemoryCache(boolean)} may be * appropriate. * </p> * * @see #load(Object) * * @param string A file path, or a uri or url handled by * {@link com.bumptech.glide.load.model.UriLoader}. */ @NonNull @Override @CheckResult public RequestBuilder<TranscodeType> load(@Nullable String string) { return loadGeneric(string); }
/** * Returns a request builder to load the given {@link File}. * * <p>Note - this method caches data for Files using only the file path itself as the cache key. * The data in the File can change so using this method can lead to displaying stale data. If you * expect the data in the File to change, Consider using * {@link com.bumptech.glide.request.RequestOptions#signature(com.bumptech.glide.load.Key)} * to mixin a signature you create that identifies the data currently in the File that will * invalidate the cache if that data changes. Alternatively, using * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} and/or * {@link com.bumptech.glide.request.RequestOptions#skipMemoryCache(boolean)} may be * appropriate. * * @see #load(Object) * * @param file The File containing the image */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable File file) { return loadGeneric(file); }
/** * Returns a request builder to load the given {@link Uri}. * * <p> Note - this method caches data at Uris using only the Uri itself as the cache key. The data * represented by Uris from some content providers may change without the Uri changing, which * means using this method can lead to displaying stale data. Consider using * {@link com.bumptech.glide.request.RequestOptions#signature(com.bumptech.glide.load.Key)} to * mixin a signature you create based on the data at the given Uri that will invalidate the cache * if that data changes. Alternatively, using * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} and/or * {@link com.bumptech.glide.request.RequestOptions#skipMemoryCache(boolean)} may be * appropriate. </p> * * @see #load(Object) * * @param uri The Uri representing the image. Must be of a type handled by * {@link com.bumptech.glide.load.model.UriLoader}. */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable Uri uri) { return loadGeneric(uri); }
/** * Returns an object to load the given {@link Bitmap}. * * <p>It's almost always better to allow Glide to load {@link Bitmap}s than * pass {@link Bitmap}s into Glide. If you have a custom way to obtain {@link Bitmap}s that is * not supported by Glide by default, consider registering a custom * {@link com.bumptech.glide.load.model.ModelLoader} or * {@link com.bumptech.glide.load.ResourceDecoder} instead of using this method. * * <p>The {@link DiskCacheStrategy} is set to {@link DiskCacheStrategy#NONE}. Previous calls to * {@link #apply(BaseRequestOptions)} or previously applied {@link DiskCacheStrategy}s will be * overridden by this method. Applying an {@link DiskCacheStrategy} other than * {@link DiskCacheStrategy#NONE} after calling this method may result in undefined behavior. * * <p>In memory caching relies on Object equality. The contents of the {@link Bitmap}s are not * compared. * * @see #load(Object) */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable Bitmap bitmap) { return loadGeneric(bitmap) .apply(diskCacheStrategyOf(DiskCacheStrategy.NONE)); }
/** * Returns a request builder to load the given {@link Drawable}. * * <p>It's almost always better to allow Glide to load {@link Bitmap}s than to pass * {@link Bitmap}s into Glide using this method . If you have a custom way to obtain * {@link Bitmap}s that is not supported by Glide by default, consider registering a custom * {@link com.bumptech.glide.load.model.ModelLoader} or * {@link com.bumptech.glide.load.ResourceDecoder} instead of using this method. * * <p>The {@link DiskCacheStrategy} is set to {@link DiskCacheStrategy#NONE}. Previous calls to * {@link #apply(BaseRequestOptions)} or previously applied {@link DiskCacheStrategy}s will be * overridden by this method. Applying an {@link DiskCacheStrategy} other than * {@link DiskCacheStrategy#NONE} after calling this method may result in undefined behavior. * * <p>In memory caching relies on Object equality. The contents of the {@link Drawable}s are not * compared. * * @see #load(Object) */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable Drawable drawable) { return loadGeneric(drawable) .apply(diskCacheStrategyOf(DiskCacheStrategy.NONE)); }
@Override public RequestBuilder<TranscodeType> load(@RawRes @DrawableRes @Nullable Integer resourceId) { return loadGeneric(resourceId).apply(signatureOf(ApplicationVersionSignature.obtain(context)));
/** * Returns a request to load the given byte array. * * <p>Note - by default loads for bytes are not cached in either the memory or the disk cache. * * @param model the data to load. * @see #load(Object) */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable byte[] model) { RequestBuilder<TranscodeType> result = loadGeneric(model); if (!result.isDiskCacheStrategySet()) { result = result.apply(diskCacheStrategyOf(DiskCacheStrategy.NONE)); } if (!result.isSkipMemoryCacheSet()) { result = result.apply(skipMemoryCacheOf(true /*skipMemoryCache*/)); } return result; }
/** * Sets the specific model to load data for. * * <p> This method must be called at least once before * {@link #into(com.bumptech.glide.request.target.Target)} is called. </p> * * @param model The model to load data for, or null. * @return This request builder. */ @SuppressWarnings("unchecked") public RequestBuilder<TranscodeType> load(@Nullable Object model) { return loadGeneric(model); }
/** * Returns a request builder to load the given {@link URL}. * * @param url The URL representing the image. * @see #load(Object) * @deprecated The {@link java.net.URL} class has <a href="http://goo.gl/c4hHNu">a number of * performance problems</a> and should generally be avoided when possible. Prefer * {@link #load(android.net.Uri)} or {@link #load(String)}. */ @Deprecated public RequestBuilder<TranscodeType> load(@Nullable URL url) { return loadGeneric(url); }
/** * Returns a request builder to load the given {@link Uri}. * * <p> Note - this method caches data at Uris using only the Uri itself as the cache key. The data * represented by Uris from some content providers may change without the Uri changing, which * means using this method can lead to displaying stale data. Consider using * {@link com.bumptech.glide.request.RequestOptions#signature(com.bumptech.glide.load.Key)} to * mixin a signature you create based on the data at the given Uri that will invalidate the cache * if that data changes. Alternatively, using * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} and/or * {@link com.bumptech.glide.request.RequestOptions#skipMemoryCache(boolean)} may be * appropriate. </p> * * @see #load(Object) * * @param uri The Uri representing the image. Must be of a type handled by * {@link com.bumptech.glide.load.model.UriLoader}. */ public RequestBuilder<TranscodeType> load(@Nullable Uri uri) { return loadGeneric(uri); }
/** * Returns a request builder to load the given {@link File}. * * <p> Note - this method caches data for Files using only the file path itself as the cache key. * The data in the File can change so using this method can lead to displaying stale data. If you * expect the data in the File to change, Consider using * {@link com.bumptech.glide.request.RequestOptions#signature(com.bumptech.glide.load.Key)} * to mixin a signature you create that identifies the data currently in the File that will * invalidate the cache if that data changes. Alternatively, using * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} and/or * {@link com.bumptech.glide.request.RequestOptions#skipMemoryCache(boolean)} may be * appropriate. * </p> * * @see #load(Object) * * @param file The File containing the image */ public RequestBuilder<TranscodeType> load(@Nullable File file) { return loadGeneric(file); }
/** * Returns a request builder to load the given {@link java.lang.String}. signature. * * <p> Note - this method caches data using only the given String as the cache key. If the data is * a Uri outside of your control, or you otherwise expect the data represented by the given String * to change without the String identifier changing, Consider using * {@link com.bumptech.glide.request.RequestOptions#signature(com.bumptech.glide.load.Key)} to * mixin a signature you create that identifies the data currently at the given String that will * invalidate the cache if that data changes. Alternatively, using * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} and/or * {@link com.bumptech.glide.request.RequestOptions#skipMemoryCache(boolean)} may be * appropriate. * </p> * * @see #load(Object) * * @param string A file path, or a uri or url handled by * {@link com.bumptech.glide.load.model.UriLoader}. */ public RequestBuilder<TranscodeType> load(@Nullable String string) { return loadGeneric(string); }
/** * Returns a request to load the given byte array. * * <p> Note - by default loads for bytes are not cached in either the memory or the disk cache. * </p> * * @param model the data to load. * @see #load(Object) */ public RequestBuilder<TranscodeType> load(@Nullable byte[] model) { return loadGeneric(model).apply(signatureOf(new ObjectKey(UUID.randomUUID().toString())) .diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true /*skipMemoryCache*/)); }
/** * Returns a request builder to load the given resource id. Returns a request builder that uses * the {@link com.bumptech.glide.load.model.ModelLoaderFactory} currently registered or * {@link Integer} to load the image represented by the given {@link Integer} resource id. * Defaults to {@link com.bumptech.glide.load.model.ResourceLoader} to load resource id models. * * <p> By default this method adds a version code based signature to the cache key used to cache * this resource in Glide. This signature is sufficient to guarantee that end users will see the * most up to date versions of your Drawables, but during development if you do not increment your * version code before each install and you replace a Drawable with different data without * changing the Drawable name, you may see inconsistent cached data. To get around this, consider * using {@link com.bumptech.glide.load.engine.DiskCacheStrategy#NONE} via * {@link RequestOptions#diskCacheStrategy(com.bumptech.glide.load.engine.DiskCacheStrategy)} * during development, and re-enabling the default * {@link com.bumptech.glide.load.engine.DiskCacheStrategy#RESOURCE} for release builds. </p> * * @see #load(Integer) * @see com.bumptech.glide.signature.ApplicationVersionSignature */ public RequestBuilder<TranscodeType> load(@Nullable Integer resourceId) { return loadGeneric(resourceId).apply(signatureOf(ApplicationVersionSignature.obtain(context))); }