BigImageViewer icon indicating copy to clipboard operation
BigImageViewer copied to clipboard

corrected exit tranisition animation with zoom

Open KirkBushman opened this issue 4 years ago • 8 comments

Hi, I'm committing what we discussed in #176, I've fixed the sample app, divided in two activities, and fixed the exit out animation while zoomed in the second activity.

We can delay the exit animation using finishAfterTransition() and un-zooming with some controls that I added to BIV.

Check it out, and let me know if it's good to commit. I want to try this in my app.

PS: I see some distorsion on Fresco, I see it has it's own animations method, we should try that, I think, this lib should not fix the weirdness of Fresco, we integrated well with transition animation, that should be the end of it.

KirkBushman avatar Oct 22 '19 11:10 KirkBushman

Hi @KirkBushman , thanks for your contribution!

The code looks fine to me, but I did some test, the result seems depend on the image, please test with this setting:

    companion object {
        private const val THUMB_URL =
                "http://img1.imgtn.bdimg.com/it/u=1520386803,778399414&fm=21&gp=0.jpg"
        private const val SOURCE_URL =
                "https://youimg1.c-ctrip.com/target/tg/773/732/734/7ca19416b8cd423f8f6ef2d08366b7dc.jpg"
    }

Piasy avatar Oct 22 '19 13:10 Piasy

It happens because the height of the image is greater than the height of the view, so it tries to fit it using scale type, but the thumbnail scaleType and the mainView scaleType are not the same.

For a better result we should use ScaleType fixXY on both, but since SSIV extends View and not ImageView, our hands are tied.

it happens differently with this:

private const val THUMB_URL = "https://preview.redd.it/k18ckrkhrzt31.jpg?width=640&crop=smart&auto=webp&s=32ee988aaf9dd0af480cc2df104e38fd8ce73b03" private const val SOURCE_URL = "https://i.redd.it/k18ckrkhrzt31.jpg"

We should find a way to handle the scale type in SSIV, but the project is dead, no commits since may of last year, ignored all issues. We should evaluate using a fork that handles scale type the standard way. What do you think.

KirkBushman avatar Oct 23 '19 09:10 KirkBushman

Forking SSIV sounds not bad, you can try that :)

Piasy avatar Oct 24 '19 00:10 Piasy

Wait, I can't tell if you're joking, I already have a fork of that, will you switch to a fork?

KirkBushman avatar Oct 24 '19 06:10 KirkBushman

I'm not joking...

If the issue could be fixed properly, I think it's okay to switch to another fork, at least for a special branch of BIV.

Piasy avatar Oct 24 '19 10:10 Piasy

Ok, this is a more broad and complicated task, I'll do it as soon as I have time free

KirkBushman avatar Oct 24 '19 18:10 KirkBushman

Hi @Piasy, long time no see, I was very busy during this month...

I started getting back to solve this problem once and for all, reworking SSIV, but I'm encountering difficulties: since SSIV is extending View directly and not ImageView, it's very different, and I always end up with some problem at the end. I'll keep trying, and if desperate I'll move all the subsampling code in an external class that is working with ImageView like https://github.com/chrisbanes/PhotoView

But if anyone wants a quick fix for this type of problem, that works with both tall and wide images, you can watch my fork.

Since SSIV, by default uses a scale implementation very similar to fit center, and only works well with that, if you set both thumbnail to android:scaleType="fitCenter" you should see it working.

KirkBushman avatar Dec 08 '19 12:12 KirkBushman

Hey it's me again. I'm having some troubles with custom ImageViewFactory at the moment, can you read #187 and tell me what you think?

Maybe merge this till we can figure something out.

KirkBushman avatar Dec 13 '19 21:12 KirkBushman