davemorrissey/subsampling-scale-image-view

How to use Fade animation on image load?

flamyoad opened this issue · 1 comments

I can't find any sample at all because no one seemed to want to use transition animation on image load for SSIV.

Basically, I wanted the image to have Fade animation before showing. Because without the fade animation, the RecyclerView flickers like the Porygon flashing episode in the old Pokemon series. It's very uncomfortable.

Is there any equivalent for this?

         Glide.with(itemView)
                .load(file.toUri())
                .transition(DrawableTransitionOptions.withCrossFade()) <-- This is what I'm looking for
                .into(photoView)

This is what I'm using so far

        fun bind(file: File) {
            imageView.setImage(ImageSource.uri(Uri.fromFile(file)))
        }

The view doesn't support crossfading from one image to another. You could create another view overlayed on top, and animate the opacity of that after the image is loaded, but it may need to start at 1% opacity to guarantee the image loads. I am not sure how to do this.