aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--Resources/friendship/ui/ApplicationWindow.js3
-rw-r--r--Resources/friendship/ui/FriendSelector.js36
-rw-r--r--Resources/friendship/ui/LikeList.js26
-rw-r--r--Resources/friendship/ui/LoginWindow.js14
-rw-r--r--manifest16
-rw-r--r--tiapp.xml2
7 files changed, 68 insertions, 31 deletions
diff --git a/README b/README
index f5187aa..5b1869b 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-FriendShip --> Renamed to Sphnx
+Sphnx
==========
# Development Setup
diff --git a/Resources/friendship/ui/ApplicationWindow.js b/Resources/friendship/ui/ApplicationWindow.js
index b2c174e..067969a 100644
--- a/Resources/friendship/ui/ApplicationWindow.js
+++ b/Resources/friendship/ui/ApplicationWindow.js
@@ -8,7 +8,7 @@
image: 'images/refresh.png',
height: 5
});
- refresh_button.addEventListener('click', fs.ui.refreshLikeList);
+ refresh_button.addEventListener('click', fs.ui.refreshAllFriendsLikeList);
var friend_selector_button = fs.ui.friendSelectorButton();
@@ -17,7 +17,6 @@
title: 'Sphnx',
tabBarHidden: true,
leftNavButton: refresh_button,
-// rightNavButton: login_button
rightNavButton: friend_selector_button
});
var loading = fs.ui.createLoadingView();
diff --git a/Resources/friendship/ui/FriendSelector.js b/Resources/friendship/ui/FriendSelector.js
index ff0d714..c225d87 100644
--- a/Resources/friendship/ui/FriendSelector.js
+++ b/Resources/friendship/ui/FriendSelector.js
@@ -25,34 +25,54 @@
});
done_button.addEventListener('click', function() {
- // Refresh the like list
-
+ var friend_ids = Array();
+ for (key in fs.data.friends) {
+ if (fs.data.friends[key].selected) {
+ friend_ids.push(fs.data.friends[key].uid);
+ }
+ }
+ if (friend_ids.length > 0) {
+ fs.ui.refreshLikeList(friend_ids);
+ }
+
win.close();
});
friend_table = Ti.UI.createTableView();
- // Sort friends list alphabetically
- //
+ var friends = [];
+
+ for (var key in fs.data.friends) {
+ friends.push(fs.data.friends[key]);
+ }
+ friends.sort(function(a, b) {
+ a = a.name;
+ b = b.name;
+ return a > b ? 1 : (a < b ? -1 : 0);
+ });
- for (var i = 0; i < fs.data.friends.length; i++) {
+ for (var i = 0; i < friends.length; i++) {
var row = Ti.UI.createTableViewRow({
selectionStyle: 'none'
});
var name = Ti.UI.createLabel({
- text: fs.data.friends[i].name,
+ text: friends[i].name,
font: {fontSize: 16, fontWeight: 'bold'},
left: 45
});
var avatar = Ti.UI.createImageView({
- image: fs.data.friends[i].pic_square,
+ image: friends[i].pic,
height: 35,
width: 35,
left: 5
});
var switch_button = Ti.UI.createSwitch({
right: 5,
- value: false
+ value: fs.data.friends[friends[i].uid.toString()].selected,
+ SP_uidString: friends[i].uid.toString(),
+ });
+ switch_button.addEventListener("change", function(e) {
+ fs.data.friends[this.SP_uidString].selected = e.value;
});
row.add(avatar);
diff --git a/Resources/friendship/ui/LikeList.js b/Resources/friendship/ui/LikeList.js
index be81747..f46ba55 100644
--- a/Resources/friendship/ui/LikeList.js
+++ b/Resources/friendship/ui/LikeList.js
@@ -123,7 +123,7 @@
top:item_type.height + 2,
left: profile_icon.width + 14,
height:'auto',
- wordWrap:'true'
+ wordWrap:false
});
var liked_by = Ti.UI.createLabel({
@@ -189,11 +189,8 @@
function friend_name_from_uid(uid) {
var result = "???";
- for (var i = 0; i < fs.data.friends.length; i++) {
- if (fs.data.friends[i].uid == uid) {
- result = fs.data.friends[i].name;
- break;
- }
+ if (uid.toString() in fs.data.friends) {
+ result = fs.data.friends[uid.toString()].name;
}
return result;
};
@@ -210,7 +207,11 @@
//Ti.App.fireEvent('app:show.loader');
Ti.API.addEventListener("processFriendIDs", function(e) {
- fs.data.friends = e.data;
+ fs.data.friends = Array();
+ for (var i = 0; i < e.data.length; i++) {
+ fs.data.friends[e.data[i].uid.toString()] = {uid: e.data[i].uid, pic: e.data[i].pic_square, name: e.data[i].name, selected: true};
+ }
+
fs.core.queryAllFriendLikeIDsFQL();
});
@@ -296,10 +297,17 @@
return ll_view;
};
- fs.ui.refreshLikeList = function(e) {
+ fs.ui.refreshAllFriendsLikeList = function(e) {
+ if (Ti.Facebook.loggedIn) {
+ Ti.App.fireEvent('app:show.loader');
+ fs.core.queryFriendIDsFQL();
+ }
+ };
+
+ fs.ui.refreshLikeList = function(friend_ids) {
if (Ti.Facebook.loggedIn) {
Ti.App.fireEvent('app:show.loader');
- fs.core.queryAllFriendLikeIDsFQL(); // TODO: switch to friend_ids version of query
+ fs.core.queryLikeIDsFQL(friend_ids);
}
};
})();
diff --git a/Resources/friendship/ui/LoginWindow.js b/Resources/friendship/ui/LoginWindow.js
index f2bd735..4a48c64 100644
--- a/Resources/friendship/ui/LoginWindow.js
+++ b/Resources/friendship/ui/LoginWindow.js
@@ -17,7 +17,7 @@
// add the button. Note that it doesn't need a click event or anything.
return Ti.Facebook.createLoginButton({
- top: 50,
+ top: 300,
style: 'wide'
});
};
@@ -29,8 +29,17 @@
tabBarHidden: true,
backgroundColor: fs.ui.styles.navBarColour
});
+
+ var icon = Ti.UI.createImageView({
+ image:"images/SphnxLogo300.png",
+ width:225,
+ height:225,
+ left: 'auto',
+ top: 38
+ });
+
var view = Ti.UI.createView({
- backgroundColor: '#fff'
+ backgroundColor: fs.ui.styles.navBarColour
});
var tab = Ti.UI.createTab({
@@ -39,6 +48,7 @@
tab_group.addTab(tab);
view.add(createFBLoginButton());
+ view.add(icon);
win.add(view);
return tab_group;
diff --git a/manifest b/manifest
index 009061f..66d105f 100644
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
-#appname: LikeFeed
-#publisher: TW
-#url: http://
-#image: appicon.png
-#appid: com.likefeed.LikeFeed
-#desc: undefined
-#type: ipad
-#guid: ccd110bb-8710-4380-ad4a-94d93e18d62a
+#appname:LikeFeed
+#publisher:TW
+#url:http://
+#image:appicon.png
+#appid:com.sphnx.Sphnx
+#desc:not specified
+#type:ipad
+#guid:ccd110bb-8710-4380-ad4a-94d93e18d62a
diff --git a/tiapp.xml b/tiapp.xml
index 9cc4a2f..676f141 100644
--- a/tiapp.xml
+++ b/tiapp.xml
@@ -7,7 +7,7 @@
<target device="android">false</target>
<target device="blackberry">false</target>
</deployment-targets>
- <sdk-version>1.6.2</sdk-version>
+ <sdk-version>1.8.3.v20120529164726</sdk-version>
<id>com.likefeed.LikeFeed</id>
<name>LikeFeed</name>
<version>1.0</version>