Search in sources :

Example 6 with Attachment

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

the class StreamButtonBar method handleShareAction.

private void handleShareAction(final IStreamHolder holder, final Stream stream) {
    Intent intent = new Intent(getContext(holder.getShareButton()), PostActivity.class);
    intent.putExtra(KlyphBundleExtras.SHARE, true);
    Attachment att = stream.getAttachment();
    if (stream.isLink()) {
        Link link = stream.getLink();
        intent.putExtra(KlyphBundleExtras.SHARE_LINK_URL, link.getUrl());
        intent.putExtra(KlyphBundleExtras.SHARE_LINK_IMAGE_URL, link.getPicture());
        intent.putExtra(KlyphBundleExtras.SHARE_LINK_NAME, link.getTitle());
        intent.putExtra(KlyphBundleExtras.SHARE_LINK_DESC, link.getSummary());
    } else if (stream.isPhoto()) /* || att.isPhoto() */
    {
        Photo photo = stream.getPhoto();
        intent.putExtra(KlyphBundleExtras.SHARE_PHOTO_ID, stream.isPhoto() ? photo.getObject_id() : att.getFb_object_id());
    } else if (stream.isVideo()) /* || att.isVideo() */
    {
        Video video = stream.getVideo();
        intent.putExtra(KlyphBundleExtras.SHARE_VIDEO_ID, stream.isVideo() ? video.getVid() : att.getFb_object_id());
    } else /*
		 * else if (att.isAlbum())
		 * {
		 * intent.putExtra(KlyphBundleExtras.SHARE_ALBUM_ID, att.getFb_object_id());
		 * }
		 */
    {
        intent.putExtra(KlyphBundleExtras.SHARE_POST_ID, stream);
        Log.d("StreamButtonBar", "Share something but I do not what");
    }
    getContext(holder.getShareButton()).startActivity(intent);
}
Also used : Video(com.abewy.android.apps.klyph.core.fql.Video) Intent(android.content.Intent) Attachment(com.abewy.android.apps.klyph.core.fql.Attachment) Photo(com.abewy.android.apps.klyph.core.fql.Photo) Link(com.abewy.android.apps.klyph.core.fql.Link)

Example 7 with Attachment

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

the class StreamButtonBar method handleShareWithAction.

private void handleShareWithAction(final IStreamHolder holder, final Stream stream) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    Attachment att = stream.getAttachment();
    if (stream.isLink()) {
        Link link = stream.getLink();
        intent.putExtra(Intent.EXTRA_TEXT, link.getUrl());
        intent.putExtra(Intent.EXTRA_SUBJECT, link.getTitle());
        intent.setType("text/plain");
    } else if (stream.isPhoto()) /* || att.isPhoto() */
    {
        Photo photo = stream.getPhoto();
        intent.putExtra(Intent.EXTRA_TEXT, photo.getLargestImageURL());
        if (photo.getCaption().length() > 0)
            intent.putExtra(Intent.EXTRA_SUBJECT, photo.getCaption());
        else if (stream.getMessage().length() > 0)
            intent.putExtra(Intent.EXTRA_SUBJECT, stream.getMessage());
        intent.setType("text/plain");
    // intent.putExtra(KlyphBundleExtras.SHARE_PHOTO_ID, stream.isPhoto() ? photo.getObject_id() : att.getFb_object_id());
    } else if (stream.isVideo()) /* || att.isVideo() */
    {
        Video video = stream.getVideo();
        intent.putExtra(Intent.EXTRA_TEXT, video.getSrc_hq());
        if (video.getTitle().length() > 0)
            intent.putExtra(Intent.EXTRA_SUBJECT, video.getTitle());
        else if (stream.getMessage().length() > 0)
            intent.putExtra(Intent.EXTRA_SUBJECT, stream.getMessage());
        intent.setType("text/plain");
    // intent.putExtra(KlyphBundleExtras.SHARE_VIDEO_ID, stream.isVideo() ? video.getVid() : att.getFb_object_id());
    } else /*
		 * else if (att.isAlbum())
		 * {
		 * intent.putExtra(KlyphBundleExtras.SHARE_ALBUM_ID, att.getFb_object_id());
		 * }
		 */
    if (att.getMedia().size() == 1) {
        Media m = att.getMedia().get(0);
        intent.putExtra(Intent.EXTRA_TEXT, m.getSrc());
        intent.putExtra(Intent.EXTRA_SUBJECT, m.getAlt());
        intent.setType("text/plain");
    } else {
        if (stream.getMessage().length() > 0) {
            intent.putExtra(Intent.EXTRA_TEXT, stream.getMessage());
            intent.setType("text/plain");
        } else if (stream.getDescription().length() > 0) {
            intent.putExtra(Intent.EXTRA_TEXT, stream.getDescription());
            intent.setType("text/plain");
        }
    }
    try {
        getContext(holder.getShareButton()).startActivity(intent);
    } catch (ActivityNotFoundException e) {
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Video(com.abewy.android.apps.klyph.core.fql.Video) Media(com.abewy.android.apps.klyph.core.fql.Media) Intent(android.content.Intent) Attachment(com.abewy.android.apps.klyph.core.fql.Attachment) Photo(com.abewy.android.apps.klyph.core.fql.Photo) Link(com.abewy.android.apps.klyph.core.fql.Link)

Example 8 with Attachment

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

the class StreamAdapter method manageAttachment.

private void manageAttachment(View view, 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(view, holder, stream);
        buttonBarAdapter.mergeData(holder, stream);
    } else if (stream.getLink().isEventLink()) {
        linkAdapter.mergeData(holder, stream, stream.getLink());
    } else if (type == 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);
    }
}
Also used : Media(com.abewy.android.apps.klyph.core.fql.Media) Attachment(com.abewy.android.apps.klyph.core.fql.Attachment) Stream(com.abewy.android.apps.klyph.core.fql.Stream)

