Search in sources :

Example 1 with EventDeserializer

use of com.abewy.android.apps.klyph.core.fql.serializer.EventDeserializer in project Klyph by jonathangerbaud.

the class EventRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray eventData = result[0];
    JSONArray rsvp_status = result[1];
    ArrayList<GraphObject> data = new ArrayList<GraphObject>();
    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());
    }
    data.add(event);
    setHasMoreData(false);
    return data;
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) 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)

Example 2 with EventDeserializer

use of com.abewy.android.apps.klyph.core.fql.serializer.EventDeserializer 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 3 with EventDeserializer

use of com.abewy.android.apps.klyph.core.fql.serializer.EventDeserializer 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

EventDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.EventDeserializer)3 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)3 JSONArray (org.json.JSONArray)3 Event (com.abewy.android.apps.klyph.core.fql.Event)2 ArrayList (java.util.ArrayList)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2