List of usage examples for twitter4j User getScreenName
String getScreenName();
From source file:com.dwdesign.tweetings.util.Utils.java
License:Open Source License
public static ContentValues makeDirectMessageContentValues(final DirectMessage message, final long account_id) { 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; 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()); values.put(DirectMessages.TEXT, message.getText()); 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()); final URL sender_profile_image_url = sender.getProfileImageURL(); final URL recipient_profile_image_url = recipient.getProfileImageURL(); if (sender_profile_image_url != null) { values.put(DirectMessages.SENDER_PROFILE_IMAGE_URL, sender_profile_image_url.toString()); }/* ww w. j a v a 2 s . c o m*/ if (recipient_profile_image_url != null) { values.put(DirectMessages.RECIPIENT_PROFILE_IMAGE_URL, recipient_profile_image_url.toString()); } return values; }
From source file:com.dwdesign.tweetings.util.Utils.java
License:Open Source License
public static ContentValues makeStatusContentValues(Status status, final long account_id) { if (status == null || status.getId() <= 0) return null; final ContentValues values = new ContentValues(); values.put(Statuses.ACCOUNT_ID, account_id); values.put(Statuses.STATUS_ID, status.getId()); final boolean is_retweet = status.isRetweet(); final Status retweeted_status = is_retweet ? status.getRetweetedStatus() : null; if (retweeted_status != null) { final User retweet_user = status.getUser(); values.put(Statuses.RETWEET_ID, retweeted_status.getId()); values.put(Statuses.RETWEETED_BY_ID, retweet_user.getId()); values.put(Statuses.RETWEETED_BY_NAME, retweet_user.getName()); values.put(Statuses.RETWEETED_BY_SCREEN_NAME, retweet_user.getScreenName()); status = retweeted_status;/*from w w w .jav a 2 s. c o m*/ } final User user = status.getUser(); if (user != null) { final long user_id = user.getId(); final String profile_image_url = user.getProfileImageURL().toString(); final String name = user.getName(), screen_name = user.getScreenName(); values.put(Statuses.USER_ID, user_id); values.put(Statuses.NAME, name); values.put(Statuses.SCREEN_NAME, screen_name); values.put(Statuses.IS_PROTECTED, user.isProtected() ? 1 : 0); values.put(Statuses.IS_VERIFIED, user.isVerified() ? 1 : 0); values.put(Statuses.PROFILE_IMAGE_URL, profile_image_url); } if (status.getCreatedAt() != null) { values.put(Statuses.STATUS_TIMESTAMP, status.getCreatedAt().getTime()); } values.put(Statuses.TEXT, formatStatusText(status)); values.put(Statuses.TEXT_PLAIN, status.getText()); values.put(Statuses.RETWEET_COUNT, status.getRetweetCount()); values.put(Statuses.IN_REPLY_TO_SCREEN_NAME, status.getInReplyToScreenName()); values.put(Statuses.IN_REPLY_TO_STATUS_ID, status.getInReplyToStatusId()); 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, is_retweet ? 1 : 0); values.put(Statuses.IS_FAVORITE, status.isFavorited() ? 1 : 0); return values; }
From source file:com.eventattend.portal.bl.TwitterBL.java
License:Open Source License
public TwitterDTO fetchProfile(User user, TwitterDTO twitterDTO) { System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); String userDesc = null;/*w w w .j a v a 2s . co m*/ String favCount = null; String followCount = null; String friendsCount = null; String location = null; String name = null; String profImgUrl = null; String personalUrl = null; String twitterURL = "http://twitter.com/" + user.getScreenName(); userDesc = user.getDescription(); favCount = String.valueOf(user.getFavouritesCount()); followCount = String.valueOf(user.getFollowersCount()); friendsCount = String.valueOf(user.getFriendsCount()); location = user.getLocation(); name = user.getName(); profImgUrl = String.valueOf(user.getProfileImageURL()); // System.out.println("User ID >> "+user.getId()); //System.out.println("TwitterA/C CreatedAt >> "+user.getCreatedAt()); System.out.println("Description >> " + user.getDescription()); System.out.println("FavouritesCount >> " + user.getFavouritesCount()); System.out.println("FollowersCoun >> " + user.getFollowersCount()); System.out.println("FriendsCount >> " + user.getFriendsCount()); System.out.println("Language >> " + user.getLang()); System.out.println("Location >> " + user.getLocation()); System.out.println("Name >> " + user.getName()); System.out.println("ProfileImageURL >> " + user.getProfileImageURL()); System.out.println("Total tweets >> " + user.getStatusesCount()); if (twitterURL != null) { twitterDTO.setUserURL(twitterURL); System.out.println("Twitter URL >> " + twitterURL); } if (userDesc != null && (!userDesc.equals(""))) { twitterDTO.setUserDesc(userDesc); } else { twitterDTO.setUserDesc(null); } if (favCount != null) { twitterDTO.setUserFavCount(favCount); } if (followCount != null) { twitterDTO.setFollowersCount(followCount); } if (friendsCount != null) { twitterDTO.setFriendsCount(friendsCount); } if (location != null) { twitterDTO.setUserLocation(location); } if (name != null) { twitterDTO.setUserName(name); } if (profImgUrl != null) { twitterDTO.setUserImg(profImgUrl); } if (user.getURL() != null) { if (!user.getURL().equals(twitterURL)) { personalUrl = String.valueOf(user.getURL()); System.out.println("Personal URL >> " + user.getURL()); twitterDTO.setPersonalUrl(personalUrl); } } // Status status=user.getStatus(); // System.out.println("Latest Tweet >> TweetId "+status.getId()+"|Tweet> "+status.getText()+" |via> "+status.getSource() // +"|Loc >"+status.getGeoLocation()+"|tweetTime >"+status.getCreatedAt()+"Place Details we can get >"+status.getPlace()); /*System.out.println("RateLimitStatus >> "+user.getRateLimitStatus()); System.out.println("ProfileBackgroundColor >> "+user.getProfileBackgroundColor()); System.out.println("ProfileBackgroundImageUrl >> "+user.getProfileBackgroundImageUrl()); System.out.println("ProfileLinkColor >> "+user.getProfileLinkColor()); System.out.println("ProfileSidebarBorderColor >> "+user.getProfileSidebarBorderColor()); System.out.println("user.getProfileSidebarFillColor() >> "+user.getProfileSidebarFillColor()); System.out.println("ProfileTextColor >> "+user.getProfileTextColor());*/ return twitterDTO; }
From source file:com.eventattend.portal.bl.TwitterBL.java
License:Open Source License
public String getTwitterId(AccessToken accessToken) throws BaseAppException { String twitterId = null;/*from w w w . ja v a 2 s .c o m*/ User user = null; try { twitter.setOAuthAccessToken(accessToken); user = twitter.verifyCredentials(); twitterId = user.getScreenName(); } catch (TwitterException e) { processTwitterException(e); } return twitterId; }
From source file:com.eventattend.portal.bl.TwitterBL.java
License:Open Source License
public String getPublicProfile(AccessToken accessToken) throws BaseAppException { String profileURL = null;//from ww w. j av a2s .c om User user = null; try { twitter.setOAuthAccessToken(accessToken); user = twitter.verifyCredentials(); profileURL = "http://www.twitter.com/" + user.getScreenName(); } catch (TwitterException e) { processTwitterException(e); } return profileURL; }
From source file:com.eventattend.portal.bl.TwitterBL.java
License:Open Source License
public List tweets(Twitter twitter, String screenName, TwitterDTO twitterDTO) throws BaseAppException { List tweetList = new ArrayList(); List<Status> statuses = null; Paging paging = new Paging(1, 10); try {/*from w w w.j av a 2 s .c om*/ statuses = twitter.getUserTimeline(screenName, paging); } catch (TwitterException e) { processTwitterException(e); } int i = 1; if (!statuses.isEmpty()) { for (Status status : statuses) { if (i <= 10) { User user = status.getUser(); twitterDTO = new TwitterDTO(); // // if(userId==status.getUser().getId()){ if (status.getId() != 0) { System.out.println(i + "TweetId=> " + status.getId()); twitterDTO.setTweetId(String.valueOf(status.getId())); } if (user.getProfileImageURL() != null) { twitterDTO.setUserImg(user.getProfileImageURL().toString()); } if (user.getScreenName() != null) { twitterDTO.setUserScreeName("http://twitter.com/" + user.getScreenName()); } if (user.getName() != null) { twitterDTO.setUserName(user.getName()); } if (status.getText() != null) { twitterDTO.setTweet(status.getText()); } System.out.println(status.getId() + " : " + status.getCreatedAt() + " >> " + status.getText()); tweetList.add(twitterDTO); i++; } else { break; } } } return tweetList; }
From source file:com.freshdigitable.udonroad.CombinedScreenNameTextView.java
License:Apache License
public void setNames(User user) { final String name = user.getName(); final String screenName = user.getScreenName(); if (this.name != null && this.name.equals(name) && this.screenName != null && this.screenName.equals(screenName)) { return;// ww w.j av a2 s.co m } final String formatted = name + (TextViewCompat.getMaxLines(this) == 2 ? "\n" : " ") + "@" + screenName; final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(formatted); spannableStringBuilder.setSpan(STYLE_BOLD, 0, name.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); setText(spannableStringBuilder); this.name = name; this.screenName = screenName; }
From source file:com.freshdigitable.udonroad.FullStatusView.java
License:Apache License
private void bindRtUser(User user) { setRetweetedUserVisibility(VISIBLE); final String formattedRtUser = formatString(R.string.tweet_retweeting_user, user.getScreenName()); rtUser.setText(formattedRtUser);// ww w . j a va 2 s. co m }
From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java
License:Apache License
UserRealm(final User user) { this.id = user.getId(); this.profileImageURLHttps = user.getProfileImageURLHttps(); this.miniProfileImageURLHttps = user.getMiniProfileImageURLHttps(); this.name = user.getName(); this.screenName = user.getScreenName(); this.description = user.getDescription(); this.profileBannerMobileURL = user.getProfileBannerMobileURL(); this.statusesCount = user.getStatusesCount(); this.followersCount = user.getFollowersCount(); this.friendsCount = user.getFriendsCount(); this.favoritesCount = user.getFavouritesCount(); this.profileLinkColor = user.getProfileLinkColor(); this.descriptionURLEntities = URLEntityRealm.createList(user.getDescriptionURLEntities()); this.url = user.getURL(); if (user.getURLEntity() != null) { this.urlEntity = new URLEntityRealm(user.getURLEntity()); }//from w ww . j a v a 2s.com this.location = user.getLocation(); this.verified = user.isVerified(); this.isProtected = user.isProtected(); }
From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java
License:Apache License
void merge(@NonNull User u, @NonNull Realm realm) { if (u.getDescription() != null) { // description is nullable this.description = u.getDescription(); final URLEntity[] descriptionURLEntities = u.getDescriptionURLEntities(); if (descriptionURLEntities != null && descriptionURLEntities.length > 0) { this.descriptionURLEntities.clear(); for (URLEntity url : descriptionURLEntities) { this.descriptionURLEntities.add(URLEntityRealm.findOrCreateFromRealm(url, realm)); }/*from w w w. j a v a2 s. c om*/ } } this.favoritesCount = u.getFavouritesCount(); this.followersCount = u.getFollowersCount(); this.friendsCount = u.getFriendsCount(); this.miniProfileImageURLHttps = u.getMiniProfileImageURLHttps(); this.name = u.getName(); this.profileBannerMobileURL = u.getProfileBannerMobileURL(); this.profileImageURLHttps = u.getProfileImageURLHttps(); this.profileLinkColor = u.getProfileLinkColor(); this.screenName = u.getScreenName(); this.statusesCount = u.getStatusesCount(); this.url = u.getURL(); final URLEntity urlEntity = u.getURLEntity(); if (urlEntity != null && isNewUrlEntity(urlEntity)) { this.urlEntity = URLEntityRealm.findOrCreateFromRealm(urlEntity, realm); } this.location = u.getLocation(); this.verified = u.isVerified(); this.isProtected = u.isProtected(); }