manumaticx / circularprogress

Circular Progressbar Widget for Alloy
87 stars 19 forks source link

Dumb question.. how can I hide and show and update on upload ? #11

Closed DouglasHennrich closed 8 years ago

DouglasHennrich commented 9 years ago

Hi I want to hide my progress and show it when I'm uploading something... how can I do that?

I try $.progress.hide() but it's not a exposed method ):

Also I'm facing a little problem when onsendstream function to update the progress...

onsendstream:function(evt){
    Ti.API.info('ONSENDSTREAM - PROGRESS: ' + evt.progress.toFixed(3));

    if(Math.round(evt.progress * 100) <= 100) {
        $.progress.setValue(evt.progress.toFixed(3) * 100 );
    }
}

I'm getting the right progress but sometimes it get weird showing ALOT of numbers then it back to the right %( 10.3% ... 82.5% )

this is my formatValue -> $.progress.formatValue = function(val){ return (val) + '%'};

Thanks

manumaticx commented 9 years ago

Hey @DouglasHennrich

you could add the progress view to a container view that you hide and show (as a workaround) but I'll update the widget too as it should expose all Ti.UI.View properties and methods.

I use this code for updating the progress when uploading a file, maybe this works for you too:

xhr.onsendstream = function(e){
  $.progress.setValue(Math.floor(e.progress * 100));
};
DouglasHennrich commented 8 years ago

@manumaticx yea I add it to a another view to hide and show as you said and works fine xD

Android support e.progress on onsendstream ? I read it is not supported on android side =/

Thanks

manumaticx commented 8 years ago

@DouglasHennrich it works fine on android :)

DouglasHennrich commented 8 years ago

huuummmm Thank You very Much Mr.Manumaticx :DD

manumaticx commented 8 years ago

:v: :smile: