1package com.bumptech.glide.request.target;
2
3import android.graphics.Bitmap;
4import android.graphics.drawable.Drawable;
5import android.widget.ImageView;
6import com.bumptech.glide.request.GlideAnimation;
7
8/**
9 * A target wrapping an ImageView. Obtains the runtime dimensions of the ImageView.
10 */
11public class BitmapImageViewTarget extends ViewTarget<ImageView, Bitmap> {
12    private final ImageView view;
13
14    public BitmapImageViewTarget(ImageView view) {
15        super(view);
16        this.view = view;
17    }
18
19    @Override
20    public void onResourceReady(Bitmap resource, GlideAnimation<Bitmap> glideAnimation) {
21        if (glideAnimation == null || !glideAnimation.animate(view.getDrawable(), resource, view, this)) {
22            view.setImageBitmap(resource);
23        }
24    }
25
26    @Override
27    public void setPlaceholder(Drawable placeholder) {
28        view.setImageDrawable(placeholder);
29    }
30}
31