Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide not running scaleAnimation After retriving it from the Local Cache #1140

Closed
PrathameshKesarkar opened this issue Apr 20, 2016 · 1 comment
Labels

Comments

@PrathameshKesarkar
Copy link

I am trying to animate a ScaleIn Transition on An ImageView which is working perfectly fine when I try to open an Image for first Time but When I try to open The same Image for second TIme it doesn't animate for some reason after digging up the issue little bit I came to know that Glide skips the animation if it found Image in its local Cache

Is there any way I can run Animation even If it is present on Cache

Here's the code
Glide.with(this) .load(new File(imagePath)) .animate(R.anim.scale_in) .into(mSendImageView);

Glide Version: 3.6.1

@TWiStErRob
Copy link
Collaborator

Sorry, somehow I missed this.
The easiest workaround is .skipMemoryCache(true) which forces Glide to load each time from disk cache. It's not optimal, but it works and pretty simple.

A more complicated approach requires Glide 3.8.0, because of the method added in #1096; or v4

.animate(new ViewAnimationFactory<GlideDrawable>(context, R.anim.scale_in) {
    @Override public GlideAnimation<GlideDrawable> build(boolean isFromMemoryCache, boolean isFirstResource) {
        return super.build(false, isFirstResource);
    }
})

Notice that it calls super.build(false to ignore if it's from memory cache. This will lead to Glide believing that all loads missed the memory cache and hence will animate.

If you can't upgrade to 3.8.0-SNAPSHOT, you can do a similar inlining as seen in the listener of #527 (comment).

TWiStErRob added a commit to TWiStErRob/glide-support that referenced this issue Jul 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants