use of com.abewy.android.apps.klyph.core.fql.Media in project Klyph by jonathangerbaud.
the class StreamAdapter2 method manageAttachment.
private void manageAttachment(StreamHolder holder, Stream stream) {
Attachment attachment = stream.getAttachment();
Media media = attachment.getMedia().size() > 0 ? attachment.getMedia().get(0) : null;
int type = stream.getType();
if ((type == 245 || type == 257) && stream.getParent_stream() != null) {
final Stream parentStream = stream.getParent_stream();
headerAdapter.mergeData(holder, parentStream, true);
messageAdapter.mergeData(holder, parentStream);
buttonBarAdapter.mergeData(holder, stream);
}
if (type == 161 && stream.getDescription_tags().size() > 0 && stream.getLiked_pages().size() > 0) {
linkAdapter.manageLikedPage(holder, stream);
}
if (stream.isStatus()) {
statusAdapter.mergeData(holder, stream);
} else if (stream.isPhoto()) {
photoAdapter.mergeData(holder, stream, stream.getPhoto());
} else if (stream.isVideo()) {
photoAdapter.mergeData(holder, stream, stream.getVideo());
} else if (attachment.isPhoto() || ((media != null && media.isFydv()))) {
photoAdapter.mergeData(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (attachment.isAlbum()) {
albumAdapter.mergeData(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (attachment.isCheckin()) {
manageAttachmentCheckin(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (stream.getLink().isEventLink()) {
linkAdapter.mergeData(holder, stream, stream.getLink());
} else if (stream.getType() == 161 || attachment.getMedia().size() > 0) {
linkAdapter.mergeData(holder, stream);
buttonBarAdapter.mergeData(holder, stream);
} else if (stream.isLink()) {
linkAdapter.mergeData(holder, stream, stream.getLink());
} else {
buttonBarAdapter.mergeData(holder, stream);
}
}
use of com.abewy.android.apps.klyph.core.fql.Media in project Klyph by jonathangerbaud.
the class StreamLink method manageAttachmentLink.
private void manageAttachmentLink(StreamHolder holder, Stream stream) {
final Attachment attachment = stream.getAttachment();
final Media media = attachment.getMedia().get(0);
if (media.getAlt().length() == 0 && media.getHref().length() == 0 && attachment.getName().length() == 0 && attachment.getCaption().length() == 0 && attachment.getDescription().length() == 0)
return;
holder.getPostLinkBackground().setVisibility(View.VISIBLE);
loadImage(holder.getPostLinkBackground(), getLargeImageUrlForLink(media.getSrc()), R.drawable.stream_link_placeholder, stream);
holder.getPostLinkBackground().setVisibility(View.VISIBLE);
if (attachment.getName().length() > 0) {
holder.getPostName().setText(attachment.getName());
holder.getPostName().setVisibility(View.VISIBLE);
}
if (attachment.getCaption().length() > 0) {
holder.getPostCaption().setText(attachment.getCaption());
holder.getPostCaption().setVisibility(View.VISIBLE);
}
if (attachment.getDescription().length() > 0) {
holder.getPostDescription().setText(attachment.getDescription());
holder.getPostDescription().setVisibility(View.VISIBLE);
}
if (media.isVideo()) {
holder.getPostPicturePlay().setVisibility(View.VISIBLE);
}
final View view = holder.getAuthorProfileImage();
holder.getStreamLink().setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
PhoneUtil.openURL(getContext(view), attachment.getHref());
}
});
holder.getStreamLink().setVisibility(View.VISIBLE);
}
use of com.abewy.android.apps.klyph.core.fql.Media in project Klyph by jonathangerbaud.
the class AttachmentDeserializer method deserializeObject.
@Override
public GraphObject deserializeObject(JSONObject data) {
Attachment attachment = new Attachment();
deserializePrimitives(attachment, data);
attachment.setMedia(new MediaDeserializer().deserializeArray(getJsonArray(data, "media"), Media.class));
attachment.setFb_checkin((Checkin) new CheckinDeserializer().deserializeObject(getJsonObject(data, "fb_checkin")));
return attachment;
}
use of com.abewy.android.apps.klyph.core.fql.Media in project Klyph by jonathangerbaud.
the class MediaSerializer method serializeObject.
@Override
public JSONObject serializeObject(GraphObject object) {
JSONObject json = new JSONObject();
serializePrimitives(object, json);
Media media = (Media) object;
PhotoSerializer ps = new PhotoSerializer();
VideoSerializer vs = new VideoSerializer();
SwfSerializer swfs = new SwfSerializer();
try {
json.put("photo", ps.serializeObject(media.getPhoto()));
json.put("video", vs.serializeObject(media.getVideo()));
json.put("swf", swfs.serializeObject(media.getSwf()));
} catch (JSONException e) {
Log.d("MediaSerializer", "JsonException " + e);
}
return json;
}
use of com.abewy.android.apps.klyph.core.fql.Media in project Klyph by jonathangerbaud.
the class MediaDeserializer method deserializeObject.
@Override
public GraphObject deserializeObject(JSONObject data) {
Media media = new Media();
deserializePrimitives(media, data);
media.setPhoto((Photo) new PhotoDeserializer().deserializeObject(getJsonObject(data, "photo")));
media.setVideo((Video) new VideoDeserializer().deserializeObject(getJsonObject(data, "video")));
media.setSwf((Swf) new SwfDeserializer().deserializeObject(getJsonObject(data, "swf")));
return media;
}
Aggregations