com.bumptech.glide.request.target
Class ImageViewTarget<Z>

java.lang.Object
  extended by com.bumptech.glide.request.target.BaseTarget<Z>
      extended by com.bumptech.glide.request.target.ViewTarget<ImageView,Z>
          extended by com.bumptech.glide.request.target.ImageViewTarget<Z>
Type Parameters:
Z - The type of resource that this target will display in the wrapped ImageView.
All Implemented Interfaces:
LifecycleListener, GlideAnimation.ViewAdapter, Target<Z>
Direct Known Subclasses:
BitmapImageViewTarget, DrawableImageViewTarget, GlideDrawableImageViewTarget

public abstract class ImageViewTarget<Z>
extends ViewTarget<ImageView,Z>
implements GlideAnimation.ViewAdapter

A base Target for displaying resources in ImageViews.


Field Summary
 
Fields inherited from class com.bumptech.glide.request.target.ViewTarget
view
 
Fields inherited from interface com.bumptech.glide.request.target.Target
SIZE_ORIGINAL
 
Constructor Summary
ImageViewTarget(ImageView view)
           
 
Method Summary
 Drawable getCurrentDrawable()
          Returns the current Drawable being displayed in the view using ImageView.getDrawable().
 void onLoadCleared(Drawable placeholder)
          Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).
 void onLoadFailed(Exception e, Drawable errorDrawable)
          Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).
 void onLoadStarted(Drawable placeholder)
          Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).
 void onResourceReady(Z resource, GlideAnimation<? super Z> glideAnimation)
          The method that will be called when the resource load has finished.
 void setDrawable(Drawable drawable)
          Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).
protected abstract  void setResource(Z resource)
           
 
Methods inherited from class com.bumptech.glide.request.target.ViewTarget
getRequest, getSize, getView, setRequest, setTagId, toString
 
Methods inherited from class com.bumptech.glide.request.target.BaseTarget
onDestroy, onStart, onStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bumptech.glide.request.animation.GlideAnimation.ViewAdapter
getView
 

Constructor Detail

ImageViewTarget

public ImageViewTarget(ImageView view)
Method Detail

getCurrentDrawable

public Drawable getCurrentDrawable()
Returns the current Drawable being displayed in the view using ImageView.getDrawable().

Specified by:
getCurrentDrawable in interface GlideAnimation.ViewAdapter

setDrawable

public void setDrawable(Drawable drawable)
Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).

Specified by:
setDrawable in interface GlideAnimation.ViewAdapter
Parameters:
drawable - The drawable to display in the wrapped view.

onLoadStarted

public void onLoadStarted(Drawable placeholder)
Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).

Specified by:
onLoadStarted in interface Target<Z>
Overrides:
onLoadStarted in class BaseTarget<Z>
Parameters:
placeholder - The placeholder drawable to optionally show, or null.

onLoadFailed

public void onLoadFailed(Exception e,
                         Drawable errorDrawable)
Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).

Specified by:
onLoadFailed in interface Target<Z>
Overrides:
onLoadFailed in class BaseTarget<Z>
Parameters:
errorDrawable - The error drawable to optionally show, or null.
e - The exception causing the load to fail, or null if no exception occurred (usually because a decoder simply returned null).

onLoadCleared

public void onLoadCleared(Drawable placeholder)
Sets the given Drawable on the view using ImageView.setImageDrawable(android.graphics.drawable.Drawable).

Specified by:
onLoadCleared in interface Target<Z>
Overrides:
onLoadCleared in class BaseTarget<Z>
Parameters:
placeholder - The placeholder drawable to optionally show, or null.

onResourceReady

public void onResourceReady(Z resource,
                            GlideAnimation<? super Z> glideAnimation)
Description copied from interface: Target
The method that will be called when the resource load has finished.

Specified by:
onResourceReady in interface Target<Z>
Parameters:
resource - the loaded resource.

setResource

protected abstract void setResource(Z resource)