/**
 * Indicator window with a spinner and a label
 *
 * @param {Object} args
 */
function createIndicatorWindow(args) {
    var width = Ti.UI.FILL,
        height = Ti.UI.FILL;

    var ActivityIndicatorStyle;
    
    var sdkVersion = parseFloat(Ti.version);
    if (sdkVersion >= 3.0){
        ActivityIndicatorStyle = Titanium.UI.ActivityIndicatorStyle;
    }

    var win = Titanium.UI.createWindow({
        height:           'auto',
        width:            'auto',
        top:              0,
        borderRadius:     0,
        touchEnabled:     false,
        backgroundColor:  '#000',
        opacity:          0.6//,
        //navBarHidden:     true

    });

    var view = Ti.UI.createView({
        width:   Ti.UI.SIZE,
        height:  Ti.UI.FILL,
        center:  { x: (width/2), y: (height/2) },
        layout:  'horizontal'
    });

    var activityIndicator = Ti.UI.createActivityIndicator({
        style:   ActivityIndicatorStyle.BIG,
        left:    0,
        height:  Ti.UI.FILL,
        width:   '60dp'
    });

    var label = Titanium.UI.createLabel({
        left:    '10dp',
        width:   Ti.UI.FILL,
        height:  Ti.UI.FILL,
        text:    'Loading ...',
        color:   '#fff',
        font:    { fontFamily: 'Helvetica Neue', fontSize: '32dp', fontWeight: 'bold' }
    });

    view.add(activityIndicator);
    view.add(label);
    win.add(view);

    function openIndicator() {
        win.open();
        activityIndicator.show();
    }

    win.openIndicator = openIndicator;

    function closeIndicator() {
        activityIndicator.hide();
        win.close();
    }

    win.closeIndicator = closeIndicator;

    return win;
}

// Public interface
exports.createIndicatorWindow = createIndicatorWindow