Example usage for twitter4j User getDescription

List of usage examples for twitter4j User getDescription

Introduction

In this page you can find the example usage for twitter4j User getDescription.

Prototype

String getDescription();

Source Link

Document

Returns the description of the user

Usage

From source file:com.freshdigitable.udonroad.StatusViewBase.java

License:Apache License

@CallSuper
public void bindUser(final User user) {
    bindTweetUserName(user);/* www  .  j  a  v a 2s. co m*/
    tweet.setText(user.getDescription());
    createdAt.setVisibility(GONE);
    clientName.setVisibility(GONE);
}

From source file:com.freshdigitable.udonroad.UserInfoView.java

License:Apache License

public void bindData(User user) {
    name.setText(user.getName());/*from w  w w. j  a v  a2s .  co  m*/
    if (user.isVerified()) {
        verifiedIcon.setVisibility(VISIBLE);
    }
    if (user.isProtected()) {
        protectedIcon.setVisibility(VISIBLE);
    }
    UserInfoActivity.bindUserScreenName(screenName, user);
    final CharSequence desc = SpannableStringUtil.create(user.getDescription(),
            user.getDescriptionURLEntities());
    description.setText(desc);

    final String profileLinkColor = user.getProfileLinkColor();
    if (isColorParsable(profileLinkColor)) {
        final int color = parseColor(profileLinkColor);
        banner.setBackgroundColor(color);
    }

    bindURL(user);

    if (TextUtils.isEmpty(user.getLocation())) {
        locationIcon.setVisibility(GONE);
        location.setVisibility(GONE);
    } else {
        locationIcon.setVisibility(VISIBLE);
        location.setVisibility(VISIBLE);
        location.setText(user.getLocation());
    }
}

From source file:com.freshdigitable.udonroad.util.UserUtil.java

License:Apache License

public static User create() {
    final User mock = mock(User.class);
    when(mock.getScreenName()).thenReturn("akihito104");
    when(mock.getName()).thenReturn("Akihito Matsuda");
    when(mock.getId()).thenReturn(2000L);
    when(mock.getProfileBackgroundColor()).thenReturn("ffffff");
    when(mock.getDescription()).thenReturn("user description is here.");
    when(mock.getDescriptionURLEntities()).thenReturn(new URLEntity[0]);
    when(mock.getURL()).thenReturn(null);
    when(mock.getLocation()).thenReturn(null);
    return mock;//  w  ww. ja  va 2s .  co m
}

From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java

License:Open Source License

private TwitterPerson getDetailedSocialPerson(TwitterPerson twitterPerson, User user) {
    getSocialPerson(twitterPerson, user);
    twitterPerson.createdDate = user.getCreatedAt().getTime();
    twitterPerson.description = user.getDescription();
    twitterPerson.favoritesCount = user.getFavouritesCount();
    twitterPerson.followersCount = user.getFollowersCount();
    twitterPerson.friendsCount = user.getFriendsCount();
    twitterPerson.lang = user.getLang();
    twitterPerson.location = user.getLocation();
    twitterPerson.screenName = user.getScreenName();
    if (user.getStatus() != null) {
        twitterPerson.status = user.getStatus().getText();
    } else {/*from w  w  w. j  a v  a2  s. co m*/
        twitterPerson.status = null;
    }
    twitterPerson.timezone = user.getTimeZone();
    twitterPerson.isTranslator = user.isTranslator();
    twitterPerson.isVerified = user.isVerified();
    return twitterPerson;
}

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

