shts / StoriesProgressView

show horizontal progress like instagram stories.
Apache License 2.0
885 stars 203 forks source link

Add method to reset a progress #17

Open teresaholfeld opened 5 years ago

teresaholfeld commented 5 years ago

I need a method where I can reset a progress. I have issues with skip() and reverse(), because once the progress finished, they stopped working. The reason is that StoryProgressView.isComplete is true. If I had a way of resetting that state, so that isComplete is false again, this would help a lot.

dajver commented 5 years ago

call stop method to clear progress

teresaholfeld commented 5 years ago

There is no stop method. I made a PR that fixes that and adds a clear method.

adiazarya100 commented 5 years ago

Hi, You can take the code and add this simple method:

public void setIsComplete(boolean bool) {
        isComplete = bool;
    }

Then just call:

@Override
    public void onComplete() {
        counter = 0;
        storiesProgressView.setIsComplete(false);
        destroy();
        initStory();
    }

*initStory => is my method. I initialize all the story data over there. It works fine for me. Let me know if you need more help :)

teresaholfeld commented 5 years ago

@adiazarya100 I already added a PR that is solving this: #18 If you work on an open source project and find yourself downloading and editing the code of that, it is good practice to make a pull request with your changes. That way, the owner of the project can merge the changes, and other people can profit from your improvement too. On GitHub you can make a pull request if you fork a repository and commit your changes. Then in your forked repository there's a button for creating the Pull Request. That's good practice for open source contributing. 👍