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

java.lang.Object
  extended by com.bumptech.glide.request.target.BaseTarget<Z>
      extended by com.bumptech.glide.request.target.SimpleTarget<Z>
Type Parameters:
Z - The type of resource that this target will receive.
All Implemented Interfaces:
LifecycleListener, Target<Z>
Direct Known Subclasses:
AppWidgetTarget, NotificationTarget, PreloadTarget

public abstract class SimpleTarget<Z>
extends BaseTarget<Z>

A simple Target base class with default (usually noop) implementations of non essential methods that allows the caller to specify an exact width/height. Typicaly use cases look something like this:

 
 Glide.load("http://somefakeurl.com/fakeImage.jpeg")
      .asBitmap()
      .fitCenter()
      .into(new SimpleTarget(250, 250) {

          @Override
          public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
              // Do something with bitmap here.
          }

      });
 }
 
 


Field Summary
 
Fields inherited from interface com.bumptech.glide.request.target.Target
SIZE_ORIGINAL
 
Constructor Summary
SimpleTarget()
          Constructor for the target that uses Target.SIZE_ORIGINAL as the target width and height.
SimpleTarget(int width, int height)
          Constructor for the target that takes the desired dimensions of the decoded and/or transformed resource.
 
Method Summary
 void getSize(SizeReadyCallback cb)
          Immediately calls the given callback with the sizes given in the constructor.
 
Methods inherited from class com.bumptech.glide.request.target.BaseTarget
getRequest, onDestroy, onLoadCleared, onLoadFailed, onLoadStarted, onStart, onStop, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bumptech.glide.request.target.Target
onResourceReady
 

Constructor Detail

SimpleTarget

public SimpleTarget()
Constructor for the target that uses Target.SIZE_ORIGINAL as the target width and height.


SimpleTarget

public SimpleTarget(int width,
                    int height)
Constructor for the target that takes the desired dimensions of the decoded and/or transformed resource.

Parameters:
width - The width in pixels of the desired resource.
height - The height in pixels of the desired resource.
Method Detail

getSize

public final void getSize(SizeReadyCallback cb)
Immediately calls the given callback with the sizes given in the constructor.

Parameters:
cb - The callback that must be called when the size of the target has been determined