Search in sources :

Example 31 with GraphObject

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

the class ProfileUrlRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray result) {
    ItemDeserializer deserializer = new ItemDeserializer();
    ArrayList<GraphObject> items = (ArrayList<GraphObject>) deserializer.deserializeArray(result);
    return items;
}
Also used : ItemDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.ItemDeserializer) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 32 with GraphObject

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

the class SearchGroupRequest method handleResult.

@Override
public List<GraphObject> handleResult(JSONArray result) {
    List<GraphObject> list = new ArrayList<GraphObject>();
    int n = result.length();
    for (int i = 0; i < n; i++) {
        Group group = new Group();
        JSONObject json = result.optJSONObject(i);
        group.setGid(json.optString("id"));
        group.setName(json.optString("name"));
        group.setDescription(json.optString("description"));
        list.add(group);
    }
    setHasMoreData(false);
    return list;
}
Also used : Group(com.abewy.android.apps.klyph.core.fql.Group) JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 33 with GraphObject

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

the class StatusRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray status = result[0];
    JSONArray profiles = result[1];
    JSONArray pics = result[2];
    JSONArray places = result[3];
    assocData2(status, profiles, "uid", "id", "uid_name", "name", "uid_type", "type");
    assocData(status, pics, "uid", "id", "uid_pic", "url");
    assocData(status, places, "place_id", "page_id", "place_name", "name");
    StatusDeserializer sDeserializer = new StatusDeserializer();
    ArrayList<GraphObject> statut = (ArrayList<GraphObject>) sDeserializer.deserializeArray(status);
    setHasMoreData(false);
    return statut;
}
Also used : StatusDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.StatusDeserializer) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 34 with GraphObject

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

the class SearchPageRequest method handleResult.

@Override
public List<GraphObject> handleResult(JSONArray result) {
    List<GraphObject> list = new ArrayList<GraphObject>();
    int n = result.length();
    for (int i = 0; i < n; i++) {
        Page page = new Page();
        JSONObject json = result.optJSONObject(i);
        page.setPage_id(json.optString("id"));
        page.setName(json.optString("name"));
        page.setType(json.optString("category"));
        JSONObject pic = json.optJSONObject("picture");
        JSONObject data = pic.optJSONObject("data");
        page.setPic(data.optString("url"));
        list.add(page);
    }
    setHasMoreData(false);
    return list;
}
Also used : JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) Page(com.abewy.android.apps.klyph.core.fql.Page) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 35 with GraphObject

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

the class Notifications method onActivityCreated.

/*
	 * @Override
	 * protected KlyphPullToRefreshListView onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState)
	 * {
	 * return (KlyphPullToRefreshListView) inflater.inflate(R.layout.list_notifications, null);
	 * }
	 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    NotificationSwipeDismissAdapter swAdapter = new NotificationSwipeDismissAdapter(new MultiObjectAdapter(getListView()), new OnDismissCallback() {

        @Override
        public void onDismiss(AbsListView arg0, int[] positions) {
            for (int i : positions) {
                if (getAdapter().getItem(i) instanceof Notification) {
                    Notification notification = (Notification) getAdapter().getItem(i);
                    setNotificationRead(notification);
                }
            }
            List<GraphObject> list = new ArrayList<GraphObject>();
            for (GraphObject o : getAdapter().getItems()) {
                if (!(o instanceof Header)) {
                    list.add(o);
                }
            }
            populate(list);
        }
    });
    swAdapter.setAbsListView(getListView());
    setListAdapter(swAdapter);
    // setListAdapter(new MultiObjectAdapter(getListView()));
    defineEmptyText(R.string.empty_list_no_notification);
    setListVisible(false);
    setRequestType(Query.NOTIFICATIONS);
    loggedIn = true;
    new Handler().postDelayed(new Runnable() {

        public void run() {
            loadNotifications();
        }
    }, 2000);
}
Also used : MultiObjectAdapter(com.abewy.android.apps.klyph.adapter.MultiObjectAdapter) OnDismissCallback(com.haarman.listviewanimations.itemmanipulation.OnDismissCallback) AbsListView(android.widget.AbsListView) Handler(android.os.Handler) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) Notification(com.abewy.android.apps.klyph.core.fql.Notification) KlyphNotification(com.abewy.android.apps.klyph.KlyphNotification) Header(com.abewy.klyph.items.Header) ArrayList(java.util.ArrayList) List(java.util.List)

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