Search in sources :

Example 81 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class GroupMembersRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray data = result[0];
    JSONArray urls = result[1];
    assocData(data, urls, "uid", "id", "pic", "url");
    FriendDeserializer deserializer = new FriendDeserializer();
    ArrayList<GraphObject> friends = (ArrayList<GraphObject>) deserializer.deserializeArray(data);
    setHasMoreData(friends.size() >= 50);
    return friends;
}
Also used : JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) FriendDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.FriendDeserializer)

Example 82 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class GroupProfileRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray groupData = result[0];
    JSONObject page = groupData.optJSONObject(0);
    ArrayList<GraphObject> data = null;
    if (page != null) {
        GroupDeserializer deserializer = new GroupDeserializer();
        data = (ArrayList<GraphObject>) deserializer.deserializeArray(groupData);
    } else {
        data = new ArrayList<GraphObject>();
    }
    setHasMoreData(false);
    return data;
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) GroupDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.GroupDeserializer) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 83 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class ElementEventRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray data = result[0];
    JSONArray urls = result[1];
    assocData(data, urls, "eid", "id", "pic", "url");
    EventDeserializer deserializer = new EventDeserializer();
    ArrayList<GraphObject> events = (ArrayList<GraphObject>) deserializer.deserializeArray(data);
    setHasMoreData(events.size() >= 25);
    return events;
}
Also used : JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) EventDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.EventDeserializer) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 84 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class EventDeclinedRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray data = result[0];
    JSONArray urls = result[1];
    assocData(data, urls, "uid", "id", "pic", "url");
    FriendDeserializer deserializer = new FriendDeserializer();
    ArrayList<GraphObject> friends = (ArrayList<GraphObject>) deserializer.deserializeArray(data);
    setHasMoreData(friends.size() >= 50);
    return friends;
}
Also used : JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) FriendDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.FriendDeserializer)

Example 85 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class EventTimelineRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    ArrayList<GraphObject> streams = super.handleResult(result);
    if (result.length > 12) {
        if (result[12].length() > 0) {
            JSONArray eventData = result[12];
            JSONArray rsvp_status = result[13];
            EventDeserializer deserializer = new EventDeserializer();
            Event event = (Event) deserializer.deserializeArray(eventData).get(0);
            try {
                JSONObject o = rsvp_status.getJSONObject(0);
                event.setUserResponse(o.getString("rsvp_status"));
            } catch (JSONException e) {
                event.setUserResponse(EventResponse.NOT_REPLIED.toString());
            }
            streams.add(0, event);
        }
    }
    setHasMoreData(streams.size() > 0);
    return streams;
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Event(com.abewy.android.apps.klyph.core.fql.Event) JSONException(org.json.JSONException) EventDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.EventDeserializer) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Aggregations

GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)101 ArrayList (java.util.ArrayList)71 JSONArray (org.json.JSONArray)41 JSONObject (org.json.JSONObject)16 FriendDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.FriendDeserializer)11 PhotoDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer)9 MultiObjectAdapter (com.abewy.android.apps.klyph.adapter.MultiObjectAdapter)7 Stream (com.abewy.android.apps.klyph.core.fql.Stream)7 View (android.view.View)6 KlyphNotification (com.abewy.android.apps.klyph.KlyphNotification)6 Notification (com.abewy.android.apps.klyph.core.fql.Notification)6 Photo (com.abewy.android.apps.klyph.core.fql.Photo)6 JSONException (org.json.JSONException)6 StreamDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.StreamDeserializer)5 Intent (android.content.Intent)4 ListView (android.widget.ListView)4 Event (com.abewy.android.apps.klyph.core.fql.Event)4 AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)4 TextButtonItem (com.abewy.klyph.items.TextButtonItem)4 AbsListView (android.widget.AbsListView)3