Giter VIP home page Giter VIP logo

Comments (6)

NeedNap avatar NeedNap commented on May 28, 2024

This fixed is wrong!
You must put the following code:

if (animationCallback != null) {
animationCallback.onStop();
animationThread = null;
break;
}

inside the do...while loop on run method (at the end position) and remove all the code you added after the while.

It works for me.

from gifimageview.

AfzalivE avatar AfzalivE commented on May 28, 2024

Why is it wrong?

When the loop breaks, animation stops so onStop should be called there. Instead of putting that block before every break statement in that loop, you just put it outside and it will be called after break.

from gifimageview.

NeedNap avatar NeedNap commented on May 28, 2024

Your code is wrong because the do...while loop never exit so, the code outside that will never be executed!

Did you try your code? Did it work?

from gifimageview.

AfzalivE avatar AfzalivE commented on May 28, 2024

Yes.

It works because it sets "animating" to true or false depending on the loop count and the frame pointer. In the next iteration of the loop, the "animating" variable is checked three times and the loop breaks if it's false, after which the code will be called.

from gifimageview.

NeedNap avatar NeedNap commented on May 28, 2024

It's very strange: with my animated gif the loop never stops :(

I had to change the code as I told you... Can you send me a gif that works for you?
Thanks

from gifimageview.

AfzalivE avatar AfzalivE commented on May 28, 2024

It's dependent on the gif. Gifs have metadata to determine how many times they should loop. Now the only thing wrong in that code is that if you have loopCount != 0, then it loops forever instead of looping the correct number of times.

https://raw.githubusercontent.com/AfzalivE/GifImageView/74644c0e02761f93c707a626ca7b76dfc702dfcc/app/src/main/assets/chop.gif

from gifimageview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.