This is an progress view, to show some status of your application. You can set loading, success and error status.
With just three lines, you can show and hide you progress view from your application.
It's very simple to use this component. You have just to include the modules folder in your project and include the file progress.view.js in your Titanium project file.
See this example:
Ti.include("modules/progress.view.js");var progressView = new ProgressView();
progressView.show({ text:"Error message" });
setTimeout(function() { progressView.hide(); }, 2000);
If you are using an external window (url:...) you have not to set the window. The API will take the currentWindow to add the ProgressView. But, if you aren't using an external window you have to set the window when you instance a new ProgressView, like this example:
Ti.include("modules/progress.view.js");var win = Ti.UI.createWindow({ title: "Progress View" });
var progressView = new ProgressView({ window: win });
You can set a text to your progress view. The view will resize if needed. If you wanna change the text, you have just to use the method setTextLabel with the text.
If you wanna change the text or the image of your progress view, you have not to hide and show another progress view. For this, you have to use the method change with the properties you want, like you created.
I made two images in this project: success and error. To use them, you have to set the property with a BOOLEAN value. See the examples:
Ti.include("modules/progress.view.js");var progressView = new ProgressView();
progressView.show({ text:"Error message", error:true });
setTimeout(function() { progressView.change({ success:true }); }, 2000);
setTimeout(function() { progressView.hide(); }, 4000);
This project was based in the SVProgressHUD from @samvermette.
The images was made by @glyphish