aboutsummaryrefslogtreecommitdiffstats
path: root/Resources/friendship/ui/ApplicationWindow.js
blob: 8f4835bcf4a9222a3693ea076bf017458969afa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(function() {
	fs.ui.createApplicationTabGroup = function() {
		var tab_group = Ti.UI.createTabGroup();
		Ti.UI.currentTabGroup = tab_group;
		
//		var login_button = Ti.Facebook.createLoginButton();
		var refresh_button = Ti.UI.createButton({
			image: 'images/refresh.png',
			height: 5
		});
		refresh_button.addEventListener('click', fs.ui.refreshLikeList);
		
		var win = Ti.UI.createWindow({
			barColor: fs.ui.styles.navBarColour,
			title: 'Sphnx',
    		tabBarHidden: true,
    		leftNavButton: refresh_button
//    		rightNavButton: login_button
		});
		var loading = fs.ui.createLoadingView();
		win.add(loading);
		
		var tab = Titanium.UI.createTab({  
    		icon:'KS_nav_views.png',
    		title:'Likes',
    		window: win
		});
		
		win.add(fs.ui.createLikeList());

		Ti.API.addEventListener("processFQLError", function(e) {
			alert(e.what);
		});
		
		Ti.API.addEventListener("refreshAllData", function(e) {
			if (Ti.Facebook.loggedIn) {
				Ti.App.fireEvent('app:show.loader');
				fs.core.queryFriendIDsFQL();
			}
		})
		Ti.API.fireEvent("refreshAllData");
		
		tab_group.addTab(tab);
		
		return tab_group;
	};
})();