use of com.abewy.android.apps.klyph.core.fql.serializer.FriendRequestDeserializer in project Klyph by jonathangerbaud.
the class FriendsRequestNotificationRequest method handleResult.
@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
JSONArray data = result[0];
JSONArray urls = result[1];
JSONArray names = result[2];
for (int i = 0; i < urls.length(); i++) {
JSONObject jsonObject = urls.optJSONObject(i);
try {
jsonObject.putOpt("id", String.valueOf(jsonObject.opt("id")));
} catch (JSONException e) {
// e.printStackTrace();
}
}
for (int i = 0; i < names.length(); i++) {
JSONObject jsonObject = names.optJSONObject(i);
try {
jsonObject.putOpt("id", String.valueOf(jsonObject.opt("id")));
} catch (JSONException e) {
// e.printStackTrace();
}
}
assocData(data, urls, "uid_from", "id", "uid_from_pic", "url");
assocData(data, names, "uid_from", "id", "uid_from_name", "name");
FriendRequestDeserializer deserializer = new FriendRequestDeserializer();
ArrayList<GraphObject> friendRequests = (ArrayList<GraphObject>) deserializer.deserializeArray(data);
return friendRequests;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.FriendRequestDeserializer in project Klyph by jonathangerbaud.
the class UserProfileRequest method handleResult.
@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
JSONArray userData = result[0];
JSONArray familyData = result[1];
JSONArray urls = result[2];
JSONArray isFriend = result[3];
JSONArray friendRequest = result[4];
assocData(userData, urls, "uid", "id", "pic", "url");
JSONObject user = userData.optJSONObject(0);
ArrayList<GraphObject> data = null;
if (user != null) {
try {
user.put("family", familyData);
} catch (JSONException e) {
}
if (isFriend != null && isFriend.length() == 1) {
try {
user.putOpt("isFriend", true);
} catch (JSONException e) {
e.printStackTrace();
}
}
UserDeserializer deserializer = new UserDeserializer();
data = (ArrayList<GraphObject>) deserializer.deserializeArray(userData);
FriendRequestDeserializer frDeserializer = new FriendRequestDeserializer();
List<GraphObject> fr = frDeserializer.deserializeArray(friendRequest);
if (fr.size() > 0) {
data.add(fr.get(0));
}
} else {
data = new ArrayList<GraphObject>();
}
setHasMoreData(false);
return data;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.FriendRequestDeserializer in project Klyph by jonathangerbaud.
the class NotificationRequest method handleResult.
@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
JSONArray notifications = result[0];
JSONArray friendRequests = result[1];
JSONArray urls = result[2];
JSONArray names = result[3];
JSONArray groups = result[4];
assocData(notifications, urls, "sender_id", "id", "sender_pic", "url");
assocData(notifications, names, "sender_id", "id", "sender_name", "name");
assocStreamToObjectById(notifications, groups, "object_id", "gid", "group");
for (int i = 0; i < urls.length(); i++) {
JSONObject jsonObject = urls.optJSONObject(i);
try {
jsonObject.putOpt("id", String.valueOf(jsonObject.opt("id")));
} catch (JSONException e) {
// e.printStackTrace();
}
}
for (int i = 0; i < names.length(); i++) {
JSONObject jsonObject = names.optJSONObject(i);
try {
jsonObject.putOpt("id", String.valueOf(jsonObject.opt("id")));
} catch (JSONException e) {
// e.printStackTrace();
}
}
assocData(notifications, names, "object_id", "id", "object_name", "name");
assocData(friendRequests, urls, "uid_from", "id", "uid_from_pic", "url");
assocData(friendRequests, names, "uid_from", "id", "uid_from_name", "name");
NotificationDeserializer nDeserializer = new NotificationDeserializer();
ArrayList<GraphObject> n = (ArrayList<GraphObject>) nDeserializer.deserializeArray(notifications);
FriendRequestDeserializer fDeserializer = new FriendRequestDeserializer();
ArrayList<GraphObject> f = (ArrayList<GraphObject>) fDeserializer.deserializeArray(friendRequests);
ArrayList<GraphObject> list = new ArrayList<GraphObject>();
list.addAll(n);
list.addAll(f);
setHasMoreData(false);
return list;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.FriendRequestDeserializer in project Klyph by jonathangerbaud.
the class NotificationRequest2 method handleResult.
@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
JSONArray notifications = result[0];
JSONArray friendRequests = result[1];
JSONArray urls = result[2];
JSONArray names = result[3];
JSONArray friends = result[4];
JSONArray events = result[5];
JSONArray pages = result[6];
JSONArray groups = result[7];
JSONArray comments = result[8];
assocData(notifications, urls, "sender_id", "id", "sender_pic", "url");
assocData(notifications, names, "sender_id", "id", "sender_name", "name");
assocStreamToObjectById(notifications, friends, "object_id", "uid", "friend");
assocStreamToObjectById(notifications, events, "object_id", "eid", "event");
assocStreamToObjectById(notifications, pages, "object_id", "page_id", "page");
assocStreamToObjectById(notifications, groups, "object_id", "gid", "group");
assocStreamToObjectById(notifications, comments, "object_id", "object_id", "comment");
for (int i = 0; i < urls.length(); i++) {
JSONObject jsonObject = urls.optJSONObject(i);
try {
jsonObject.putOpt("id", String.valueOf(jsonObject.opt("id")));
} catch (JSONException e) {
// e.printStackTrace();
}
}
for (int i = 0; i < names.length(); i++) {
JSONObject jsonObject = names.optJSONObject(i);
try {
jsonObject.putOpt("id", String.valueOf(jsonObject.opt("id")));
} catch (JSONException e) {
// e.printStackTrace();
}
}
assocData(friendRequests, urls, "uid_from", "id", "uid_from_pic", "url");
assocData(friendRequests, names, "uid_from", "id", "uid_from_name", "name");
NotificationDeserializer nDeserializer = new NotificationDeserializer();
ArrayList<GraphObject> n = (ArrayList<GraphObject>) nDeserializer.deserializeArray(notifications);
FriendRequestDeserializer fDeserializer = new FriendRequestDeserializer();
ArrayList<GraphObject> f = (ArrayList<GraphObject>) fDeserializer.deserializeArray(friendRequests);
ArrayList<GraphObject> list = new ArrayList<GraphObject>();
list.addAll(n);
list.addAll(f);
setHasMoreData(false);
return list;
}
Aggregations