GithubHelp home page GithubHelp logo

Comments (11)

castorflex avatar castorflex commented on July 20, 2024

Hi @thermometer.

Thank you for your detailed issue!

You make me realize I really have to write some doc :s ... sorry about that.

If the attribute spb_progressiveStart_activated is set to true, that means the progressbar will be started progressively every times it is shown. To be honest, I am really thinking about removing this attribute in the future releases.

Can you try to set the spb_progressiveStart_activated to false (or simply remove it), and call progressiveStart / progressiveStop.

I'll try to reproduce it,

Thanks!

from smoothprogressbar.

castorflex avatar castorflex commented on July 20, 2024

Actually I just tried to reproduce it, and couldn't. I created a branch (named issue35) to try to reproduce your problem. Here is the commit: 2d93cd0

Can you try to install the sample app or modify the sample app code in this branch so we can reproduce your issue?

Thank you.

from smoothprogressbar.

Thermometer91 avatar Thermometer91 commented on July 20, 2024

Awesome! Thanks for the quick reply.

Yeah I think the javadoc/readme could use some work. I can help with the readme part if you want 👍

I noticed that when I only have 1 activity with the progress bar, the issue won't occur. I think it has something to do with me having another activity with a progressbar (both with an instance of the listener) on top of the activity. I will try to reproduce it in the sample and let you know here.

from smoothprogressbar.

sahildave avatar sahildave commented on July 20, 2024

Hi, does the stop animation of the progressbar is like SwipeRefreshLayout? i.e the ongoing animation gets completed first before making the progressbar invisible or gone?

I am just setting setVisiblity as gone after my asynctask is completed. How could I make it end with a more smoother animation?

from smoothprogressbar.

castorflex avatar castorflex commented on July 20, 2024

@sahildave The stop method just stops the animation. I think you are refering to the progressStop method.

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

      @Override
      public void onStart() {
        mPocketBar.setVisibility(View.VISIBLE);
      }
    });

    mProgressBar.progressiveStop();

PS: please, create a StackOverflow post next time

from smoothprogressbar.

Thermometer91 avatar Thermometer91 commented on July 20, 2024

Heya,

I partly reproduced my issue in the sample you provided. If I add the listener, set initial visibility to gone in the XML and then start the progressBar, it stays hidden until I again activate it via the button on progressiveStart(). Weirdly enough, after activating it via the button, if I stop it, and try to activate it again, it can't get visible anymore. I tried to replicate my issue (with 2 activities loaded, both having a progressBar and listeners), but that doesn't seem to make a difference.

Now, the same implementation of the sample and my app, shows different results. In my app, only the second activity I start, won't show the progressBar. The first works fine with the same code. In the sample, both activities won't show the progressBar. I have the feeling it has something to do with my first activity having a fragment in it with the progressBar, instead of in the activity.

A theory I have why the progressBar won't show in the sample, is because I may start it earlier (in onCreate() ) than the XML is rendered (with visibility="gone"), but I have too little knowledge of the render order to know this theory to be true. This also won't explain why the progressBar won't get visible anymore, after the progressiveStop().

Now, for my original issue, I fixed my problem. I removed spb_progressiveStart_activated, initial visibility and all changes to visibility. The only reason I was setting visibility on start and stop, was because spb_progressiveStart_activated made the progressBar active on resume. Now everything behaves as it should. Maybe it is a good idea to remove the spb_progressiveStart_activated property altogether or document it better in the readme.

from smoothprogressbar.

castorflex avatar castorflex commented on July 20, 2024

Can you test 424e40c ?

from smoothprogressbar.

Thermometer91 avatar Thermometer91 commented on July 20, 2024

Awesome, that fixes the onStart() method that only got called once. Any idea why it isn't visible initially in the sample (on this branch)? I expect that to be something out of the scope for your library, so you can close this issue if you want 👍 . Do you want me to try modifying the readme to make it clearer to understand and submit a pull req?

from smoothprogressbar.

castorflex avatar castorflex commented on July 20, 2024

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 :(

I'll try to work around.

from smoothprogressbar.

kalvn avatar kalvn commented on July 20, 2024

I have the same kind of issue when displaying the SmoothProgressBar in a fragment which is inside a ViewPager.
For example in my application, I have 3 pages so 3 framgents with the same type. On loading, I display the smoothscrollingbar on the 2 first fragments because they have stuff to load but not the third one. Nevertheless, when I swipe to the third page, the smoothscrollingbar is displayed (even if I put it INVISIBLE in the XML).

It's like something is showing it in the onStart or onResume of the fragment, which is called each time you swipe to a page.

from smoothprogressbar.

drindt avatar drindt commented on July 20, 2024

Here seems that:

android:indeterminate="true"

is the problem. When this is set

app:spb_progressiveStart_activated="true"

is totally ignored. Setting this all programmatically seems fine.

from smoothprogressbar.

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.