Interface Target<R>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int SIZE_ORIGINAL
      Indicates that we want the resource in its original unmodified width and/or height.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Request getRequest()
      Retrieves the current request for this target, should not be called outside of Glide.
      void getSize​(SizeReadyCallback cb)
      A method to retrieve the size of this target.
      void onLoadCleared​(android.graphics.drawable.Drawable placeholder)
      A mandatory lifecycle callback that is called when a load is cancelled and its resources are freed.
      void onLoadFailed​(android.graphics.drawable.Drawable errorDrawable)
      A mandatory lifecycle callback that is called when a load fails.
      void onLoadStarted​(android.graphics.drawable.Drawable placeholder)
      A lifecycle callback that is called when a load is started.
      void onResourceReady​(R resource, Transition<? super R> transition)
      The method that will be called when the resource load has finished.
      void removeCallback​(SizeReadyCallback cb)
      Removes the given callback from the pending set if it's still retained.
      void setRequest​(Request request)
      Sets the current request for this target to retain, should not be called outside of Glide.
    • Field Detail

      • SIZE_ORIGINAL

        static final int SIZE_ORIGINAL
        Indicates that we want the resource in its original unmodified width and/or height.
        See Also:
        Constant Field Values
    • Method Detail

      • onLoadStarted

        void onLoadStarted​(@Nullable
                           android.graphics.drawable.Drawable placeholder)
        A lifecycle callback that is called when a load is started.

        Note - This may not be called for every load, it is possible for example for loads to fail before the load starts (when the model object is null).

        Note - This method may be called multiple times before any other lifecycle method is called. Loads can be paused and restarted due to lifecycle or connectivity events and each restart may cause a call here.

        Parameters:
        placeholder - The placeholder drawable to optionally show, or null.
      • onLoadFailed

        void onLoadFailed​(@Nullable
                          android.graphics.drawable.Drawable errorDrawable)
        A mandatory lifecycle callback that is called when a load fails.

        Note - This may be called before onLoadStarted(android.graphics.drawable.Drawable) if the model object is null.

        You must ensure that any current Drawable received in onResourceReady(Object, Transition) is no longer used before redrawing the container (usually a View) or changing its visibility.

        Parameters:
        errorDrawable - The error drawable to optionally show, or null.
      • onResourceReady

        void onResourceReady​(@NonNull
                             R resource,
                             @Nullable
                             Transition<? super R> transition)
        The method that will be called when the resource load has finished.
        Parameters:
        resource - the loaded resource.
      • onLoadCleared

        void onLoadCleared​(@Nullable
                           android.graphics.drawable.Drawable placeholder)
        A mandatory lifecycle callback that is called when a load is cancelled and its resources are freed.

        You must ensure that any current Drawable received in onResourceReady(Object, Transition) is no longer used before redrawing the container (usually a View) or changing its visibility.

        Parameters:
        placeholder - The placeholder drawable to optionally show, or null.
      • getSize

        void getSize​(@NonNull
                     SizeReadyCallback cb)
        A method to retrieve the size of this target.
        Parameters:
        cb - The callback that must be called when the size of the target has been determined
      • removeCallback

        void removeCallback​(@NonNull
                            SizeReadyCallback cb)
        Removes the given callback from the pending set if it's still retained.
        Parameters:
        cb - The callback to remove.
      • setRequest

        void setRequest​(@Nullable
                        Request request)
        Sets the current request for this target to retain, should not be called outside of Glide.
      • getRequest

        @Nullable
        Request getRequest()
        Retrieves the current request for this target, should not be called outside of Glide.