Created
December 13, 2013 10:59
-
-
Save manumaticx/7942736 to your computer and use it in GitHub Desktop.
Basic Loading Indicator that I used in Titanium Classic Apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loading = require('loading'); | |
loading.start(); | |
setTimeout( function(){ loading.stop(); }, 2000 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Alloy projects nl.fokkezb.loading is my first choice
https://github.com/FokkeZB/nl.fokkezb.loading