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

Doesn't stop if the delay between progressiveStart() and progressiveStop() is very short #84

Open
sevar83 opened this issue Nov 17, 2015 · 3 comments

Comments

@sevar83
Copy link

sevar83 commented Nov 17, 2015

I don't have time to dig it, but in mUpdater there's a condition which is never satisfied and stop() isn't called:

if (isFinishing()) {
        mFinishingOffset += (OFFSET_PER_FRAME * mProgressiveStopSpeed);
        mCurrentOffset += (OFFSET_PER_FRAME * mProgressiveStopSpeed);
        if (mFinishingOffset >= 1f) {
          stop();
        }
   ...
@sevar83
Copy link
Author

sevar83 commented Nov 17, 2015

Found something. Before to reach stop() in the next few frames ProgressBar.drawTrack() calls SmoothProgressDrawable.start() which does:

if (mProgressiveStartActivated) {
      resetProgressiveStart(0);
}
...

This actually restarts the progress before it has chance to reach stop(). I guess you should check for mIsFinishing in the if above.

I workaround it by running progressiveStop() in Handler.postDelayed() with delay above 500 ms, that is 30 frames. That's the time needed for OFFSET_PER_FRAME * mProgressiveStopSpeed to reach 1.0.

@castorflex
Copy link
Owner

Hey, thanks for the detailed issue, I'll have a look

@alxrm
Copy link

alxrm commented Jan 5, 2019

To me it was fixed by doing this:

progress.setSmoothProgressDrawableCallbacks(object : SmoothProgressDrawable.Callbacks {
    override fun onStop() {
        progress.visibility = GONE
    }

    override fun onStart() {
        progress.visibility = VISIBLE
    }
})

If you are able to hide it, this might be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants