diff options
| author | Nikita Bernstein | 2012-06-24 01:21:14 -0400 | 
|---|---|---|
| committer | Nikita Bernstein | 2012-06-24 01:21:14 -0400 | 
| commit | 0e8de45a18994c14522f77156a5ac8fb3d2bdd99 (patch) | |
| tree | b50fdffaa2a32ea5fc9616a1fe7269741f0f4359 | |
| parent | 665d6d299e0ff4c9019475a53a08458dc22f729a (diff) | |
| download | LikeFeed-0e8de45a18994c14522f77156a5ac8fb3d2bdd99.tar.bz2 | |
Restoring
| -rw-r--r-- | Resources/friendship/ui/LikeList.js | 137 | 
1 files changed, 137 insertions, 0 deletions
| diff --git a/Resources/friendship/ui/LikeList.js b/Resources/friendship/ui/LikeList.js index e69de29..f373c4a 100644 --- a/Resources/friendship/ui/LikeList.js +++ b/Resources/friendship/ui/LikeList.js @@ -0,0 +1,137 @@ +(function() { +	function add_test_data(ll_view) +	{ +		ll_view.appendRow(  +			create_row( { +				pic_square: "images/fb_test_profile.jpg", +				name: "Test Name", +				description: "Description Description Description Description Description Description Description Description Description Description Description Description ", +				fan_count: "15",  +				page_url: "http://www.google.com", +				website: "http://www.google.com" +			} )  +		); +		 +		ll_view.appendRow(  +			create_row( { +				pic_square: "images/fb_test_profile.jpg", +				name: "Test Name", +				description: "Description Description Description Description Description Description Description Description Description Description Description Description ", +				fan_count: "2",  +				page_url: "http://www.google.com", +				website: "http://www.google.com" +			} )  +		);		 +	} +	 +	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 +			})); +		}); +		 +			/*		 +			fan_count +			page_url +			website +			*/ + +		var profile_icon = Ti.UI.createImageView({ +			image:key.pic_square, +			width:50, +			height:50, +			left:0, +			top:0 +		}); + +		var thumb_icon = Ti.UI.createImageView({ +			image:"images/thumbup.png", +			width:15, +			height:15, +			left:profile_icon.width + 2, +			top:2 +		}); +		 +		var fan_c = Ti.UI.createLabel({ +			text: key.fan_count, +			font:{fontSize:10,fontWeight:'bold'}, +			color:'#3b5997', +			//backgroundColor:'lightblue', +			width:'auto', +			textAlign:'center', +			top:2, +			left:thumb_icon.left + thumb_icon.width + 2, +			height:'auto' +		}); + +		if( fan_c.width < 10 ) fan_c.width = 10; + +		var title = Ti.UI.createLabel({ +			text:key.name, +			font:{fontSize:12,fontWeight:'bold'}, +			width:'auto', +			textAlign:'left', +			top:2, +			left:fan_c.left + fan_c.width + 2, +			height:'auto', +			wordWrap:'true' +		}); + +		var description = Ti.UI.createLabel({ +			text:key.description, +			font:{fontSize:12,fontWeight:'single'}, +			width:'auto', +			textAlign:'left', +			top: title.height, +			left:profile_icon.width + 2, +			height:36, +			wordWrap:'true', +			html:true +		}); +		 +		 + +		row.height = 50; +		 +		row.add( profile_icon ); +		row.add( thumb_icon ); +		row.add(fan_c); +		row.add( title ); +		row.add( description ); +		 +		return row; +	} +	 +	fs.ui.createLikeList = function() { +		var ll_view = Ti.UI.createTableView(); +		/* +		ll_view.addEventListener('click', function(e) { +			Ti.UI.currentTabGroup.activeTab.open(fs.ui.createWebViewWin({ +				title: e.title, +				url: e.url +			})); +		}); +		*/ + +		// add_test_data( ll_view ); +		 +		 +		Ti.API.addEventListener( "processPosts", function( list ) { +			if( list.list.length == 0 ) +				Ti.UI.createAlertDialog( {title:"Sorry, but the request returned 0 items."} ).show(); +			for ( key in list.list ) { +				ll_view.appendRow( create_row( list.list[key] ) ); +			} +		}); +		 +		return ll_view; +	}; + })(); | 
