List of usage examples for twitter4j User getName
String getName();
From source file:de.hoesel.dav.buv.twitter.preferences.TwitterPreferencePage.java
License:Open Source License
private void invalidateTwitterAuthentication(Composite parent, User user) { Label userLabel = new Label(parent, SWT.NONE); userLabel.setText("Aktueller Twitter Account: " + user.getName()); Browser browser = new Browser(parent, SWT.NONE); browser.setJavascriptEnabled(true);/*from www . j a va 2 s . c o m*/ browser.setUrl(user.getBiggerProfileImageURLHttps()); GridDataFactory.fillDefaults().grab(true, true).applyTo(browser); Button invalidateAuth = new Button(parent, SWT.PUSH); invalidateAuth.setText("Twitter Authentifikation widerrufen."); invalidateAuth.addSelectionListener(new SelectionAdapter() { private RahmenwerkService service; @Override public void widgetSelected(SelectionEvent e) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setValue(PreferenceConstants.OAUTH_ACCESS_TOKEN, ""); store.setValue(PreferenceConstants.OAUTH_ACCESS_SECRET_TOKEN, ""); service = RahmenwerkService.getService(); service.shutdownTwitter(); twitter = null; super.widgetSelected(e); } }); }
From source file:de.jetwick.data.JUser.java
License:Apache License
/** * This method refreshes the properties of this user by the specified * Twitter4j user/*w w w. j av a2 s . c om*/ * @param user */ public Status updateFieldsBy(User user) { twitterId = user.getId(); setProtected(user.isProtected()); setTwitterCreatedAt(user.getCreatedAt()); setDescription(user.getDescription()); addLanguage(user.getLang()); setLocation(TwitterSearch.toStandardLocation(user.getLocation())); setRealName(user.getName()); // user.getFollowersCount(); // user.getFriendsCount(); // user.getTimeZone() if (user.getProfileImageURL() != null) setProfileImageUrl(user.getProfileImageURL().toString()); if (user.getURL() != null) setWebUrl(user.getURL().toString()); setFollowersCount(user.getFollowersCount()); setFriendsCount(user.getFriendsCount()); return user.getStatus(); }
From source file:de.vanita5.twittnuker.model.ParcelableDirectMessage.java
License:Open Source License
public ParcelableDirectMessage(final DirectMessage message, final long account_id, final boolean is_outgoing) { this.account_id = account_id; this.is_outgoing = is_outgoing; final User sender = message.getSender(), recipient = message.getRecipient(); final String sender_profile_image_url_string = sender != null ? ParseUtils.parseString(sender.getProfileImageUrlHttps()) : null;//from w w w. j ava 2s. c om final String recipient_profile_image_url_string = recipient != null ? ParseUtils.parseString(recipient.getProfileImageUrlHttps()) : null; id = message.getId(); timestamp = getTime(message.getCreatedAt()); sender_id = sender != null ? sender.getId() : -1; recipient_id = recipient != null ? recipient.getId() : -1; text_html = formatDirectMessageText(message); text_plain = message.getText(); sender_name = sender != null ? sender.getName() : null; recipient_name = recipient != null ? recipient.getName() : null; sender_screen_name = sender != null ? sender.getScreenName() : null; recipient_screen_name = recipient != null ? recipient.getScreenName() : null; sender_profile_image_url = sender_profile_image_url_string; recipient_profile_image_url = recipient_profile_image_url_string; text_unescaped = toPlainText(text_html); medias = ParcelableMedia.fromEntities(message); first_media = medias != null && medias.length > 0 ? medias[0].url : null; }
From source file:de.vanita5.twittnuker.model.ParcelableStatus.java
License:Open Source License
public ParcelableStatus(final Status orig, final long account_id, final boolean is_gap) { this.is_gap = is_gap; this.account_id = account_id; id = orig.getId();//from w w w. j a v a 2s .co m timestamp = getTime(orig.getCreatedAt()); is_retweet = orig.isRetweet(); final Status retweeted = orig.getRetweetedStatus(); final User retweet_user = retweeted != null ? orig.getUser() : null; retweet_id = retweeted != null ? retweeted.getId() : -1; //NOTE getTime(orig.getCreatedAt()) retweet_timestamp = retweeted != null ? getTime(retweeted.getCreatedAt()) : -1; retweeted_by_id = retweet_user != null ? retweet_user.getId() : -1; retweeted_by_name = retweet_user != null ? retweet_user.getName() : null; retweeted_by_screen_name = retweet_user != null ? retweet_user.getScreenName() : null; retweeted_by_profile_image = retweet_user != null ? ParseUtils.parseString(retweet_user.getProfileImageUrlHttps()) : null; final Status status = retweeted != null ? retweeted : orig; final User user = status.getUser(); user_id = user.getId(); user_name = user.getName(); user_screen_name = user.getScreenName(); user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps()); user_is_protected = user.isProtected(); user_is_verified = user.isVerified(); user_is_following = user.isFollowing(); text_html = formatStatusText(status); media = ParcelableMedia.fromEntities(status); text_plain = status.getText(); retweet_count = status.getRetweetCount(); favorite_count = status.getFavoriteCount(); reply_count = status.getReplyCount(); descendent_reply_count = status.getDescendentReplyCount(); in_reply_to_name = getInReplyToName(status); in_reply_to_screen_name = status.getInReplyToScreenName(); in_reply_to_status_id = status.getInReplyToStatusId(); in_reply_to_user_id = status.getInReplyToUserId(); source = status.getSource(); location = new ParcelableLocation(status.getGeoLocation()); is_favorite = status.isFavorited(); text_unescaped = toPlainText(text_html); my_retweet_id = retweeted_by_id == account_id ? id : -1; is_possibly_sensitive = status.isPossiblySensitive(); mentions = ParcelableUserMention.fromUserMentionEntities(status.getUserMentionEntities()); first_media = media != null && media.length > 0 ? media[0].url : null; }
From source file:de.vanita5.twittnuker.model.ParcelableUser.java
License:Open Source License
public ParcelableUser(final User user, final long account_id, final long position) { this.position = position; this.account_id = account_id; final URLEntity[] urls_url_entities = user.getURLEntities(); id = user.getId();/*from ww w .j av a 2s. c om*/ created_at = getTime(user.getCreatedAt()); is_protected = user.isProtected(); is_verified = user.isVerified(); name = user.getName(); screen_name = user.getScreenName(); description_plain = user.getDescription(); description_html = formatUserDescription(user); description_expanded = formatExpandedUserDescription(user); location = user.getLocation(); profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps()); profile_banner_url = user.getProfileBannerImageUrl(); url = ParseUtils.parseString(user.getURL()); url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0 ? ParseUtils.parseString(urls_url_entities[0].getExpandedURL()) : null; is_follow_request_sent = user.isFollowRequestSent(); followers_count = user.getFollowersCount(); friends_count = user.getFriendsCount(); statuses_count = user.getStatusesCount(); favorites_count = user.getFavouritesCount(); listed_count = user.getListedCount(); is_cache = false; is_following = user.isFollowing(); description_unescaped = toPlainText(description_html); }
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 .j av a 2 s . co 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.task.CacheUsersStatusesTask.java
License:Open Source License
@Override protected Void doInBackground(final Void... args) { if (all_statuses == null || all_statuses.length == 0) return null; final Extractor extractor = new Extractor(); final Set<ContentValues> cachedUsersValues = new HashSet<ContentValues>(); final Set<ContentValues> cached_statuses_values = new HashSet<ContentValues>(); final Set<ContentValues> hashtag_values = new HashSet<ContentValues>(); final Set<Long> userIds = new HashSet<Long>(); final Set<Long> status_ids = new HashSet<Long>(); final Set<String> hashtags = new HashSet<String>(); final Set<User> users = new HashSet<User>(); for (final TwitterListResponse<twitter4j.Status> values : all_statuses) { if (values == null || values.list == null) { continue; }//from w w w. ja va2 s. c o m final List<twitter4j.Status> list = values.list; for (final twitter4j.Status status : list) { if (status == null || status.getId() <= 0) { continue; } status_ids.add(status.getId()); cached_statuses_values.add(makeStatusContentValues(status, values.account_id)); hashtags.addAll(extractor.extractHashtags(status.getText())); final User user = status.getUser(); if (user != null && user.getId() > 0) { users.add(user); final ContentValues filtered_users_values = new ContentValues(); filtered_users_values.put(Filters.Users.NAME, user.getName()); filtered_users_values.put(Filters.Users.SCREEN_NAME, user.getScreenName()); final String filtered_users_where = Where.equals(Filters.Users.USER_ID, user.getId()).getSQL(); resolver.update(Filters.Users.CONTENT_URI, filtered_users_values, filtered_users_where, null); } } } bulkDelete(resolver, CachedStatuses.CONTENT_URI, CachedStatuses.STATUS_ID, status_ids, null, false); bulkInsert(resolver, CachedStatuses.CONTENT_URI, cached_statuses_values); for (final String hashtag : hashtags) { final ContentValues hashtag_value = new ContentValues(); hashtag_value.put(CachedHashtags.NAME, hashtag); hashtag_values.add(hashtag_value); } bulkDelete(resolver, CachedHashtags.CONTENT_URI, CachedHashtags.NAME, hashtags, null, true); bulkInsert(resolver, CachedHashtags.CONTENT_URI, hashtag_values); for (final User user : users) { userIds.add(user.getId()); cachedUsersValues.add(makeCachedUserContentValues(user)); } bulkDelete(resolver, CachedUsers.CONTENT_URI, CachedUsers.USER_ID, userIds, null, false); bulkInsert(resolver, CachedUsers.CONTENT_URI, cachedUsersValues); return null; }
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 a v a 2 s . com*/ 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);//from w w w .ja va 2 s .c om 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);/* w ww. j a v a 2 s . co m*/ values.put(Accounts.IS_ACTIVATED, 1); values.put(Accounts.API_URL_FORMAT, apiUrlFormat); values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix); return values; }