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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
var win = Ti.UI.currentWindow;
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function() {
   var TokenResponse = this.responseText;
   var TokenArray = TokenResponse.split("=");
   var Token = TokenArray[1];
   if (Token !="")
   {
    getFeeds(Token);
   }    
 
};
 
xhr.open("GET","https://graph.facebook.com/oauth/access_token?client_id=XXXXXXXXXXX&client_secret=XXXXXXXXXXXXXXXXX&grant_type=client_credentials");
xhr.send();
 
     var table = Ti.UI.createTableView({
	       top: 0,
	       bottom: 0,
	        backgroundColor: 'transparent',
	        separatorColor:'transparent',
	    });
	    
	    function getFeeds(Token)
{

	var tableData = [];
var json, data, name, picture, description;

    Ti.Facebook.requestWithGraphPath(Titanium.App.Properties.getString("pageID") +'/feed', {access_token: Token}, 'GET', function(e){
        if (e.success) {
           
            json = JSON.parse(e.result);
	for (i = 0; i < json.data.length; i++) {
	    data = json.data[i];
	    row = Ti.UI.createTableViewRow({
	        height:'80dp',
	         // backgroundImage	: 'images/tablebgl.png',
	        backgroundColor: 'transparent',
	        separatorColor:'transparent',
	    });
	    
	  var  name = Ti.UI.createLabel({
	        text: data.from.name,
	        font:{
	            fontSize:'17dp',
		    fontWeight:'bold'
		},
		height:'20dp',
		left:'90dp',
		top:'9dp',
		color:'#eee',
		touchEnabled:true
	    });
	    row.add(name);
	   
	    var  message = Ti.UI.createLabel({
	        text: data.message,
	        font:{
	            fontSize:'13dp'
		},
		height:'30dp',
		left:'90dp',
		top:'33dp',
		color:'#eee',
		shadowColor: '#111',
		shadowOffset:{x:0,y:1},
		touchEnabled:true
	    });
	    row.add(message);
	    
row.coverid = data.from.id;	    
	    
var coverid = row.coverid;	
   
	   Titanium.App.Properties.setString("cv", coverid);
    
        var imag = Ti.UI.createImageView();
    row.add(imag);
     require('image').signUpConn(data, function(scrollView){ 
    imag.setImage(scrollView);
});
    

      
    

	    
	    
	     // Avatar
				var img = Ti.UI.createImageView({
					image	: 'https://graph.facebook.com/'+ data.from.id +'/picture?type=square',
					width	: '70dp',
					height	: '70dp',
					top		: '5dp',
					
					borderRadius : 5,
					borderColor : 'transparent',
					left	: '10dp'
				});
				row.add(img);

			
		
		row.message = data.message;
        row.name = data.from.name;
	    row.id = data.id;
	    row.pic = data.picture;
	    row.link = data.link;
	    tableData.push(row);
        }

	
            table.setData(tableData);
	
	 
	 } else {
            if (e.error) {
                
            } else {
                alert("Something else just happend...");
            }
        }
    });
 
}
            win.add(table);