public static void convert(User user, Struct struct) {
    struct.put("Id", user.getId()).put("Name", user.getName()).put("ScreenName", user.getScreenName())
            .put("Location", user.getLocation()).put("Description", user.getDescription())
            .put("ContributorsEnabled", user.isContributorsEnabled())
            .put("ProfileImageURL", user.getProfileImageURL())
            .put("BiggerProfileImageURL", user.getBiggerProfileImageURL())
            .put("MiniProfileImageURL", user.getMiniProfileImageURL())
            .put("OriginalProfileImageURL", user.getOriginalProfileImageURL())
            .put("ProfileImageURLHttps", user.getProfileImageURLHttps())
            .put("BiggerProfileImageURLHttps", user.getBiggerProfileImageURLHttps())
            .put("MiniProfileImageURLHttps", user.getMiniProfileImageURLHttps())
            .put("OriginalProfileImageURLHttps", user.getOriginalProfileImageURLHttps())
            .put("DefaultProfileImage", user.isDefaultProfileImage()).put("URL", user.getURL())
            .put("Protected", user.isProtected()).put("FollowersCount", user.getFollowersCount())
            .put("ProfileBackgroundColor", user.getProfileBackgroundColor())
            .put("ProfileTextColor", user.getProfileTextColor())
            .put("ProfileLinkColor", user.getProfileLinkColor())
            .put("ProfileSidebarFillColor", user.getProfileSidebarFillColor())
            .put("ProfileSidebarBorderColor", user.getProfileSidebarBorderColor())
            .put("ProfileUseBackgroundImage", user.isProfileUseBackgroundImage())
            .put("DefaultProfile", user.isDefaultProfile())
            .put("ShowAllInlineMedia", user.isShowAllInlineMedia()).put("FriendsCount", user.getFriendsCount())
            .put("CreatedAt", user.getCreatedAt()).put("FavouritesCount", user.getFavouritesCount())
            .put("UtcOffset", user.getUtcOffset()).put("TimeZone", user.getTimeZone())
            .put("ProfileBackgroundImageURL", user.getProfileBackgroundImageURL())
            .put("ProfileBackgroundImageUrlHttps", user.getProfileBackgroundImageUrlHttps())
            .put("ProfileBannerURL", user.getProfileBannerURL())
            .put("ProfileBannerRetinaURL", user.getProfileBannerRetinaURL())
            .put("ProfileBannerIPadURL", user.getProfileBannerIPadURL())
            .put("ProfileBannerIPadRetinaURL", user.getProfileBannerIPadRetinaURL())
            .put("ProfileBannerMobileURL", user.getProfileBannerMobileURL())
            .put("ProfileBannerMobileRetinaURL", user.getProfileBannerMobileRetinaURL())
            .put("ProfileBackgroundTiled", user.isProfileBackgroundTiled()).put("Lang", user.getLang())
            .put("StatusesCount", user.getStatusesCount()).put("GeoEnabled", user.isGeoEnabled())
            .put("Verified", user.isVerified()).put("Translator", user.isTranslator())
            .put("ListedCount", user.getListedCount()).put("FollowRequestSent", user.isFollowRequestSent());

    List<String> withheldInCountries = new ArrayList<>();
    if (null != user.getWithheldInCountries()) {
        for (String s : user.getWithheldInCountries()) {
            withheldInCountries.add(s);/*from  w w w.  j ava  2s .c  om*/
        }
    }
    struct.put("WithheldInCountries", withheldInCountries);

}

From source file:com.javielinux.infos.InfoUsers.java

License:Apache License

public InfoUsers(User user) {
    setId(user.getId());/*w w  w . j av  a  2 s  . c  om*/
    setName(user.getScreenName());
    setFullname(user.getName());
    setCreated(user.getCreatedAt());
    setLocation(user.getLocation());
    if (user.getURL() != null)
        setUrl(user.getURL().toString());
    setFollowers(user.getFollowersCount());
    setFollowing(user.getFriendsCount());
    setTweets(user.getStatusesCount());
    setBio(user.getDescription());
    if (user.getStatus() != null)
        setTextTweet(user.getStatus().getText());
    setUrlAvatar(user.getProfileImageURL().toString());

    ArrayList<Entity> ents = DataFramework.getInstance().getEntityList("users",
            "service is null or service = \"twitter.com\"");

    for (Entity ent : ents) {
        friendly.put(ent.getString("name"), new Friend(ent.getString("name")));
    }

}

