Example usage for twitter4j MediaEntity getMediaURL

List of usage examples for twitter4j MediaEntity getMediaURL

Introduction

In this page you can find the example usage for twitter4j MediaEntity getMediaURL.

Prototype

String getMediaURL();

Source Link

Document

Returns the media URL.

Usage

From source file:net.lacolaco.smileessence.view.dialog.StatusMenuDialogFragment.java

License:Open Source License

public void addBottomCommands(Activity activity, Status status, Account account, ArrayList<Command> commands) {
    commands.add(new CommandSaveAsTemplate(activity, TwitterUtils.getOriginalStatusText(status)));
    //User/*from  w ww.  ja  v a  2 s  .  c  o m*/
    for (String screenName : TwitterUtils.getScreenNames(status, null)) {
        commands.add(new CommandOpenUserDetail(activity, screenName, account));
    }
    for (Command command : getHashtagCommands(activity, status)) {
        commands.add(command);
    }
    // Media
    if (status.getURLEntities() != null) {
        for (URLEntity urlEntity : status.getURLEntities()) {
            commands.add(new CommandOpenURL(activity, urlEntity.getExpandedURL()));
        }
    }
    for (MediaEntity mediaEntity : status.getExtendedMediaEntities().length == 0 ? status.getMediaEntities()
            : status.getExtendedMediaEntities()) {
        commands.add(new CommandOpenURL(activity, mediaEntity.getMediaURL()));
    }
}

From source file:org.getlantern.firetweet.util.TwitterContentUtils.java

License:Open Source License

private static void parseEntities(final HtmlBuilder builder, final EntitySupport entities) {
    // Format media.
    final MediaEntity[] mediaEntities = entities.getMediaEntities();
    if (mediaEntities != null) {
        for (final MediaEntity mediaEntity : mediaEntities) {
            final int start = mediaEntity.getStart(), end = mediaEntity.getEnd();
            final String mediaUrl = mediaEntity.getMediaURL();
            if (mediaUrl != null && start >= 0 && end >= 0) {
                builder.addLink(mediaUrl, mediaEntity.getDisplayURL(), start, end);
            }/*  w  w  w  .j a v a  2s  .c  o m*/
        }
    }
    final URLEntity[] urlEntities = entities.getURLEntities();
    if (urlEntities != null) {
        for (final URLEntity urlEntity : urlEntities) {
            final int start = urlEntity.getStart(), end = urlEntity.getEnd();
            final String expandedUrl = urlEntity.getExpandedURL();
            if (expandedUrl != null && start >= 0 && end >= 0) {
                builder.addLink(expandedUrl, urlEntity.getDisplayURL(), start, end);
            }
        }
    }
}

From source file:org.nsoft.openbus.model.Mensagem.java

License:Open Source License

private static JSONObject createAddtions(Status s) throws JSONException {
    JSONObject json = new JSONObject();

    Vector<String> metions = new Vector<String>();
    UserMentionEntity[] in_metions = s.getUserMentionEntities();
    if (in_metions != null) {
        for (UserMentionEntity metion : in_metions) {
            metions.add(metion.getName());
        }/*from ww w  . j a v a2s. c o  m*/
    }

    URLEntity[] urls = s.getURLEntities();

    Vector<String> image_files = new Vector<String>();
    MediaEntity[] in_medias = s.getMediaEntities();
    if (in_medias != null) {
        for (MediaEntity media : in_medias) {
            image_files.add(media.getMediaURL().toString());
        }
    }

    json.put("metions", metions);
    json.put("image_files", metions);

    json.put("inReplyId", s.getInReplyToStatusId());
    return json;

}

From source file:org.tweetalib.android.model.TwitterMediaEntity.java

License:Apache License

private TwitterMediaEntity(MediaEntity mediaEntity) {
    mSource = Source.TWITTER;//ww w  .  ja v a  2  s .  c o  m
    mMediaCode = mediaEntity.getMediaURL();
    mUrl = mediaEntity.getURL();
    mExpandedUrl = mediaEntity.getExpandedURL();

    /*
     * mSizeThumb = new
     * SizeInfo(mediaEntity.getSizes().get(MediaEntity.Size.THUMB));
     * mSizeSmall = new
     * SizeInfo(mediaEntity.getSizes().get(MediaEntity.Size.SMALL));
     * mSizeMedium = new
     * SizeInfo(mediaEntity.getSizes().get(MediaEntity.Size.MEDIUM));
     * mSizeLarge = new
     * SizeInfo(mediaEntity.getSizes().get(MediaEntity.Size.LARGE));
     */
}

From source file:org.xmlsh.twitter.util.TwitterWriter.java

License:BSD License

private void write(String localName, MediaEntity m) throws XMLStreamException {
    startElement(localName);/*from w  w w  .j  a  v a  2  s  .  com*/
    attribute("display-url", m.getDisplayURL());
    attribute("end", m.getEnd());
    attribute("expanded-url", m.getExpandedURL().toString());
    attribute("id", m.getId());
    attribute("media-url", m.getMediaURL().toString());
    attribute("media-url-https", m.getMediaURLHttps().toString());

    attribute("start", m.getStart());
    attribute("url", m.getURL().toString());
    Set<Entry<Integer, Size>> sizes = m.getSizes().entrySet();
    for (Entry<Integer, Size> s : sizes) {
        startElement("size");
        attribute("height", s.getValue().getHeight());
        attribute("width", s.getValue().getWidth());
        attribute("resize", s.getValue().getResize());
        endElement();

    }
}