List of usage examples for twitter4j User isVerified
boolean isVerified();
From source file:au.net.moon.tUtils.TUser.java
License:Open Source License
/** * Create a user object from a twitter4j user. * // w w w . ja v a 2s .c om * @param twitterUser * a twitter4j user object */ public TUser(twitter4j.User twitterUser) { id = twitterUser.getId(); name = twitterUser.getName(); screenName = twitterUser.getScreenName(); location = twitterUser.getLocation(); description = twitterUser.getDescription(); if (twitterUser.getProfileImageURL() != null) { profileImageUrl = twitterUser.getProfileImageURL().toString(); } else { profileImageUrl = ""; } if (twitterUser.getURL() != null) { url = twitterUser.getURL().toString(); } else { url = ""; } createdAt = twitterUser.getCreatedAt(); isProtected = twitterUser.isProtected(); followersCount = twitterUser.getFollowersCount(); // Not interested in users latest tweet, so just leave blank status = ""; profileBackgroundColor = twitterUser.getProfileBackgroundColor(); profileTextColor = twitterUser.getProfileTextColor(); profileLinkColor = twitterUser.getProfileLinkColor(); profileSidebarFillColor = twitterUser.getProfileSidebarFillColor(); profileSidebarBorderColor = twitterUser.getProfileSidebarBorderColor(); friendsCount = twitterUser.getFriendsCount(); favouritesCount = twitterUser.getFavouritesCount(); utcOffset = twitterUser.getUtcOffset(); timeZone = twitterUser.getTimeZone(); if (twitterUser.getOriginalProfileImageURL() != null) { profileBackgroundImageUrl = twitterUser.getOriginalProfileImageURL().toString(); } else { profileBackgroundImageUrl = ""; } isProfileBackgroundTiled = twitterUser.isProfileBackgroundTiled(); statusesCount = twitterUser.getStatusesCount(); isGeoEnabled = twitterUser.isGeoEnabled(); isVerified = twitterUser.isVerified(); // isFollowing = twitterUser.isFollowing(); isContributorsEnabled = twitterUser.isContributorsEnabled(); isProfileUseBackgroundImage = twitterUser.isProfileUseBackgroundImage(); isShowAllInLineMedia = twitterUser.isShowAllInlineMedia(); lang = twitterUser.getLang(); isTranslator = twitterUser.isTranslator(); listedCount = twitterUser.getListedCount(); isFollowRequestSent = twitterUser.isFollowRequestSent(); // TODO: Need to pass in the searchAPI id if I have it. searchAPI_userID = ""; }
From source file:br.com.porcelli.hornetq.integration.twitter.support.TweetMessageConverterSupport.java
License:Apache License
private static void buildUserData(final String prefix, final User user, ServerMessage msg) { msg.putStringProperty(prefix + TwitterConstants.KEY_USER_ID, read(user.getId())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_NAME, read(user.getName())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_SCREEN_NAME, read(user.getScreenName())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_LOCATION, read(user.getLocation())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_DESCRIPTION, read(user.getDescription())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_PROFILE_IMAGE_URL, read(user.getProfileImageURL())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_URL, read(user.getURL())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_LANG, read(user.getLang())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_PROTECTED, read(user.isProtected())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_FOLLOWERS_COUNT, read(user.getFollowersCount())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_FRIENDS_COUNT, read(user.getFriendsCount())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_CREATED_AT, read(user.getCreatedAt())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_FAVOURITES_COUNT, read(user.getFavouritesCount())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_UTC_OFFSET, read(user.getUtcOffset())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_TIME_ZONE, read(user.getTimeZone())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_STATUSES_COUNT, read(user.getStatusesCount())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_VERIFIED, read(user.isVerified())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_CONTRIBUTORS_ENABLED, read(user.isContributorsEnabled())); msg.putStringProperty(prefix + TwitterConstants.KEY_USER_GEO_ENABLED, read(user.isGeoEnabled())); }
From source file:com.daemon.database.Transactor.java
License:Open Source License
/** * Adds only the given User to the SQL.Batch which will be saved * in the DB by savedAllTweetsTransactionsafe * /*from w w w.j av a 2 s . c o m*/ * @param user The user to be saved. * @throws SQLException */ private void saveUser(User user) throws SQLException { prepStatementUser.setLong(1, user.getId()); prepStatementUser.setString(2, user.getName()); prepStatementUser.setString(3, user.getScreenName()); prepStatementUser.setString(4, user.getProfileImageURL()); prepStatementUser.setTimestamp(5, new java.sql.Timestamp(user.getCreatedAt().getTime())); prepStatementUser.setString(6, user.getLocation()); prepStatementUser.setString(7, user.getURL()); prepStatementUser.setString(8, user.getLang()); prepStatementUser.setInt(9, user.getFollowersCount()); prepStatementUser.setBoolean(10, user.isVerified()); prepStatementUser.setString(11, user.getTimeZone()); prepStatementUser.setString(12, user.getDescription()); prepStatementUser.setInt(13, user.getStatusesCount()); prepStatementUser.setInt(14, user.getFriendsCount()); prepStatementUser.addBatch(); }
From source file:com.dwdesign.tweetings.fragment.UserProfileFragment.java
License:Open Source License
public void changeUser(final long account_id, final User user) { mFriendship = null;//from www. j a v a2 s. co m mUserId = -1; mAccountId = -1; if (user == null || user.getId() <= 0 || getActivity() == null || !isMyActivatedAccount(getActivity(), account_id)) return; if (mUserInfoTask != null && mUserInfoTask.getStatus() == AsyncTask.Status.RUNNING) { mUserInfoTask.cancel(true); } final boolean is_my_activated_account = isMyActivatedAccount(getActivity(), user.getId()); mUserInfoTask = null; mErrorRetryContainer.setVisibility(View.GONE); mAccountId = account_id; mUserId = user.getId(); mScreenName = user.getScreenName(); updateUserColor(); final boolean is_multiple_account_enabled = getActivatedAccountIds(getActivity()).length > 1; mListView.setBackgroundResource(is_multiple_account_enabled ? R.drawable.ic_label_account_nopadding : 0); if (is_multiple_account_enabled) { final Drawable d = mListView.getBackground(); if (d != null) { d.mutate().setColorFilter(getAccountColor(getActivity(), account_id), PorterDuff.Mode.MULTIPLY); mListView.invalidate(); } } mNameView.setText(user.getName()); mScreenNameView.setText("@" + user.getScreenName()); mScreenNameView.setCompoundDrawablesWithIntrinsicBounds( getUserTypeIconRes(user.isVerified(), user.isProtected()), 0, 0, 0); final String description = user.getDescription(); mDescriptionContainer .setVisibility(is_my_activated_account || !isNullOrEmpty(description) ? View.VISIBLE : View.GONE); mDescriptionContainer.setOnLongClickListener(this); mDescriptionView.setText(description); final TwidereLinkify linkify = new TwidereLinkify(mDescriptionView); linkify.setOnLinkClickListener(this); linkify.addAllLinks(); mDescriptionView.setMovementMethod(LinkMovementMethod.getInstance()); final String location = user.getLocation(); mLocationContainer .setVisibility(is_my_activated_account || !isNullOrEmpty(location) ? View.VISIBLE : View.GONE); mLocationContainer.setOnLongClickListener(this); mLocationView.setText(location); final String url = user.getURL() != null ? user.getURL().toString() : null; mURLContainer.setVisibility(is_my_activated_account || !isNullOrEmpty(url) ? View.VISIBLE : View.GONE); mURLContainer.setOnLongClickListener(this); mURLView.setText(url); mCreatedAtView.setText(formatToLongTimeString(getActivity(), getTimestampFromDate(user.getCreatedAt()))); mTweetCount.setText(String.valueOf(user.getStatusesCount())); mFollowersCount.setText(String.valueOf(user.getFollowersCount())); mFriendsCount.setText(String.valueOf(user.getFriendsCount())); // final boolean display_profile_image = // mPreferences.getBoolean(PREFERENCE_KEY_DISPLAY_PROFILE_IMAGE, true); // mProfileImageView.setVisibility(display_profile_image ? View.VISIBLE // : View.GONE); // if (display_profile_image) { final String profile_image_url_string = parseString(user.getProfileImageURL()); final boolean hires_profile_image = getResources().getBoolean(R.bool.hires_profile_image); mLazyImageLoader.displayProfileImage(mProfileImageView, hires_profile_image ? getBiggerTwitterProfileImage(profile_image_url_string) : profile_image_url_string); // } String profile_banner_url_string = parseString(user.getProfileBannerImageUrl()); if (profile_banner_url_string != null) { final int def_width = getResources().getDisplayMetrics().widthPixels; profile_banner_url_string = profile_banner_url_string + "/" + getBestBannerType(def_width); } final String banner_url = profile_banner_url_string; if (mProfileBackgroundView != null) { mProfileBackgroundView.setScaleType(ImageView.ScaleType.CENTER_CROP); if (banner_url != null) { mLazyImageLoader.displayPreviewImage(mProfileBackgroundView, banner_url); } else { final Drawable d = getResources().getDrawable(R.drawable.linen); mProfileBackgroundView.setImageDrawable(d); } } mUser = user; if (isMyAccount(getActivity(), user.getId())) { final ContentResolver resolver = getContentResolver(); final ContentValues values = new ContentValues(); final URL profile_image_url = user.getProfileImageURL(); if (profile_image_url != null) { values.put(Accounts.PROFILE_IMAGE_URL, profile_image_url.toString()); } values.put(Accounts.USERNAME, user.getScreenName()); final String where = Accounts.USER_ID + " = " + user.getId() + " AND 1 = 1"; resolver.update(Accounts.CONTENT_URI, values, where, null); } mAdapter.add(new UserRecentPhotosAction()); mAdapter.add(new FavoritesAction()); mAdapter.add(new UserMentionsAction()); mAdapter.add(new UserListTypesAction()); if (user.getId() == mAccountId) { mAdapter.add(new MyTweetsRetweetedAction()); mAdapter.add(new SavedSearchesAction()); boolean nativeMapSupported = true; try { Class.forName("com.google.android.maps.MapActivity"); Class.forName("com.google.android.maps.MapView"); } catch (final ClassNotFoundException e) { nativeMapSupported = false; } if (nativeMapSupported) { mAdapter.add(new UserNearbyAction()); } if (user.isProtected()) { mAdapter.add(new IncomingFriendshipsAction()); } mAdapter.add(new UserBlocksAction()); } mAdapter.notifyDataSetChanged(); if (mRecentPhotosGallery != null) { mRecentPhotosGallery.setVisibility(View.GONE); mRecentPhotosGallery.setAdapter(new ImageAdapter(this.getActivity())); mRecentPhotosGallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { ParcelableStatus pStatus = mMediaStatuses.get(position); final ImageSpec spec = getAllAvailableImage(pStatus.image_orig_url_string); if (spec != null) { openImage(UserProfileFragment.this.getActivity(), Uri.parse(spec.full_image_link), pStatus.is_possibly_sensitive); } } }); mMediaTimelineTask = new MediaTimelineTask(this.getActivity(), mAccountId, mUser.getScreenName()); if (mMediaTimelineTask != null) { mMediaTimelineTask.execute(); } } getFriendship(); checkPushTracked(); }
From source file:com.dwdesign.tweetings.model.ParcelableStatus.java
License:Open Source License
public ParcelableStatus(Status status, final long account_id, final boolean is_gap, final boolean large_inline_image_preview) { this.is_gap = is_gap; this.account_id = account_id; status_id = status.getId();// w ww . ja va 2 s . c o m is_retweet = status.isRetweet(); final Status retweeted_status = is_retweet ? status.getRetweetedStatus() : null; final User retweet_user = retweeted_status != null ? status.getUser() : null; retweet_id = retweeted_status != null ? retweeted_status.getId() : -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; if (retweeted_status != null) { status = retweeted_status; } final User user = status.getUser(); user_id = user != null ? user.getId() : -1; name = user != null ? user.getName() : null; screen_name = user != null ? user.getScreenName() : null; profile_image_url = user != null ? user.getProfileImageURL() : null; profile_image_url_string = profile_image_url != null ? profile_image_url.toString() : null; is_protected = user != null ? user.isProtected() : false; is_verified = user != null ? user.isVerified() : false; final MediaEntity[] medias = status.getMediaEntities(); status_timestamp = getTime(status.getCreatedAt()); text_html = formatStatusText(status); final PreviewImage preview = getPreviewImage(text_html, large_inline_image_preview ? INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_LARGE_HIGH : INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_SMALL); text_plain = status.getText(); retweet_count = status.getRetweetCount(); in_reply_to_screen_name = status.getInReplyToScreenName(); in_reply_to_status_id = status.getInReplyToStatusId(); source = status.getSource(); location = new ParcelableLocation(status.getGeoLocation()); location_string = location.toString(); is_favorite = status.isFavorited(); has_media = medias != null && medias.length > 0 || preview.has_image; text = text_html != null ? Html.fromHtml(text_html) : null; image_preview_url_string = preview.matched_url; image_orig_url_string = preview.orig_url; image_preview_url = parseURL(image_preview_url_string); text_unescaped = unescape(text_html); String play = null; URLEntity[] urls = status.getURLEntities(); if (urls != null) { for (final URLEntity url : urls) { final URL tco_url = url.getURL(); final URL expanded_url = url.getExpandedURL(); if (tco_url != null && expanded_url != null && expanded_url.toString().contains("play.google.com/store/apps")) { play = expanded_url.toString(); break; } } } play_package = play; is_possibly_sensitive = status.isPossiblySensitive(); }
From source file:com.dwdesign.tweetings.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; user_id = user.getId();/*w w w.j a v a 2 s . c o m*/ created_at = getTime(user.getCreatedAt()); is_protected = user.isProtected(); is_verified = user.isVerified(); name = user.getName(); screen_name = user.getScreenName(); description = user.getDescription(); location = user.getLocation(); profile_image_url = user.getProfileImageURL(); profile_image_url_string = parseString(profile_image_url); }
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. j a va 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.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 w w . j a v a 2 s . c om*/ 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)); }// w w w .j a va 2s.c o m } } 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(); }
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 va2 s . c o 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()); } }