From source file:com.marpies.ane.twitter.utils.UserUtils.java

License:Apache License

public static JSONObject getJSON(User user) throws JSONException {
    JSONObject userJSON = new JSONObject();
    userJSON.put("id", user.getId());
    userJSON.put("screenName", user.getScreenName());
    userJSON.put("name", user.getName());
    userJSON.put("createdAt", user.getCreatedAt());
    userJSON.put("description", user.getDescription());
    userJSON.put("tweetsCount", user.getStatusesCount());
    userJSON.put("likesCount", user.getFavouritesCount());
    userJSON.put("followersCount", user.getFollowersCount());
    userJSON.put("friendsCount", user.getFriendsCount());
    userJSON.put("profileImageURL", user.getProfileImageURL());
    userJSON.put("isProtected", user.isProtected());
    userJSON.put("isVerified", user.isVerified());
    userJSON.put("location", user.getLocation());
    return userJSON;
}

From source file:com.oldterns.vilebot.handlers.user.UrlTweetAnnouncer.java

License:Open Source License

/**
 * Accesses the source of a HTML page and looks for a title element
 * /*from  w  w  w.j a  v  a 2s. c  o m*/
 * @param url http tweet String
 * @return String of text which represents the tweet.  Empty if error.
 */
private String scrapeURLHTMLTitle(String url) {
    String text = "";

    URL page;
    try {
        page = new URL(url);
    } catch (MalformedURLException x) {
        // System.err.format("scrapeURLHTMLTitle new URL error: %s%n", x);
        return text;
    }

    //split the url into pieces, change the request based on what we have
    String parts[] = url.split("/");
    int userPosition = 0;
    long tweetID = 0;
    for (int i = 0; i < parts.length; i++) {

        if (parts[i].toString().equals("twitter.com"))
            userPosition = i + 1;
        if (parts[i].toString().equals("status") || parts[i].toString().equals("statuses"))
            tweetID = Long.valueOf(parts[i + 1].toString()).longValue();
    }
    if (userPosition == 0)
        return text;
    else {
        try {
            String consumerKey = ""; //may be known as 'API key'
            String consumerSecret = ""; //may be known as 'API secret'
            String accessToken = ""; //may be known as 'Access token'
            String accessTokenSecret = ""; //may be known as 'Access token secret'
            ConfigurationBuilder cb = new ConfigurationBuilder();
            cb.setDebugEnabled(true).setOAuthConsumerKey(consumerKey).setOAuthConsumerSecret(consumerSecret)
                    .setOAuthAccessToken(accessToken).setOAuthAccessTokenSecret(accessTokenSecret);
            TwitterFactory tf = new TwitterFactory(cb.build());
            Twitter twitter = tf.getInstance();
            if (tweetID != 0) //tweet of the twitter.com/USERID/status/TWEETID variety
            {
                Status status = twitter.showStatus(tweetID);
                return (status.getUser().getName() + ": " + status.getText());
            } else //just the user is given, ie, twitter.com/USERID 
            {
                User user = twitter.showUser(parts[userPosition].toString());
                if (!user.getDescription().isEmpty()) //the user has a description
                    return ("Name: " + user.getName() + " | " + user.getDescription() + "\'\nLast Tweet: \'"
                            + user.getStatus().getText());
                else //the user doesn't have a description, don't print it
                    return ("Name: " + user.getName() + "\'\nLast Tweet: \'" + user.getStatus().getText());

            }
        } catch (TwitterException x) {
            return text;
        }
    }
}

From source file:com.raythos.sentilexo.twitter.domain.QueryResultItemMapper.java

License:Apache License

