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>

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.
          }

      });
 }
 
 


Constructor Summary
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(int width,
                    int height)
Constructor for the target that takes the desired dimensions of the decoded and/or transformed resource.

Parameters:
width - The desired width of the resource.
height - The desired height of the 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