Titanium Widget to display a loader mask.
Proudly inspired to https://github.com/FokkeZB/nl.fokkezb.loading, with some edits for Android (using ProgressIndicator instead Ti.UI.Window)
gittio install com.caffeinalab.titanium.loader
Download the latest release, and add in your config.json, under dependencies
:
"dependencies": {
"com.caffeinalab.titanium.loader": "*"
}
The outer mask (Window)
The mask containing the loader
The label containing the text
Watch the window.tss/window.xml
file for all options and override the rules with ID instead of class.
// Create a global reference to the widget
var LO = Alloy.createWidget('com.caffeinalab.titanium.loader', {
message: "Test",
cancelable: true,
useImages: false
});
// show the loader
// Equivalent to { message: 'Loading...', messageRelevance: 1 }
LO.show('Loading...');
// ... or Pass an object
LO.show({
message: 'Wait..',
messageRelevance: 3,
cancelable: true
});
// ... and optionally a complete callback
LO.show(null, function() {
alert('Ya Man!');
});
// hide the loader
LO.hide();
The message to display
Continuous updates to the message will respect the messageRelevance
property.
If is a Function
, this will be called on cancel.
Set to explicit false
to prohibit user cancelation of the mask.
Function to call before the window appear, so you can edit UI.
e.ui
will be current UI element, so be careful to switch between OSes.
Use a custom view instead of default loader / image
Show the mask extending the constructor options
with the arguments.
This is equivalent to show({ message: [message] })
Update the previous passed options and the UI.
Closes the mask.