Class ImageViewTarget<Z>
java.lang.Object
com.bumptech.glide.request.target.BaseTarget<Z>
com.bumptech.glide.request.target.ViewTarget<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<ImageView,Z>
implements Transition.ViewAdapter
-
Field Summary
Fields inherited from class com.bumptech.glide.request.target.ViewTarget
viewFields inherited from interface com.bumptech.glide.request.target.Target
SIZE_ORIGINAL -
Constructor Summary
ConstructorsConstructorDescriptionImageViewTarget(ImageView view) ImageViewTarget(ImageView view, boolean waitForLayout) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionReturns the currentDrawablebeing displayed in the view usingImageView.getDrawable().voidonLoadCleared(Drawable placeholder) Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).voidonLoadFailed(Drawable errorDrawable) Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).voidonLoadStarted(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(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, waitForLayoutMethods inherited from class com.bumptech.glide.request.target.BaseTarget
onDestroyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.bumptech.glide.request.transition.Transition.ViewAdapter
getView
-
Constructor Details
-
ImageViewTarget
-
ImageViewTarget
Deprecated.UseViewTarget.waitForLayout()instead.
-
-
Method Details
-
getCurrentDrawable
Returns the currentDrawablebeing displayed in the view usingImageView.getDrawable().- Specified by:
getCurrentDrawablein interfaceTransition.ViewAdapter
-
setDrawable
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
Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).- Specified by:
onLoadStartedin interfaceTarget<Z>- Overrides:
onLoadStartedin classViewTarget<ImageView,Z> - Parameters:
placeholder- The placeholder drawable to optionally show, or null.
-
onLoadFailed
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
Sets the givenDrawableon the view usingImageView.setImageDrawable(android.graphics.drawable.Drawable).- Specified by:
onLoadClearedin interfaceTarget<Z>- Overrides:
onLoadClearedin classViewTarget<ImageView,Z> - Parameters:
placeholder- The placeholder drawable to optionally show, or null.
-
onResourceReady
Description copied from interface:TargetThe method that will be called when the resource load has finished.This may be called multiple times both within a single load and also across different loads if the
Targetobject is re-used.Within a single load this may be called multiple times for reasons that include:
- The load uses one or more thumbnails. Each time a thumbnail load completes successfully
and no higher priority load has finished, this method will be called with the thumbnail
resource. See
RequestBuilder.thumbnail(com.bumptech.glide.RequestBuilder). - The load is paused and restarted. This can happen automatically in response to
connectivity changes or the Activity / Fragment lifecycle. It can also happen if
RequestManager.pauseRequests()is called manually.
- Specified by:
onResourceReadyin interfaceTarget<Z>- Parameters:
resource- the loaded resource.
- The load uses one or more thumbnails. Each time a thumbnail load completes successfully
and no higher priority load has finished, this method will be called with the thumbnail
resource. See
-
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
-
ViewTarget.waitForLayout()instead.