Skip to content

@kellymredd /app.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
remove windows
Ti.UI.setBackgroundColor('#252525');
var device = Ti.Platform.osname;
var ng = {};
// start data
(function() {
ng.data = {};
ng.data.device = Ti.Platform.osname;
ng.data.current_window = null;
ng.data.globalZ = 1;
ng.data.windowID = 0;
ng.data.window_stack = [];
ng.data.ipadmenu = [{
title : 'News'
}, {
title : 'Photos'
}, {
title : 'Videos'
}, {
title : 'Games'
}];
})();
// end data
// start functions
(function() {
ng.functions = {};
ng.functions.new_window = function(url, title, id) {
ng.data.globalZ++;
ng.data.current_window = Ti.UI.createWindow({
device : ng.data.device,
backgroundColor : '#888',
backgroundLeftCap : 1,
backgroundTopCap : 1,
top : 70,
height : 618,
left : 350,
width : 500, // 639
zIndex : ng.data.globalZ,
borderRadius : 10
});
// create wrapper so we can remove it AND whatever is in it.
ng.functions.wrapper = Ti.UI.createView({
top : 20,
left : 20,
bottom : 20,
right : 20
});
ng.data.current_window.add(ng.functions.wrapper);
// add new window to app
win.add(ng.data.current_window);
// push new window onto stack
var this_win_id = ng.data.windowID++;
ng.data.current_window.winID = this_win_id;
ng.data.window_stack.push(ng.data.current_window);
};
// make main menu on left
ng.functions.set_ipad_menu = function(device, menu) {
menu_array = [];
var len = menu.length;
for( m = 0; m < len; m++) {
var menu_item = Ti.UI.createTableViewRow({
backgroundColor : '#222',
height : 50,
width : 440,
left : 0,
top : 0,
url : menu[m].url,
id : m,
title : menu[m].title
});
menu_item.addEventListener('click', function(e) {
var id = e.rowData.id;
var url = e.rowData.url;
var title = e.rowData.ti;
// opening new top-level window so close everything and replace
for(var w in ng.data.window_stack){
if(ng.data.window_stack.length){
win.remove(ng.data.window_stack[w]);
}
}
// clean out array
ng.data.window_stack = [];
// open new window and reset vars
//ng.functions.new_window(url, title, id);
ng.data.windowID = 0;
ng.data.globalZ = 1;
});
menu_array.push(menu_item);
}
return menu_array;
};
})();
// end functions
// start ui
(function() {
ng.ui = {};
ng.ui.ipad = {};
// top level tabgroup for ipad
ng.ui.ipad.createRootTabgroup = function() {
var index = Ti.UI.createTabGroup();
win = Ti.UI.createWindow({
navBarHidden : true,
zIndex : 1
});
win.hideTabBar();
var tab = Titanium.UI.createTab({
window : win
});
index.addTab(tab);
// open first window onload
ng.functions.new_window('files/news/index.js', 'News', 0);
ng.ui.main_menu = Ti.UI.createTableView({
data : ng.data.ipadmenu,
backgroundColor : '#333',
left : 10,
top : 70,
width : 444,
height : 554,
borderRadius : 10,
separatorColor : 'transparent'
});
win.add(ng.ui.main_menu);
return index;
};
ng.ui.ipad.create_GENERIC_TableView = function(data, type) {
// var data = [];
tv = Ti.UI.createTableView({
backgroundColor : 'orange',
left : 0,
top : 0,
right : 0,
bottom : 0,
separatorColor : 'transparent'
});
for(var i = 0; i < data.length; i++) {
var row = Ti.UI.createTableViewRow({
backgroundColor : 'transparent',
selectedBackgroundColor : 'transparent',
top : 0,
left : 0,
right : 0,
height : 60,
title: data[i].title
});
data[i] = row;
}// end function
tv.setData(data);
return tv;
};
})();
// end ui
// app.js
win = ng.ui.ipad.createRootTabgroup();
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.