public static TwitterQueryResultItemAvro mapItem(String queryOwner, String queryName, String queryString,
        Status status) {//from w w w .  j  a va 2  s .com
    TwitterQueryResultItemAvro result = new TwitterQueryResultItemAvro();

    if (queryName != null)
        queryName = queryName.toLowerCase();
    if (queryOwner != null)
        queryOwner = queryOwner.toLowerCase();

    result.setQueryName(queryName);
    result.setQueryOwner(queryOwner);
    result.setQuery(queryString);
    result.setStatusId(status.getId());
    result.setText(status.getText());

    result.setRelevantQueryTerms(TwitterUtils.relevantQueryTermsFromStatus(queryString, status));
    result.setLang(status.getLang());

    result.setCreatedAt(status.getCreatedAt().getTime());

    User user = status.getUser();
    result.setUserId(user.getId());
    result.setScreenName(user.getScreenName());
    result.setUserLocation(user.getLocation());
    result.setUserName(user.getName());
    result.setUserDescription(user.getDescription());
    result.setUserIsProtected(user.isProtected());
    result.setUserFollowersCount(user.getFollowersCount());
    result.setUserCreatedAt(user.getCreatedAt().getTime());
    result.setUserCreatedAtAsString(DateTimeUtils.getDateAsText(user.getCreatedAt()));
    result.setCreatedAtAsString(DateTimeUtils.getDateAsText(status.getCreatedAt()));
    result.setUserFriendsCount(user.getFriendsCount());
    result.setUserListedCount(user.getListedCount());
    result.setUserStatusesCount(user.getStatusesCount());
    result.setUserFavoritesCount(user.getFavouritesCount());

    result.setCurrentUserRetweetId(status.getCurrentUserRetweetId());

    result.setInReplyToScreenName(status.getInReplyToScreenName());
    result.setInReplyToStatusId(status.getInReplyToStatusId());
    result.setInReplyToUserId(status.getInReplyToUserId());

    if (status.getGeoLocation() != null) {
        result.setLatitude(status.getGeoLocation().getLatitude());
        result.setLongitude(status.getGeoLocation().getLongitude());
    }

    result.setSource(status.getSource());
    result.setTrucated(status.isTruncated());
    result.setPossiblySensitive(status.isPossiblySensitive());

    result.setRetweet(status.getRetweetedStatus() != null);
    if (result.getRetweet()) {
        result.setRetweetStatusId(status.getRetweetedStatus().getId());
        result.setRetweetedText(status.getRetweetedStatus().getText());
    }
    result.setRetweeted(status.isRetweeted());
    result.setRetweetCount(status.getRetweetCount());
    result.setRetweetedByMe(status.isRetweetedByMe());

    result.setFavoriteCount(status.getFavoriteCount());
    result.setFavourited(status.isFavorited());

    if (status.getPlace() != null) {
        result.setPlace(status.getPlace().getFullName());
    }

    Scopes scopesObj = status.getScopes();
    if (scopesObj != null) {
        List scopes = Arrays.asList(scopesObj.getPlaceIds());
        result.setScopes(scopes);
    }
    return result;
}

From source file:com.rowland.hashtrace.utility.Utility.java

License:Apache License

public static Tweet createTweet(Status status) {
    User user = status.getUser();

    long tweet_id = status.getId();

    String tweet_text = status.getText();

    Date tweet_text_date = status.getCreatedAt();

    int tweet_retweet_count = status.getRetweetCount();

    int tweet_favourite_count = status.getFavoriteCount();

    int tweet_mentions_count = status.getUserMentionEntities().length;

    String user_name = user.getScreenName();

    String user_image_url = user.getBiggerProfileImageURL();

    String user_cover_url = user.getProfileBackgroundImageURL();

    String user_location = user.getLocation();

    String user_description = user.getDescription();

    Tweet tweet = new Tweet(tweet_id, tweet_text, tweet_text_date, tweet_retweet_count, tweet_favourite_count,
            tweet_mentions_count, user_name, user_image_url, user_location, user_description, user_cover_url);

    return tweet;
}