Package 

Class RequestBuilder

    • Method Detail

      • error

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> error(Object model)

        Identical to calling error where the {@code RequestBuilder} is theresult of calling clone and removing any existing thumbnail and error {@code * RequestBuilders}.

        Other than thumbnail and error {@code RequestBuilder}s, which are removed, all other optionsare retained from the primary request. However, order matters! Any options applied afterthis method is called will not be applied to the error {@code RequestBuilder}.

        WARNING: Calling this method with a {@code model} whose type does not match the type of themodel passed to {@code load()} may be dangerous! Any options that were applied by the varioustype specific {@code load()} methods, like load will be copied to the errorrequest here even if the {@code model} you pass to this method doesn't match. Similary, optionsthat would be normally applied by type specific {@code load()} methods will not beapplied to this request. If this behavior is confusing or unexpected, use instead.

      • thumbnail

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> thumbnail(@Nullable() RequestBuilder<TranscodeType> thumbnailRequest)

        Loads and displays the resource retrieved by the given thumbnail request if it finishes beforethis request. Best used for loading thumbnail resources that are smaller and will be loadedmore quickly than the full size resource. There are no guarantees about the order in which therequests will actually finish. However, if the thumb request completes after the full request,the thumb resource will never replace the full resource.

        Recursive calls to thumbnail are supported.

        Overrides any previous calls to this method, thumbnail and .

        Parameters:
        thumbnailRequest - The request to use to load the thumbnail.
      • thumbnail

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> thumbnail(float sizeMultiplier)

        Loads a resource in an identical manner to this request except with the dimensions of thetarget multiplied by the given size multiplier. If the thumbnail load completes before the fullsize load, the thumbnail will be shown. If the thumbnail load completes after the full sizeload, the thumbnail will not be shown.

        Note - The thumbnail resource will be smaller than the size requested so the target (or ImageView) must be able to scale the thumbnail appropriately. See .

        Almost all options will be copied from the original load, including the , com.mobwith.imgmodule.load.ResourceDecoder,and com.mobwith.imgmodule.load.Transformations. However, and , and listener will only be used on the full size load and will not be copied for the thumbnail load.

        Recursive calls to thumbnail are supported.

        Overrides any previous calls to this method, thumbnail, and thumbnail.

        Parameters:
        sizeMultiplier - The multiplier to apply to the Target's dimensions when loadingthe thumbnail.
      • load

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> load(@Nullable() String string)

        Returns a request builder to load the given String.

        Note - this method caches data using only the given String as the cache key. If the data isa Uri outside of your control, or you otherwise expect the data represented by the given Stringto change without the String identifier changing, Consider using to mixin asignature you create that identifies the data currently at the given String that willinvalidate the cache if that data changes. Alternatively, using and/or may be appropriate.

        Parameters:
        string - A file path, or a uri or url handled by .
      • load

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> load(@Nullable() Uri uri)

        Returns a request builder to load the given Uri.

        Note - this method caches data at Uris using only the Uri itself as the cache key. The datarepresented by Uris from some content providers may change without the Uri changing, whichmeans using this method can lead to displaying stale data. Consider using to mixin asignature you create based on the data at the given Uri that will invalidate the cache if thatdata changes. Alternatively, using and/or may be appropriate.

        Parameters:
        uri - The Uri representing the image.
      • load

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> load(@Nullable() File file)

        Returns a request builder to load the given File.

        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 youexpect the data in the File to change, Consider using to mixin asignature you create that identifies the data currently in the File that will invalidate thecache if that data changes. Alternatively, using and/or may be appropriate.

        Parameters:
        file - The File containing the image
      • load

        @NonNull()@CheckResult() RequestBuilder<TranscodeType> load(@RawRes() @DrawableRes() @Nullable() Integer resourceId)

        Returns a request builder that uses the currently registered or Integer toload the image represented by the given Integer resource id. Defaults to to load resource id models.

        By default this method adds a version code and night mode based signature to the cache keyused to cache this resource in ImageModule. This signature is sufficient to guarantee that end userswill see the most up to date versions of your Drawables, but during development if you do notincrement your version code before each install and you replace a Drawable with different datawithout changing the Drawable name, you may see inconsistent cached data. To get around this,consider using NONE via duringdevelopment, and re-enabling the default for release builds.

        This method will load non-Bitmap resources like s. Although ImageModule makes a best effort to apply s to these Drawables by either extracting theunderlying Bitmap or by converting the Drawable to a Bitmap, ImageModule isstill not able to transform all types of resources. Animated Drawables cannot betransformed (other than com.mobwith.imgmodule.load.resource.gif.GifDrawable). To avoidload failures if a Drawable can't be transformed, use the optional transformationmethods like optionalTransform.

        In some cases converting Drawables to Bitmaps may be inefficient. Use thismethod, especially in conjunction with com.mobwith.imgmodule.load.Transformations withcaution for non-BitmapDrawables.

      • clone

        @CheckResult() RequestBuilder<TranscodeType> clone()

        Returns a copy of this request builder with all of the options put so far on this builder.

        This method returns a "deep" copy in that all non-immutable arguments are copied such thatchanges to one builder will not affect the other builder. However, in addition to immutablearguments, the current model is not copied so changes to the model will affect both builders.

      • into

        @NonNull() ViewTarget<ImageView, TranscodeType> into(@NonNull() ImageView view)

        Sets the ImageView the resource will be loaded into, cancels any existing loads intothe view, and frees any resources ImageModule may have previously loaded into the view so they may bereused.

        Parameters:
        view - The view to cancel previous loads for and load the new resource into.
      • into

        @Deprecated() FutureTarget<TranscodeType> into(int width, int height)

        Returns a future that can be used to do a blocking get on a background thread.

        Parameters:
        width - The desired width in pixels, or SIZE_ORIGINAL.
        height - The desired height in pixels, or SIZE_ORIGINAL.
      • submit

        @NonNull() FutureTarget<TranscodeType> submit()

        Returns a future that can be used to do a blocking get on a background thread.

        This method defaults to SIZE_ORIGINAL for the width and the height. However,since the width and height will be overridden by values passed to , this method can be used whenever RequestOptions with override values are applied, or whenever you want to retrieve the image in its originalsize.

      • submit

        @NonNull() FutureTarget<TranscodeType> submit(int width, int height)

        Returns a future that can be used to do a blocking get on a background thread.

        Parameters:
        width - The desired width in pixels, or SIZE_ORIGINAL.
        height - The desired height in pixels, or SIZE_ORIGINAL.
      • preload

        @NonNull() Target<TranscodeType> preload(int width, int height)

        Preloads the resource into the cache using the given width and height.

        Pre-loading is useful for making sure that resources you are going to to want in the nearfuture are available quickly.

        Parameters:
        width - The desired width in pixels, or SIZE_ORIGINAL.
        height - The desired height in pixels, or SIZE_ORIGINAL.
      • preload

        @NonNull() Target<TranscodeType> preload()

        Preloads the resource into the cache using SIZE_ORIGINAL as the target width andheight. Equivalent to calling preload with SIZE_ORIGINAL asthe width and height.

      • downloadOnly

        @Deprecated()@CheckResult() <Y extends Target<File>> Y downloadOnly(@NonNull() Y target)

        Loads the original unmodified data into the cache and calls the given Target with the cacheFile.

        Parameters:
        target - The Target that will receive the cache File when the load completes
      • downloadOnly

        @Deprecated()@CheckResult() FutureTarget<File> downloadOnly(int width, int height)

        Loads the original unmodified data into the cache and returns a that can be used to retrieve the cache File containing the data.

        Parameters:
        width - The width in pixels to use to fetch the data.
        height - The height in pixels to use to fetch the data.