aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnqi Xu2012-06-24 05:31:28 -0400
committerAnqi Xu2012-06-24 05:31:28 -0400
commit7f28bc955883e3847eae5ddaeac87445567660b3 (patch)
treeb8a9ac51be5a7dd4bafcbc22e34529352a50e4ab
parentcd67bf9b30d6d787695ac4dc9d85b3289819527a (diff)
parent8d7e851d37aef8599403670e3eaabb5745c2c567 (diff)
downloadLikeFeed-7f28bc955883e3847eae5ddaeac87445567660b3.tar.bz2
Merge branch 'master' of github.com:teddywing/LikeFeed
-rw-r--r--Resources/friendship/ui/LikeList.js65
1 files changed, 48 insertions, 17 deletions
diff --git a/Resources/friendship/ui/LikeList.js b/Resources/friendship/ui/LikeList.js
index 0e9e784..dfc01c1 100644
--- a/Resources/friendship/ui/LikeList.js
+++ b/Resources/friendship/ui/LikeList.js
@@ -1,4 +1,20 @@
(function() {
+ var MAX_ROW_HEIGHT = 150;
+ var lookup = {
+ 'BOOK':'#b0d3a4',
+ 'SHOW':'#c7b0b5',
+ 'MUSICIAN/BAND':'#c7bbb0',
+ 'MOVIE':'#ccc399',
+ 'TV SHOW':'#5c9aa7'
+ };
+
+ function getTypeColor(type_str)
+ {
+ var r = lookup[type_str];
+ if( r ) return r;
+ return '#bbbbbb';
+ }
+
function addCommas(nStr)
{
nStr += '';
@@ -18,7 +34,7 @@
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 ",
+ description: "Description Description Description. Description Description Description Description Description Description Description Description Description ",
fan_count: "1000000000000000",
page_url: "http://www.google.com",
website: "http://www.google.com",
@@ -97,25 +113,13 @@
text: " " + key.type + " ",
font:{fontSize:11,fontWeight:'single'},
color:'white',
- backgroundColor: '#b0d3a4',
+ backgroundColor: getTypeColor( key.type ),
width:'auto',
textAlign:'left',
top:2,
left: profile_icon.width + 2,
height:'auto'
});
-
- var liked_by = Ti.UI.createLabel({
- text: " Friend Bob ",
- font:{fontSize:11,fontWeight:'bold'},
- color: 'white',
- backgroundColor:"#d1d5e0",
- width:'auto',
- textAlign:'left',
- top:2,
- left: item_type.left + item_type.width + 2,
- height:'auto'
- });
var title = Ti.UI.createLabel({
text:key.name,
@@ -128,21 +132,46 @@
wordWrap:'true'
});
+ var liked_by = Ti.UI.createLabel({
+ text: " Friend Bob ",
+ font:{fontSize:11,fontWeight:'single'},
+
+ //color: 'white',
+ //backgroundColor:"#d1d5e0",
+
+ color: '#aaaaaa',
+
+ width:'auto',
+ textAlign:'left',
+ top:2,
+ height:'auto'
+ });
+
+ liked_by.left = 320 - liked_by.width;
key.description = key.description.replace(/<(?:.|\n)*?>/gm, '');
+ if( key.description.indexOf('.') > 0 ){
+ key.description = key.description.substr( 0, key.description.indexOf('.') + 1 ) ;
+ }
var description = Ti.UI.createLabel({
text:key.description,
font:{fontSize:12,fontWeight:'single'},
width:'auto',
textAlign:'left',
- top: title.top + title.height-5,
- left:profile_icon.width + 4
+ top: title.top + title.height,
+ left:profile_icon.width + 4,
+ height:'auto',
+ wordWrap:true
});
+ var max_height = MAX_ROW_HEIGHT - description.top;
+
+ if( description.height > max_height ) description.height = max_height;
+
- row.height = 50;
+ row.height = 'auto';
row.add( profile_icon );
// row.add( thumb_icon );
@@ -151,6 +180,7 @@
row.add(liked_by);
row.add( item_type );
row.add( description );
+
return row;
};
@@ -161,6 +191,7 @@
fs.ui.createLikeList = function() {
var ll_view = Ti.UI.createTableView();
+ ll_view.maxRowHeight = MAX_ROW_HEIGHT;
var loading = fs.ui.createLoadingView();
ll_view.add(loading);