Titanium 3.3.0.GA and Alloy 1.4.
I created a countdown alloy widget that seems to work on iOS but Android won't even load the sample app with it.
Basically, all this does is open another window and counts down then closes the window. This works on iOS but not Android. If I use a view it works on both iOS and Android but I really want a window because I want it full screen then to close when it's done. I'm assuming it has to do with the heavyweight lightweight thing but I'm not sure.
The source for the widget is available at https://github.com/kgividen/AlloyCountDownWidget
But here's what I'm doing. Any thoughts?
widget.xml
<Alloy> <Window id="win" navBarHidden="true"> <Label id="label"></Label> </Window> </Alloy>widget.js
function start(secCountDown, endTxt){ if(!secCountDown){ return; } $.win.open(); var i = 0; var intervalID = setInterval(function () { timer = secCountDown - i; if(timer < 0){ $.label.text = ""; $.win.close(); clearInterval(intervalID); } else if(timer == 0){ $.label.text = endTxt; } else { $.label.text = timer; } i++; }, 1000); } exports.start = start;widget.tss
"#win":{ fullscreen:'true', }, "#label":{ font: { fontWeight: 'bold', fontSize: 72 }, color:'#eee', shadowColor: 'black', shadowOffset: {x:1, y:1}, shadowRadius: 1 }The parent window is like this: index.xml
<Alloy> <Window id="win" class="container"> <Button id="openCountDown" onClick="openCountDown">Open CountDown</Button> <Require type="widget" src="com.netsmart.countdown" id="countdown"/> </Window> </Alloy>index.js
$.win.open(); function openCountDown(){ $.countdown.start(6,"Start!"); }