Skip to content

Instantly share code, notes, and snippets.

@manumaticx
Created December 13, 2013 10:59
Show Gist options
  • Save manumaticx/7942736 to your computer and use it in GitHub Desktop.
Save manumaticx/7942736 to your computer and use it in GitHub Desktop.
Basic Loading Indicator that I used in Titanium Classic Apps
var loading = require('loading');
loading.start();
setTimeout( function(){ loading.stop(); }, 2000 );
module.exports = (function(){
var loadWin = Ti.UI.createWindow({
backgroundColor: 'black',
opacity: 0.7,
height: '20%',
width: '60%',
borderRadius:10
});
var actInd = Titanium.UI.createActivityIndicator({
message:"Loading...",
height:50,
width:'auto',
color:'#fff'
});
if (Ti.Platform.name === 'iPhone OS'){
actInd.style = Ti.UI.iPhone.ActivityIndicatorStyle.PLAIN;
}else{
actInd.style = Ti.UI.ActivityIndicatorStyle.PLAIN;
}
loadWin.add(actInd);
var start = function(_message){
actInd.message = ('string' == typeof _message) ? _message : "Loading...";
actInd.show();
loadWin.open();
};
var stop = function(){
loadWin.close();
actInd.hide();
};
return {
start: start,
stop: stop
};
})();
@manumaticx
Copy link
Author

For Alloy projects nl.fokkezb.loading is my first choice

https://github.com/FokkeZB/nl.fokkezb.loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment