1 package com.bumptech.glide.request.target; 2 3 import android.graphics.drawable.Drawable; 4 5 import com.bumptech.glide.request.Request; 6 7 /** 8 * A base {@link Target} for loading {@link com.bumptech.glide.load.engine.Resource}s that provides basic or empty 9 * implementations for most methods. 10 * 11 * <p> 12 * For maximum efficiency, clear this target when you have finished using or displaying the 13 * {@link com.bumptech.glide.load.engine.Resource} loaded into it using 14 * {@link com.bumptech.glide.Glide#clear(Target)}. 15 * </p> 16 * 17 * <p> 18 * For loading {@link com.bumptech.glide.load.engine.Resource}s into {@link android.view.View}s, 19 * {@link com.bumptech.glide.request.target.ViewTarget} or {@link com.bumptech.glide.request.target.ImageViewTarget} 20 * are preferable. 21 * </p> 22 * 23 * @param <Z> The type of resource that will be received by this target. 24 */ 25 public abstract class BaseTarget<Z> implements Target<Z> { 26 27 private Request request; 28 29 /** 30 * {@inheritDoc} 31 */ 32 @Override 33 public void setRequest(Request request) { 34 this.request = request; 35 } 36 37 /** 38 * {@inheritDoc} 39 */ 40 @Override 41 public Request getRequest() { 42 return request; 43 } 44 45 /** 46 * {@inheritDoc} 47 */ 48 @Override 49 public void onLoadCleared(Drawable placeholder) { 50 // Do nothing. 51 } 52 53 /** 54 * {@inheritDoc} 55 */ 56 @Override 57 public void onLoadStarted(Drawable placeholder) { 58 // Do nothing. 59 } 60 61 /** 62 * {@inheritDoc} 63 */ 64 @Override 65 public void onLoadFailed(Exception e, Drawable errorDrawable) { 66 // Do nothing. 67 } 68 69 /** 70 * {@inheritDoc} 71 */ 72 @Override 73 public void onStart() { 74 // Do nothing. 75 } 76 77 /** 78 * {@inheritDoc} 79 */ 80 @Override 81 public void onStop() { 82 // Do nothing. 83 } 84 85 /** 86 * {@inheritDoc} 87 */ 88 @Override 89 public void onDestroy() { 90 // Do nothing. 91 } 92 } 93