Search in sources :

Example 6 with PhotoDeserializer

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

the class AlbumPhotosAllRequest method handleResult.

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

Example 7 with PhotoDeserializer

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

the class AlbumPhotosRequest method handleResult.

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

Example 8 with PhotoDeserializer

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

the class UserProfilePhotoRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    PhotoDeserializer deserializer = new PhotoDeserializer();
    ArrayList<GraphObject> photos = (ArrayList<GraphObject>) deserializer.deserializeArray(result[0]);
    Log.d("UserProfileRequest", "photos " + photos.size());
    ProfilePicDeserializer ppDeserializer = new ProfilePicDeserializer();
    ArrayList<GraphObject> pictures = (ArrayList<GraphObject>) ppDeserializer.deserializeArray(result[1]);
    Log.d("UserProfileRequest", "pictures " + pictures.size());
    ArrayList<GraphObject> selectedPhoto = new ArrayList<GraphObject>();
    if (pictures.size() > 0) {
        ProfilePic pic = (ProfilePic) pictures.get(0);
        String url = pic.getUrl();
        url = url.substring(url.indexOf("_") + 1);
        url = url.substring(0, url.lastIndexOf("_"));
        for (GraphObject graphObject : photos) {
            Photo photo = (Photo) graphObject;
            for (Image image : photo.getImages()) {
                String imageUrl = image.getSource();
                imageUrl = imageUrl.substring(imageUrl.indexOf("_") + 1);
                imageUrl = imageUrl.substring(0, imageUrl.lastIndexOf("_"));
                Log.d("UserProfileRequest", url + " " + imageUrl);
                if (url.equals(imageUrl)) {
                    selectedPhoto.add(photo);
                    Log.d("UserProfileRequest", "id " + photo.getObject_id());
                    setHasMoreData(false);
                    return selectedPhoto;
                }
            }
        }
    }
    setHasMoreData(false);
    return selectedPhoto;
}
Also used : ArrayList(java.util.ArrayList) ProfilePicDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.ProfilePicDeserializer) ProfilePic(com.abewy.android.apps.klyph.core.fql.ProfilePic) PhotoDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer) Photo(com.abewy.android.apps.klyph.core.fql.Photo) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) Image(com.abewy.android.apps.klyph.core.fql.Photo.Image)

Example 9 with PhotoDeserializer

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

the class PhotoRequest method handleResult.

@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
    JSONArray photo = result[0];
    JSONArray profiles = result[1];
    JSONArray album = result[2];
    JSONArray pics = result[3];
    JSONArray places = result[4];
    assocData2(photo, profiles, "owner", "id", "owner_name", "name", "owner_type", "type");
    assocData2(photo, profiles, "owner", "id", "target_name", "name", "target_type", "type");
    assocData(photo, album, "album_object_id", "object_id", "album_name", "name");
    assocData(photo, pics, "owner", "id", "owner_pic", "url");
    assocData(photo, places, "place", "page_id", "place_name", "name");
    PhotoDeserializer deserializer = new PhotoDeserializer();
    ArrayList<GraphObject> list = (ArrayList<GraphObject>) deserializer.deserializeArray(photo);
    setHasMoreData(false);
    return list;
}
Also used : JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) PhotoDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Aggregations

PhotoDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer)9 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)9 ArrayList (java.util.ArrayList)9 Photo (com.abewy.android.apps.klyph.core.fql.Photo)2 Image (com.abewy.android.apps.klyph.core.fql.Photo.Image)2 JSONArray (org.json.JSONArray)2 Album (com.abewy.android.apps.klyph.core.fql.Album)1 Profile (com.abewy.android.apps.klyph.core.fql.Profile)1 ProfilePic (com.abewy.android.apps.klyph.core.fql.ProfilePic)1 User (com.abewy.android.apps.klyph.core.fql.User)1 AlbumDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.AlbumDeserializer)1 ProfileDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.ProfileDeserializer)1 ProfilePicDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.ProfilePicDeserializer)1 UserDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.UserDeserializer)1 JSONObject (org.json.JSONObject)1