com.bumptech.glide.request.target
Class SimpleTarget<Z>
java.lang.Object
com.bumptech.glide.request.target.BaseTarget<Z>
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:
- 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.
}
});
}
Constructor Summary |
SimpleTarget()
Constructor for the target that assumes you will have called
GenericRequestBuilder.override(int, int) on the request builder this target is given
to. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleTarget
public SimpleTarget()
- Constructor for the target that assumes you will have called
GenericRequestBuilder.override(int, int)
on the request builder this target is given
to.
Requests that load into this target will throw an IllegalArgumentException
if
GenericRequestBuilder.override(int, int)
was not called on the request builder.
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.
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