-
public class ImageRequestBuilderBuilder class for ImageRequests.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classImageRequestBuilder.BuilderExceptionAn exception class for builder methods.
-
Method Summary
Modifier and Type Method Description static ImageRequestBuildernewBuilderWithSource(Uri uri)Creates a new request builder instance. static ImageRequestBuildernewBuilderWithResourceId(int resId)Creates a new request builder instance for a local resource image. static ImageRequestBuilderfromRequest(ImageRequest imageRequest)Creates a new request builder instance with the same parameters as the imageRequest passed in. static voidaddCustomUriNetworkScheme(String scheme)ImageRequestBuildersetSource(Uri uri)Sets the source uri (both network and local uris are supported). UrigetSourceUri()Gets the source Uri. ImageRequestBuildersetLowestPermittedRequestLevel(ImageRequest.RequestLevel requestLevel)Sets the lowest level that is permitted to request the image from. ImageRequest.RequestLevelgetLowestPermittedRequestLevel()Gets the lowest permitted request level. intgetCachesDisabled()Gets the caches permissions. ImageRequestBuildersetAutoRotateEnabled(boolean enabled)Enables or disables auto-rotate for the image in case image has orientation. ImageRequestBuildersetResizeOptions(@Nullable() ResizeOptions resizeOptions)Sets resize options in case resize should be performed. ResizeOptionsgetResizeOptions()Gets the resize options if set, null otherwise. ImageRequestBuildersetRotationOptions(@Nullable() RotationOptions rotationOptions)Sets rotation options for the image, whether to rotate by a multiple of 90 degrees, use theEXIF metadata (relevant to JPEGs only) or to not rotate. RotationOptionsgetRotationOptions()Gets the rotation options if set, null otherwise. ImageRequestBuildersetBytesRange(@Nullable() BytesRange bytesRange)Set the range of bytes to request from the network (in the case of an HTTP request). BytesRangegetBytesRange()Gets the range of bytes if set, null otherwise. ImageRequestBuildersetImageDecodeOptions(ImageDecodeOptions imageDecodeOptions)ImageDecodeOptionsgetImageDecodeOptions()ImageRequestBuildersetCacheChoice(ImageRequest.CacheChoice cacheChoice)Sets the cache option. ImageRequest.CacheChoicegetCacheChoice()Gets the cache choice (profile image or default). ImageRequestBuildersetProgressiveRenderingEnabled(boolean enabled)Enables or disables progressive rendering. booleanisProgressiveRenderingEnabled()Returns whether progressive loading is enabled. ImageRequestBuildersetLocalThumbnailPreviewsEnabled(boolean enabled)Enables or disables the use of local thumbnails as previews. booleanisLocalThumbnailPreviewsEnabled()Returns whether the use of local thumbnails for previews is enabled. ImageRequestBuildersetLoadThumbnailOnly(boolean loadThumbnailOnly)booleangetLoadThumbnailOnly()Returns whether the use of local thumbnails for previews is enabled. ImageRequestBuilderdisableDiskCache()Disables disk cache for this request, regardless where the image will come from. booleanisDiskCacheEnabled()Returns whether the use of the disk cache is enabled, which is partly dependent on the URI. ImageRequestBuilderdisableMemoryCache()Disables memory cache for this request. booleanisMemoryCacheEnabled()Returns whether the use of the memory cache is enabled. ImageRequestBuildersetRequestPriority(Priority requestPriority)Set priority for the request. PrioritygetRequestPriority()Returns the request priority. ImageRequestBuildersetPostprocessor(@Nullable() Postprocessor postprocessor)Sets the postprocessor. PostprocessorgetPostprocessor()Gets postprocessor if set, null otherwise. ImageRequestBuildersetRequestListener(@Nullable() RequestListener requestListener)Sets a request listener to use for just this image request RequestListenergetRequestListener()ImageRequestbuild()Builds the Request. BooleanshouldDecodePrefetches()ImageRequestBuildersetShouldDecodePrefetches(@Nullable() Boolean shouldDecodePrefetches)ImageRequestBuildersetResizingAllowedOverride(@Nullable() Boolean resizingAllowedOverride)BooleangetResizingAllowedOverride()intgetDelayMs()ImageRequestBuildersetDelayMs(int delayMs)Add an artificial delay for this image, in milliseconds. -
-
Method Detail
-
newBuilderWithSource
static ImageRequestBuilder newBuilderWithSource(Uri uri)
Creates a new request builder instance. The setting will be done according to the source type.
- Parameters:
uri- the uri to fetch
-
newBuilderWithResourceId
static ImageRequestBuilder newBuilderWithResourceId(int resId)
Creates a new request builder instance for a local resource image.
Only image resources can be used with the image pipeline (PNG, JPG, GIF). Other resourcetypes such as Strings or XML Drawables make no sense in the context of the image pipeline andso cannot be supported. Attempts to do so will throw an when the pipeline tries to decode the resource.
One potentially confusing case is drawable declared in XML (e.g. ShapeDrawable). This is notan image. If you want to display an XML drawable as the main image, then set it as aplaceholder and do not set a URI.
- Parameters:
resId- local image resource id.
-
fromRequest
static ImageRequestBuilder fromRequest(ImageRequest imageRequest)
Creates a new request builder instance with the same parameters as the imageRequest passed in.
- Parameters:
imageRequest- the ImageRequest from where to copy the parameters to the builder.
-
addCustomUriNetworkScheme
static void addCustomUriNetworkScheme(String scheme)
-
setSource
ImageRequestBuilder setSource(Uri uri)
Sets the source uri (both network and local uris are supported). Note: this will enable diskcaching for network sources, and disable it for local sources.
- Parameters:
uri- the uri to fetch the image from
-
getSourceUri
Uri getSourceUri()
Gets the source Uri.
-
setLowestPermittedRequestLevel
ImageRequestBuilder setLowestPermittedRequestLevel(ImageRequest.RequestLevel requestLevel)
Sets the lowest level that is permitted to request the image from.
- Parameters:
requestLevel- the lowest request level that is allowed
-
getLowestPermittedRequestLevel
ImageRequest.RequestLevel getLowestPermittedRequestLevel()
Gets the lowest permitted request level.
-
getCachesDisabled
int getCachesDisabled()
Gets the caches permissions.
-
setAutoRotateEnabled
@Deprecated() ImageRequestBuilder setAutoRotateEnabled(boolean enabled)
Enables or disables auto-rotate for the image in case image has orientation.
-
setResizeOptions
ImageRequestBuilder setResizeOptions(@Nullable() ResizeOptions resizeOptions)
Sets resize options in case resize should be performed.
- Parameters:
resizeOptions- resize options
-
getResizeOptions
@Nullable() ResizeOptions getResizeOptions()
Gets the resize options if set, null otherwise.
-
setRotationOptions
ImageRequestBuilder setRotationOptions(@Nullable() RotationOptions rotationOptions)
Sets rotation options for the image, whether to rotate by a multiple of 90 degrees, use theEXIF metadata (relevant to JPEGs only) or to not rotate. This also specifies whether therotation should be left until the bitmap is rendered (as the GPU can do this more efficientlythan the effort to change the bitmap object).
- Parameters:
rotationOptions- rotation options
-
getRotationOptions
@Nullable() RotationOptions getRotationOptions()
Gets the rotation options if set, null otherwise.
-
setBytesRange
ImageRequestBuilder setBytesRange(@Nullable() BytesRange bytesRange)
Set the range of bytes to request from the network (in the case of an HTTP request). This isonly used if isPartialImageCachingEnabled is true and your com.facebook.imagepipeline.producers.NetworkFetcher makes use of it.
Even where this is supported, there is no contract that this must be followed. The responsemay contain the full image data, more than is requested or less, depending on what's already incache and external factors.
- Parameters:
bytesRange- the range of bytes
-
getBytesRange
@Nullable() BytesRange getBytesRange()
Gets the range of bytes if set, null otherwise.
-
setImageDecodeOptions
ImageRequestBuilder setImageDecodeOptions(ImageDecodeOptions imageDecodeOptions)
-
getImageDecodeOptions
ImageDecodeOptions getImageDecodeOptions()
-
setCacheChoice
ImageRequestBuilder setCacheChoice(ImageRequest.CacheChoice cacheChoice)
Sets the cache option. Pipeline might use different caches and eviction policies for each imagetype.
- Parameters:
cacheChoice- the cache choice to set
-
getCacheChoice
ImageRequest.CacheChoice getCacheChoice()
Gets the cache choice (profile image or default).
-
setProgressiveRenderingEnabled
ImageRequestBuilder setProgressiveRenderingEnabled(boolean enabled)
Enables or disables progressive rendering.
-
isProgressiveRenderingEnabled
boolean isProgressiveRenderingEnabled()
Returns whether progressive loading is enabled.
-
setLocalThumbnailPreviewsEnabled
ImageRequestBuilder setLocalThumbnailPreviewsEnabled(boolean enabled)
Enables or disables the use of local thumbnails as previews.
-
isLocalThumbnailPreviewsEnabled
boolean isLocalThumbnailPreviewsEnabled()
Returns whether the use of local thumbnails for previews is enabled.
-
setLoadThumbnailOnly
ImageRequestBuilder setLoadThumbnailOnly(boolean loadThumbnailOnly)
-
getLoadThumbnailOnly
boolean getLoadThumbnailOnly()
Returns whether the use of local thumbnails for previews is enabled.
-
disableDiskCache
ImageRequestBuilder disableDiskCache()
Disables disk cache for this request, regardless where the image will come from.
-
isDiskCacheEnabled
boolean isDiskCacheEnabled()
Returns whether the use of the disk cache is enabled, which is partly dependent on the URI.
-
disableMemoryCache
ImageRequestBuilder disableMemoryCache()
Disables memory cache for this request.
-
isMemoryCacheEnabled
boolean isMemoryCacheEnabled()
Returns whether the use of the memory cache is enabled.
-
setRequestPriority
ImageRequestBuilder setRequestPriority(Priority requestPriority)
Set priority for the request.
-
getRequestPriority
Priority getRequestPriority()
Returns the request priority.
-
setPostprocessor
ImageRequestBuilder setPostprocessor(@Nullable() Postprocessor postprocessor)
Sets the postprocessor.
- Parameters:
postprocessor- postprocessor to postprocess the output bitmap with.
-
getPostprocessor
@Nullable() Postprocessor getPostprocessor()
Gets postprocessor if set, null otherwise.
-
setRequestListener
ImageRequestBuilder setRequestListener(@Nullable() RequestListener requestListener)
Sets a request listener to use for just this image request
- Parameters:
requestListener- a request listener to use in addition to the global ones set in thecom.facebook.imagepipeline.core.ImagePipelineConfig
-
getRequestListener
@Nullable() RequestListener getRequestListener()
-
build
ImageRequest build()
Builds the Request.
-
shouldDecodePrefetches
@Nullable() Boolean shouldDecodePrefetches()
-
setShouldDecodePrefetches
ImageRequestBuilder setShouldDecodePrefetches(@Nullable() Boolean shouldDecodePrefetches)
-
setResizingAllowedOverride
ImageRequestBuilder setResizingAllowedOverride(@Nullable() Boolean resizingAllowedOverride)
-
getResizingAllowedOverride
@Nullable() Boolean getResizingAllowedOverride()
-
getDelayMs
int getDelayMs()
-
setDelayMs
ImageRequestBuilder setDelayMs(int delayMs)
Add an artificial delay for this image, in milliseconds.
-
-
-
-