aboutsummaryrefslogtreecommitdiffstats
path: root/Resources/friendship/ui/LikeList.js
blob: 9d334fca6d033e1b98f24a6d66451fbdf921e2e1 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(function() {
	function create_row( key )
	{
		// Ti.UI.createAlertDialog( {title:"key " + key.name} ).show();

		// Reason for Factory: templating format of the row
		var row = Ti.UI.createTableViewRow();

		row.addEventListener('click', function(e) {
			Ti.UI.currentTabGroup.activeTab.open(fs.ui.createWebViewWin({
				title: key.name,
				url: key.page_url
			}));
		});
		
			/*		
			description
			fan_count
			page_url
			website
			*/

		var profile_icon = Ti.UI.createImageView({
			image:key.pic_square,
			width:50,
			height:50,
			left:0,
			top:0
		});

		var content = Ti.UI.createLabel({
			text:key.name,
			font:{fontSize:12,fontWeight:'bold'},
			width:'auto',
			textAlign:'left',
			top:2,
			left:52,
			height:26
		});

		row.height = 50;
		
		row.add( profile_icon );
		row.add( content );
		
		return row;
	}
	
	fs.ui.createLikeList = function() {
		var ll_view = Ti.UI.createTableView();
		
		var loading = fs.ui.createLoadingView();
		ll_view.add(loading);
		
		// Ti.App.fireEvent('app:show.loader');
		
		Ti.API.addEventListener("processPosts", function(d) {
			for ( key in d.data ) {
				ll_view.appendRow( create_row( d.data[key] ) );
			}
			
			Ti.App.fireEvent('app:hide.loader');
		});
				
		return ll_view;
	};
	
	fs.ui.refreshLikeList = function(e) {
		if (Ti.Facebook.loggedIn) {
			Ti.App.fireEvent('app:show.loader');
			fs.core.queryAllFriendPostsFQL();
		} else {
			Ti.Facebook.fireEvent('login');
		}
	};
})();