use of com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer in project Klyph by jonathangerbaud.
the class AlbumTaggedPhotosRequest 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;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer in project Klyph by jonathangerbaud.
the class ElementAlbumRequest method handleResult.
@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
JSONArray data = result[0];
JSONArray photos = result[1];
assocData(data, photos, "cover_pid", "pid", "cover_images", "images");
int n = 25;
Album taggedAlbum = null;
Album videoAlbum = null;
if (result.length == 6) {
JSONArray tagged = result[2];
JSONArray user = result[3];
JSONArray profile = result[4];
PhotoDeserializer pd = new PhotoDeserializer();
List<GraphObject> taggedPhotos = pd.deserializeArray(tagged);
int nt = taggedPhotos.size();
if (nt > 0) {
taggedAlbum = new Album();
taggedAlbum.setOwner(id);
taggedAlbum.setPhoto_count(nt);
taggedAlbum.setVideo_count(0);
taggedAlbum.setIsTaggedAlbum(true);
taggedAlbum.setIs_video_album(false);
String eName = "";
if (user.length() > 0) {
UserDeserializer ud = new UserDeserializer();
User u = (User) ud.deserializeArray(user).get(0);
eName = u.getFirst_name().length() > 0 ? u.getFirst_name() : u.getName();
} else if (profile.length() > 0) {
ProfileDeserializer prd = new ProfileDeserializer();
Profile p = (Profile) prd.deserializeArray(profile).get(0);
eName = p.getName();
}
taggedAlbum.setName(KlyphApplication.getInstance().getString(R.string.tagged_photos_of, eName));
Photo photo = (Photo) taggedPhotos.get(0);
taggedAlbum.setCover_pid(photo.getPid());
taggedAlbum.setCover_images(photo.getImages());
}
JSONArray videos = result[5];
if (videos.length() > 0) {
videoAlbum = new Album();
videoAlbum.setOwner(id);
videoAlbum.setPhoto_count(nt);
videoAlbum.setVideo_count(0);
videoAlbum.setIsTaggedAlbum(false);
videoAlbum.setIs_video_album(true);
for (int i = 0; i < videos.length(); i++) {
JSONObject v = videos.optJSONObject(i);
if (v != null && v.optString("thumbnail_link") != null) {
Image cover = new Photo.Image();
cover.setSource(v.optString("thumbnail_link"));
List<Image> images = new ArrayList<Photo.Image>();
images.add(cover);
videoAlbum.setOwner(v.optString("owner"));
videoAlbum.setCover_images(images);
break;
}
}
}
}
AlbumDeserializer deserializer = new AlbumDeserializer();
ArrayList<GraphObject> albums = (ArrayList<GraphObject>) deserializer.deserializeArray(data);
if (videoAlbum != null)
albums.add(0, videoAlbum);
if (taggedAlbum != null)
albums.add(0, taggedAlbum);
setHasMoreData(albums.size() >= n);
return albums;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer in project Klyph by jonathangerbaud.
the class GroupPhotosRequest 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;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer in project Klyph by jonathangerbaud.
the class PhotoListRequest 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;
}
use of com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer in project Klyph by jonathangerbaud.
the class AllPhotosRequest 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;
}
Aggregations