use of com.abewy.android.apps.klyph.core.fql.Attachment 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.Attachment in project Klyph by jonathangerbaud.
the class AttachmentSerializer method serializeObject.
@Override
public JSONObject serializeObject(GraphObject object) {
JSONObject json = new JSONObject();
serializePrimitives(object, json);
Attachment attachment = (Attachment) object;
CheckinSerializer cs = new CheckinSerializer();
MediaSerializer ms = new MediaSerializer();
try {
json.putOpt("fb_checkin", cs.serializeObject(attachment.getFb_checkin()));
json.putOpt("media", ms.serializeArray(attachment.getMedia()));
} catch (JSONException e) {
Log.d("AttachmentSerializer", "JSONException" + e.getMessage());
}
return json;
}
use of com.abewy.android.apps.klyph.core.fql.Attachment 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.Attachment 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.Attachment in project Klyph by jonathangerbaud.
the class PostShare method initWithIntent.
public void initWithIntent(Intent intent) {
String photoId = intent.getStringExtra(KlyphBundleExtras.SHARE_PHOTO_ID);
String videoId = intent.getStringExtra(KlyphBundleExtras.SHARE_VIDEO_ID);
String albumId = intent.getStringExtra(KlyphBundleExtras.SHARE_ALBUM_ID);
Stream post = intent.getParcelableExtra(KlyphBundleExtras.SHARE_POST_ID);
String linkUrl = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_URL);
if (photoId != null) {
url = PHOTO + photoId;
new AsyncRequest(Query.PHOTO, photoId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onPhotoRequestComplete(response);
}
}).execute();
} else if (videoId != null) {
url = VIDEO + videoId;
new AsyncRequest(Query.VIDEO, videoId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onVideoRequestComplete(response);
}
}).execute();
} else if (albumId != null) {
url = ALBUM + albumId;
new AsyncRequest(Query.ALBUM, albumId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onAlbumRequestComplete(response);
}
}).execute();
} else if (post != null) {
url = post.getPermalink();
if (post.isStatus()) {
fillViews(post.getActor_name(), post.getMessage(), post.getActor_pic());
getActivity().setTitle(R.string.post_share_status);
} else {
Attachment att = post.getAttachment();
if (att.isPhoto() || att.isVideo() || att.isAlbum()) {
Media media = att.getMedia().get(0);
if (att.isAlbum()) {
fillViews(post.getActor_name(), att.getName(), media.getSrc());
} else {
fillViews(post.getActor_name(), media.getAlt(), media.getSrc());
}
if (att.isPhoto())
getActivity().setTitle(R.string.post_share_photo);
else if (att.isVideo())
getActivity().setTitle(R.string.post_share_video);
else
getActivity().setTitle(R.string.post_share_album);
} else {
getActivity().setTitle(R.string.post_share_status);
fillViews(post.getActor_name(), post.getMessage(), post.getActor_pic());
}
}
} else if (linkUrl != null) {
isLink = true;
url = linkUrl;
imageUrl = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_IMAGE_URL);
String linkName = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_NAME);
String linkDesc = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_DESC);
fillViews(linkName, linkDesc, imageUrl);
getActivity().setTitle(R.string.post_share_link);
} else {
Log.d("PostShare", "All null");
}
if (isLink == false) {
((ViewGroup) spinner.getParent()).setVisibility(View.GONE);
} else {
SpinnerAdapter adapter = new SpinnerAdapter(getActivity());
spinner.setAdapter(adapter);
Friend friend = new Friend();
friend.setName(getString(R.string.post_share_on_my_wall));
adapter.add(friend);
friend = new Friend();
friend.setName(getString(R.string.post_share_on_friend_wall));
adapter.add(friend);
adapter.notifyDataSetChanged();
spinner.setSelection(0);
spinner.setOnItemSelectedListener(this);
previousPosition = 0;
}
}
Aggregations