Example usage for twitter4j User getProfileImageURLHttps

List of usage examples for twitter4j User getProfileImageURLHttps

Introduction

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

Prototype

String getProfileImageURLHttps();

Source Link

Usage

From source file:de.vanita5.twittnuker.model.ParcelableUserList.java

License:Open Source License

public ParcelableUserList(final UserList list, final long account_id, final long position,
        final boolean is_following) {
    final User user = list.getUser();
    this.position = position;
    this.account_id = account_id;
    id = list.getId();//from   w  w w .ja  va  2s.  c  o m
    is_public = list.isPublic();
    this.is_following = is_following;
    name = list.getName();
    description = list.getDescription();
    user_id = user.getId();
    user_name = user.getName();
    user_screen_name = user.getScreenName();
    user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
    members_count = list.getMemberCount();
    subscribers_count = list.getSubscriberCount();
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeAccountContentValuesBasic(final Configuration conf, final String basicUsername,
        final String basicPassword, final User user, final int color, final String apiUrlFormat,
        final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    if (basicUsername == null || basicPassword == null)
        return null;
    values.put(Accounts.BASIC_AUTH_USERNAME, basicUsername);
    values.put(Accounts.BASIC_AUTH_PASSWORD, basicPassword);
    values.put(Accounts.AUTH_TYPE, Accounts.AUTH_TYPE_BASIC);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, ParseUtils.parseString(user.getProfileImageUrlHttps()));
    values.put(Accounts.PROFILE_BANNER_URL, ParseUtils.parseString(user.getProfileBannerImageUrl()));
    values.put(Accounts.COLOR, color);//from   w  w w.j ava  2  s  . c  o m
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeAccountContentValuesOAuth(final Configuration conf,
        final AccessToken accessToken, final User user, final int authType, final int color,
        final String apiUrlFormat, final boolean sameOAuthSigningUrl, final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0 || accessToken == null || user.getId() != accessToken.getUserId())
        return null;
    final ContentValues values = new ContentValues();
    values.put(Accounts.OAUTH_TOKEN, accessToken.getToken());
    values.put(Accounts.OAUTH_TOKEN_SECRET, accessToken.getTokenSecret());
    values.put(Accounts.CONSUMER_KEY, conf.getOAuthConsumerKey());
    values.put(Accounts.CONSUMER_SECRET, conf.getOAuthConsumerSecret());
    values.put(Accounts.AUTH_TYPE, authType);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, ParseUtils.parseString(user.getProfileImageUrlHttps()));
    values.put(Accounts.PROFILE_BANNER_URL, ParseUtils.parseString(user.getProfileBannerImageUrl()));
    values.put(Accounts.COLOR, color);/* w  w w. jav  a2s  .c o  m*/
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.SAME_OAUTH_SIGNING_URL, sameOAuthSigningUrl);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeAccountContentValuesTWIP(final Configuration conf, final User user,
        final int color, final String apiUrlFormat, final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    values.put(Accounts.AUTH_TYPE, Accounts.AUTH_TYPE_TWIP_O_MODE);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, ParseUtils.parseString(user.getProfileImageUrlHttps()));
    values.put(Accounts.PROFILE_BANNER_URL, ParseUtils.parseString(user.getProfileBannerImageUrl()));
    values.put(Accounts.COLOR, color);// www . jav  a  2 s. c o m
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeCachedUserContentValues(final User user) {
    if (user == null || user.getId() <= 0)
        return null;
    final String profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
    final String url = ParseUtils.parseString(user.getURL());
    final URLEntity[] urls = user.getURLEntities();
    final ContentValues values = new ContentValues();
    values.put(CachedUsers.USER_ID, user.getId());
    values.put(CachedUsers.NAME, user.getName());
    values.put(CachedUsers.SCREEN_NAME, user.getScreenName());
    values.put(CachedUsers.PROFILE_IMAGE_URL, profile_image_url);
    values.put(CachedUsers.CREATED_AT, user.getCreatedAt().getTime());
    values.put(CachedUsers.IS_PROTECTED, user.isProtected());
    values.put(CachedUsers.IS_VERIFIED, user.isVerified());
    values.put(CachedUsers.IS_FOLLOWING, user.isFollowing());
    values.put(CachedUsers.FAVORITES_COUNT, user.getFavouritesCount());
    values.put(CachedUsers.FOLLOWERS_COUNT, user.getFollowersCount());
    values.put(CachedUsers.FRIENDS_COUNT, user.getFriendsCount());
    values.put(CachedUsers.STATUSES_COUNT, user.getStatusesCount());
    values.put(CachedUsers.LISTED_COUNT, user.getListedCount());
    values.put(CachedUsers.LOCATION, user.getLocation());
    values.put(CachedUsers.DESCRIPTION_PLAIN, user.getDescription());
    values.put(CachedUsers.DESCRIPTION_HTML, Utils.formatUserDescription(user));
    values.put(CachedUsers.DESCRIPTION_EXPANDED, Utils.formatExpandedUserDescription(user));
    values.put(CachedUsers.URL, url);
    values.put(CachedUsers.URL_EXPANDED,
            url != null && urls != null && urls.length > 0 ? ParseUtils.parseString(urls[0].getExpandedURL())
                    : null);//  w  ww .ja  va2 s .  co  m
    values.put(CachedUsers.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
    return values;
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeDirectMessageContentValues(final DirectMessage message, final long account_id,
        final boolean is_outgoing, final boolean large_profile_image) {
    if (message == null || message.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    final User sender = message.getSender(), recipient = message.getRecipient();
    if (sender == null || recipient == null)
        return null;
    final String sender_profile_image_url = ParseUtils.parseString(sender.getProfileImageUrlHttps());
    final String recipient_profile_image_url = ParseUtils.parseString(recipient.getProfileImageUrlHttps());
    values.put(DirectMessages.ACCOUNT_ID, account_id);
    values.put(DirectMessages.MESSAGE_ID, message.getId());
    values.put(DirectMessages.MESSAGE_TIMESTAMP, message.getCreatedAt().getTime());
    values.put(DirectMessages.SENDER_ID, sender.getId());
    values.put(DirectMessages.RECIPIENT_ID, recipient.getId());
    final String text_html = Utils.formatDirectMessageText(message);
    values.put(DirectMessages.TEXT_HTML, text_html);
    values.put(DirectMessages.TEXT_PLAIN, message.getText());
    values.put(DirectMessages.TEXT_UNESCAPED, toPlainText(text_html));
    values.put(DirectMessages.IS_OUTGOING, is_outgoing);
    values.put(DirectMessages.SENDER_NAME, sender.getName());
    values.put(DirectMessages.SENDER_SCREEN_NAME, sender.getScreenName());
    values.put(DirectMessages.RECIPIENT_NAME, recipient.getName());
    values.put(DirectMessages.RECIPIENT_SCREEN_NAME, recipient.getScreenName());
    values.put(DirectMessages.SENDER_PROFILE_IMAGE_URL,
            large_profile_image ? getBiggerTwitterProfileImage(sender_profile_image_url)
                    : sender_profile_image_url);
    values.put(DirectMessages.RECIPIENT_PROFILE_IMAGE_URL,
            large_profile_image ? getBiggerTwitterProfileImage(recipient_profile_image_url)
                    : recipient_profile_image_url);
    final ParcelableMedia[] mediaArray = ParcelableMedia.fromEntities(message);
    if (mediaArray != null) {
        values.put(DirectMessages.MEDIA, JSONSerializer.toJSONArrayString(mediaArray));
        values.put(DirectMessages.FIRST_MEDIA, mediaArray[0].url);
    }//from  w w w . j  a  v a 2  s.c o  m
    return values;
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeStatusContentValues(final Status orig, final long accountId,
        final boolean largeProfileImage) {
    if (orig == null || orig.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    values.put(Statuses.ACCOUNT_ID, accountId);
    values.put(Statuses.STATUS_ID, orig.getId());
    values.put(Statuses.STATUS_TIMESTAMP, orig.getCreatedAt().getTime());
    values.put(Statuses.MY_RETWEET_ID, orig.getCurrentUserRetweet());
    final boolean isRetweet = orig.isRetweet();
    final Status status;
    final Status retweetedStatus = isRetweet ? orig.getRetweetedStatus() : null;
    if (retweetedStatus != null) {
        final User retweetUser = orig.getUser();
        values.put(Statuses.RETWEET_ID, retweetedStatus.getId());
        values.put(Statuses.RETWEET_TIMESTAMP, retweetedStatus.getCreatedAt().getTime());
        values.put(Statuses.RETWEETED_BY_USER_ID, retweetUser.getId());
        values.put(Statuses.RETWEETED_BY_USER_NAME, retweetUser.getName());
        values.put(Statuses.RETWEETED_BY_USER_SCREEN_NAME, retweetUser.getScreenName());
        values.put(Statuses.RETWEETED_BY_USER_PROFILE_IMAGE,
                ParseUtils.parseString(retweetUser.getProfileImageUrlHttps()));
        status = retweetedStatus;/* w ww.  j av  a 2  s  . com*/
    } else {
        status = orig;
    }
    final User user = status.getUser();
    if (user != null) {
        final long userId = user.getId();
        final String profileImageUrl = ParseUtils.parseString(user.getProfileImageUrlHttps());
        final String name = user.getName(), screenName = user.getScreenName();
        values.put(Statuses.USER_ID, userId);
        values.put(Statuses.USER_NAME, name);
        values.put(Statuses.USER_SCREEN_NAME, screenName);
        values.put(Statuses.IS_PROTECTED, user.isProtected());
        values.put(Statuses.IS_VERIFIED, user.isVerified());
        values.put(Statuses.USER_PROFILE_IMAGE_URL,
                largeProfileImage ? getBiggerTwitterProfileImage(profileImageUrl) : profileImageUrl);
        values.put(CachedUsers.IS_FOLLOWING, user.isFollowing());
    }
    final String text_html = Utils.formatStatusText(status);
    values.put(Statuses.TEXT_HTML, text_html);
    values.put(Statuses.TEXT_PLAIN, status.getText());
    values.put(Statuses.TEXT_UNESCAPED, toPlainText(text_html));
    values.put(Statuses.RETWEET_COUNT, status.getRetweetCount());
    values.put(Statuses.REPLY_COUNT, status.getReplyCount());
    values.put(Statuses.DESCENDENT_REPLY_COUNT, status.getDescendentReplyCount());
    values.put(Statuses.IN_REPLY_TO_STATUS_ID, status.getInReplyToStatusId());
    values.put(Statuses.IN_REPLY_TO_USER_ID, status.getInReplyToUserId());
    values.put(Statuses.IN_REPLY_TO_USER_NAME, Utils.getInReplyToName(status));
    values.put(Statuses.IN_REPLY_TO_USER_SCREEN_NAME, status.getInReplyToScreenName());
    values.put(Statuses.SOURCE, status.getSource());
    values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive());
    final GeoLocation location = status.getGeoLocation();
    if (location != null) {
        values.put(Statuses.LOCATION, location.getLatitude() + "," + location.getLongitude());
    }
    values.put(Statuses.IS_RETWEET, isRetweet);
    values.put(Statuses.IS_FAVORITE, status.isFavorited());
    final ParcelableMedia[] media = ParcelableMedia.fromEntities(status);
    if (media != null) {
        values.put(Statuses.MEDIA, JSONSerializer.toJSONArrayString(media));
        values.put(Statuses.FIRST_MEDIA, media[0].url);
    }
    final ParcelableUserMention[] mentions = ParcelableUserMention.fromStatus(status);
    if (mentions != null) {
        values.put(Statuses.MENTIONS, JSONSerializer.toJSONArrayString(mentions));
    }
    return values;
}

From source file:net.lacolaco.smileessence.activity.MainActivity.java

License:Open Source License

public void updateActionBarIcon() {
    Twitter twitter = new TwitterApi(currentAccount).getTwitter();
    final ImageView homeIcon = (ImageView) findViewById(android.R.id.home);
    ShowUserTask userTask = new ShowUserTask(twitter, currentAccount.userID) {
        @Override/*w  w  w . ja  va  2  s .  co m*/
        protected void onPostExecute(User user) {
            super.onPostExecute(user);
            if (user != null) {
                String urlHttps = user.getProfileImageURLHttps();
                homeIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
                new BitmapURLTask(urlHttps, homeIcon).execute();
            }
        }
    };
    userTask.execute();
}

From source file:net.lacolaco.smileessence.viewmodel.StatusViewModel.java

License:Open Source License

public StatusViewModel(Status status, Account account) {
    if (status.isRetweet()) {
        retweetedStatus = new StatusViewModel(status.getRetweetedStatus(), account);
    }/*ww  w  . ja  v  a 2  s  .c  o  m*/
    id = status.getId();
    text = TwitterUtils.replaceURLEntities(status.getText(), status.getURLEntities(), false);
    createdAt = status.getCreatedAt();
    source = status.getSource();
    mentions = status.getUserMentionEntities();
    hashtags = status.getHashtagEntities();
    media = status.getMediaEntities();
    urls = status.getURLEntities();
    symbols = status.getSymbolEntities();
    User user = status.getUser();
    UserCache.getInstance().put(user);
    userID = user.getId();
    screenName = user.getScreenName();
    name = user.getName();
    iconURL = user.getProfileImageURLHttps();
    isProtected = user.isProtected();
    setMention(isMention(account.screenName));
    setMyStatus(isMyStatus(account.userID));
    setRetweetOfMe(isRetweetOfMe(account.userID));
}

From source file:net.nitram509.controller.TwitterCallbackHttpController.java

License:Open Source License

private UserProfile retrieveUserProfileDetails(Twitter twitter, AccessToken accessToken)
        throws TwitterException {
    final long twitterId = twitter.getId();
    User twitterUser = twitter.users().showUser(twitterId);
    UserProfile userProfile = new UserProfile(new UserId(twitterId));
    userProfile.setName(twitterUser.getName());
    userProfile.setScreenName(twitterUser.getScreenName());
    userProfile.setProfileImageUrlHttps(twitterUser.getProfileImageURLHttps());
    userProfile.setProfileImageUrl(twitterUser.getProfileImageURL());
    userProfile.setUrl(twitterUser.getURL());
    userProfile.setAccessToken(accessToken.getToken());
    userProfile.setAccessTokenSecret(accessToken.getTokenSecret());
    return userProfile;
}