manumaticx / circularprogress

Circular Progressbar Widget for Alloy
87 stars 19 forks source link

Android implementation, the progress always fills 100% #6

Closed boarnoah closed 9 years ago

boarnoah commented 9 years ago

I tried following the sample use case scenario, it works on ios but always fills 100% on Android. Only difference from the sample code is my index.js looks like this:

$.progress.animate({
    value: 75,
    duration: 500
});

Ti.API.info("FINISHED SHOWING indicator");
$.index.open();

Also I didn't notice it animate live (maybe it just happened too fast, but possibly related issues?)

manumaticx commented 9 years ago

I've just tested this again but it works fine for me. Here is my test code (essential the same):


setTimeout(function(){

  $.progress.animate({
    value: 75,
    duration: 500
  });

}, 3000);

$.index.open();

The result: animate

boarnoah commented 9 years ago

@manumaticx thanks for the response. So I just tested with your code and it works great, taking out the timeout set seems to cause it to fail. Is this kind of a common thing with using something in Titanium immediately after creating a page? Seems like my code was failing since it was trying to set an animation as soon as the screen showed up.

EDIT: So it looks like if I try to do an animate on it without waiting say more than a 1000ms it fills the full circle. This looks like a titanium having trouble loading everything fast enough issue to me. Thanks for thinking about that timeout idea.

manumaticx commented 9 years ago

You are actually trying to do this before the screen shows up (calling $.progress.animate() before $.index.open()). But you are right - it's a bug, I've tested with your code again it seems there is a timing problem. I'll have a look.

manumaticx commented 9 years ago

Weird titanium bug. Don't ask! :wink:

It should work now without the timeout

boarnoah commented 9 years ago

Just looked at your commit it makes absolutely no sense but I'll take it. Thanks and good job!

rondog commented 9 years ago

a lot of titanium fixes I'll never understand

manumaticx commented 9 years ago

As I said... weird! It took me one hour to spot this. But it's a known issue which will be fixed in Ti 4.0