Search in sources :

Example 1 with Focus

use of com.keylesspalace.tusky.entity.Attachment.Focus in project Tusky by Vavassor.

the class StatusBaseViewHolder method loadImage.

private void loadImage(MediaPreviewImageView imageView, @Nullable String previewUrl, @Nullable MetaData meta, @Nullable String blurhash) {
    Drawable placeholder = blurhash != null ? decodeBlurHash(blurhash) : mediaPreviewUnloaded;
    if (TextUtils.isEmpty(previewUrl)) {
        imageView.removeFocalPoint();
        Glide.with(imageView).load(placeholder).centerInside().into(imageView);
    } else {
        Focus focus = meta != null ? meta.getFocus() : null;
        if (focus != null) {
            // If there is a focal point for this attachment:
            imageView.setFocalPoint(focus);
            Glide.with(imageView).load(previewUrl).placeholder(placeholder).centerInside().addListener(imageView).into(imageView);
        } else {
            imageView.removeFocalPoint();
            Glide.with(imageView).load(previewUrl).placeholder(placeholder).centerInside().into(imageView);
        }
    }
}
Also used : Focus(com.keylesspalace.tusky.entity.Attachment.Focus) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Aggregations

BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Drawable (android.graphics.drawable.Drawable)1 Focus (com.keylesspalace.tusky.entity.Attachment.Focus)1