Example 9 with Attachment

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

the class StreamAdapter method manageAttachmentCheckin.

private void manageAttachmentCheckin(View view, StreamHolder holder, Stream stream) {
    if (stream.getDescription().length() == 0) {
        Attachment attachment = stream.getAttachment();
        holder.getStory().setText(attachment.getCaption());
        TextViewUtil.setElementClickable(getContext(view), holder.getStory(), stream.getActor_name(), stream.getActor_id(), "user", false);
        TextViewUtil.setElementClickable(getContext(view), holder.getStory(), attachment.getName(), stream.getPlace(), "page", false);
    }
/*
		 * Tag tag = new Tag(); tag.setName(attachment.getName());
		 * tag.setId(attachment.getFb_checkin().getPage_id());
		 * tag.setOffset(attachment.getCaption().indexOf(attachment.getName()));
		 * tag.setLength(attachment.getName().length()); ArrayList<Tag> tags =
		 * new ArrayList<Tag>(); tags.add(tag);
		 */
// addClickableTextForTags(holder.getStory(), attachment.getCaption(),
// tags);
}
Also used : Attachment(com.abewy.android.apps.klyph.core.fql.Attachment)

Example 10 with Attachment

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

the class StreamAdapter2 method manageAttachmentCheckin.

private void manageAttachmentCheckin(StreamHolder holder, Stream stream) {
    Attachment attachment = stream.getAttachment();
    Tag tag = new Tag();
    tag.setName(attachment.getName());
    tag.setId(attachment.getFb_checkin().getPage_id());
    tag.setOffset(attachment.getCaption().indexOf(attachment.getName()));
    tag.setLength(attachment.getName().length());
    ArrayList<Tag> tags = new ArrayList<Tag>();
    tags.add(tag);
// addClickableTextForTags(getContext(), holder.getStory(),
// attachment.getCaption(),
// tags);
}
Also used : ArrayList(java.util.ArrayList) Attachment(com.abewy.android.apps.klyph.core.fql.Attachment) Tag(com.abewy.android.apps.klyph.core.fql.Tag)

Aggregations

Attachment (com.abewy.android.apps.klyph.core.fql.Attachment)12 Media (com.abewy.android.apps.klyph.core.fql.Media)8 Intent (android.content.Intent)4 View (android.view.View)3 Stream (com.abewy.android.apps.klyph.core.fql.Stream)3 RatioImageView (com.abewy.android.extended.widget.RatioImageView)3 ActivityNotFoundException (android.content.ActivityNotFoundException)2 OnClickListener (android.view.View.OnClickListener)2 ViewGroup (android.view.ViewGroup)2 Link (com.abewy.android.apps.klyph.core.fql.Link)2 Photo (com.abewy.android.apps.klyph.core.fql.Photo)2 Video (com.abewy.android.apps.klyph.core.fql.Video)2 ArrayList (java.util.ArrayList)2 AlbumActivity (com.abewy.android.apps.klyph.app.AlbumActivity)1 ImageActivity (com.abewy.android.apps.klyph.app.ImageActivity)1 Friend (com.abewy.android.apps.klyph.core.fql.Friend)1 Tag (com.abewy.android.apps.klyph.core.fql.Tag)1 Response (com.abewy.android.apps.klyph.core.request.Response)1 AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)1 AdapterView (it.sephiroth.android.library.widget.AdapterView)1