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

After progressiveStop() is called, the callback method onStop() is called infinite times #57

Open
Dangiras opened this issue Oct 9, 2014 · 1 comment

Comments

@Dangiras
Copy link

Dangiras commented Oct 9, 2014

When I call progressiveStart() on progress bar it works fine, but when I call progressiveStop(), the calback method onStop() is being called infinite times. Am I missing something here?

SmoothProgressBar:

<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
        android:id="@+id/pb_google_plus"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:indeterminate="true"
        style="@style/GPlusProgressBar"
        android:visibility="gone"/>

style GPlusProgressBar:

    <style name="GPlusProgressBar" parent="SmoothProgressBar">
        <item name="spb_stroke_separator_length">12dp</item>
        <item name="spb_sections_count">4</item>
        <item name="spb_speed">1.7</item>
        <item name="spb_interpolator">spb_interpolator_linear</item>
        <item name="spb_colors">@array/gplus_colors</item>
    </style>

set callbacks:

    mProgressBar.setSmoothProgressDrawableCallbacks(new SmoothProgressDrawable.Callbacks() {
        @Override
        public void onStop() {
            mProgressBar.setVisibility(View.GONE);
        }

        @Override
        public void onStart() {
            mProgressBar.setVisibility(View.VISIBLE);
        }
    });
@castorflex
Copy link
Owner

Related to #35.

The ActivityThread change the visibility of the decor after onResume() is called, setting it to INVISIBLE, then to VISIBLE. This visibility change will be dispatched through the whole hierarchy, including ProgressBar. When the ProgressBar's onVisibilityChanged(View, int) is called with a visibility = GONE/INVISIBLE, it stops the animation, which will call the SmoothProgressBar.CallBacks#onStop() method.
That is why onStop() will be called just after onStart(). Unfortunately, we set the visibility to GONE in the callback, so the ProgressBar won't be shown :(

Didn't have the time to find a workaround yet. And forgot a bit too TBH.

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

2 participants