Target.java revision 531667420f0cb59e01e0ae5928392469006148dd
1package com.bumptech.glide.request.target; 2 3import android.graphics.drawable.Drawable; 4import com.bumptech.glide.request.GlideAnimation; 5import com.bumptech.glide.request.Request; 6 7/** 8 * An interface that Glide can load an image into 9 * 10 * @param <Z> The type of resource the target can display. 11 */ 12public interface Target<R> { 13 14 /** 15 * A callback that must be called when the target has determined its size. For fixed size targets it can 16 * be called synchronously. 17 */ 18 public interface SizeReadyCallback { 19 public void onSizeReady(int width, int height); 20 } 21 22 /** 23 * The method that will be called when the image load has finished 24 * @param resource the loaded resource. 25 */ 26 public void onResourceReady(R resource, GlideAnimation<R> glideAnimation); 27 28 /** 29 * A method that can optionally be implemented to set any placeholder that might have been passed to Glide to 30 * display either while an image is loading or after the load has failed. 31 * 32 * @param placeholder The drawable to display 33 */ 34 public void setPlaceholder(Drawable placeholder); 35 36 /** 37 * A method to retrieve the size of this target 38 * @param cb The callback that must be called when the size of the target has been determined 39 */ 40 public void getSize(SizeReadyCallback cb); 41 42 public void setRequest(Request request); 43 44 public Request getRequest(); 45} 46