Class ImageViewTarget<Z>
- java.lang.Object
-
- com.bumptech.glide.request.target.BaseTarget<Z>
-
- com.bumptech.glide.request.target.ViewTarget<android.widget.ImageView,Z>
-
- com.bumptech.glide.request.target.ImageViewTarget<Z>
-
- Type Parameters:
Z- The type of resource that this target will display in the wrappedImageView.
- All Implemented Interfaces:
LifecycleListener,Target<Z>,Transition.ViewAdapter
- Direct Known Subclasses:
BitmapImageViewTarget,DrawableImageViewTarget,ThumbnailImageViewTarget
public abstract class ImageViewTarget<Z> extends ViewTarget<android.widget.ImageView,Z> implements Transition.ViewAdapter
A baseTargetfor displaying resources inImageViews.
-
-
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
Constructors Constructor Description ImageViewTarget(android.widget.ImageView view)ImageViewTarget(android.widget.ImageView view, boolean waitForLayout)Deprecated.UseViewTarget.waitForLayout()instead.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description android.graphics.drawable.DrawablegetCurrentDrawable()Returns the currentDrawablebeing displayed in the view usingImageView.getDrawable().voidonLoadCleared(android.graphics.drawable.Drawable placeholder)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).voidonLoadFailed(android.graphics.drawable.Drawable errorDrawable)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).voidonLoadStarted(android.graphics.drawable.Drawable placeholder)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).voidonResourceReady(Z resource, Transition<? super Z> transition)The method that will be called when the resource load has finished.voidonStart()Callback for whenFragment.onStart()} orActivity.onStart()is called.voidonStop()Callback for whenFragment.onStop()} orActivity.onStop()} is called.voidsetDrawable(android.graphics.drawable.Drawable drawable)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).protected abstract voidsetResource(Z resource)-
Methods inherited from class com.bumptech.glide.request.target.ViewTarget
clearOnDetach, getRequest, getSize, getView, removeCallback, setRequest, setTagId, toString, waitForLayout
-
Methods inherited from class com.bumptech.glide.request.target.BaseTarget
onDestroy
-
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.transition.Transition.ViewAdapter
getView
-
-
-
-
Constructor Detail
-
ImageViewTarget
public ImageViewTarget(android.widget.ImageView view)
-
ImageViewTarget
@Deprecated public ImageViewTarget(android.widget.ImageView view, boolean waitForLayout)Deprecated.UseViewTarget.waitForLayout()instead.
-
-
Method Detail
-
getCurrentDrawable
@Nullable public android.graphics.drawable.Drawable getCurrentDrawable()
Returns the currentDrawablebeing displayed in the view usingImageView.getDrawable().- Specified by:
getCurrentDrawablein interfaceTransition.ViewAdapter
-
setDrawable
public void setDrawable(android.graphics.drawable.Drawable drawable)
Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).- Specified by:
setDrawablein interfaceTransition.ViewAdapter- Parameters:
drawable- The drawable to display in the wrapped view.
-
onLoadStarted
public void onLoadStarted(@Nullable android.graphics.drawable.Drawable placeholder)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).- Specified by:
onLoadStartedin interfaceTarget<Z>- Overrides:
onLoadStartedin classViewTarget<android.widget.ImageView,Z>- Parameters:
placeholder- The placeholder drawable to optionally show, or null.
-
onLoadFailed
public void onLoadFailed(@Nullable android.graphics.drawable.Drawable errorDrawable)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).- Specified by:
onLoadFailedin interfaceTarget<Z>- Overrides:
onLoadFailedin classBaseTarget<Z>- Parameters:
errorDrawable- The error drawable to optionally show, or null.
-
onLoadCleared
public void onLoadCleared(@Nullable android.graphics.drawable.Drawable placeholder)Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).- Specified by:
onLoadClearedin interfaceTarget<Z>- Overrides:
onLoadClearedin classViewTarget<android.widget.ImageView,Z>- Parameters:
placeholder- The placeholder drawable to optionally show, or null.
-
onResourceReady
public void onResourceReady(@NonNull Z resource, @Nullable Transition<? super Z> transition)Description copied from interface:TargetThe method that will be called when the resource load has finished.- Specified by:
onResourceReadyin interfaceTarget<Z>- Parameters:
resource- the loaded resource.
-
onStart
public void onStart()
Description copied from interface:LifecycleListenerCallback for whenFragment.onStart()} orActivity.onStart()is called.- Specified by:
onStartin interfaceLifecycleListener- Overrides:
onStartin classBaseTarget<Z>
-
onStop
public void onStop()
Description copied from interface:LifecycleListenerCallback for whenFragment.onStop()} orActivity.onStop()} is called.- Specified by:
onStopin interfaceLifecycleListener- Overrides:
onStopin classBaseTarget<Z>
-
setResource
protected abstract void setResource(@Nullable Z resource)
-
-