List of usage examples for twitter4j User getLang
String getLang();
From source file:aic2013.common.entities.TwitterUser.java
public TwitterUser(User user) { id = user.getId();//from ww w . jav a2 s . c o m name = user.getName(); screenName = user.getScreenName(); lang = user.getLang(); followersCount = user.getFollowersCount(); statusesCount = user.getStatusesCount(); friendsCount = user.getFriendsCount(); favouritesCount = user.getFavouritesCount(); listedCount = user.getListedCount(); }
From source file:aic2013.extractor.entities.TwitterUser.java
public TwitterUser(User user) { id = user.getId();//from www .j a v a2 s. c o m name = user.getName(); screenName = user.getScreenName(); language = user.getLang(); followersCount = user.getFollowersCount(); statusesCount = user.getStatusesCount(); friendsCount = user.getFriendsCount(); favouritesCount = user.getFavouritesCount(); listedCount = user.getListedCount(); }
From source file:au.net.moon.tUtils.TUser.java
License:Open Source License
/** * Create a user object from a twitter4j user. * /*from w w w. ja va 2s. c o m*/ * @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
/** * Creates an error message with user information for further analysis. * @param user The user whose information is to be represented. * @return The error message.//from www .j a v a 2 s . c o m */ private String getUserErrorString(User user) { StringBuffer sb = new StringBuffer(); sb.append("User information:\n"); sb.append(" id: " + user.getId() + "\n"); sb.append(" screen name: " + user.getScreenName() + "\n"); sb.append(" name: " + user.getName() + "\n"); sb.append(" description: " + user.getDescription() + "\n"); sb.append(" length: " + user.getDescription().length() + "\n"); sb.append(" elength: " + StringUtil.escapeNonAscii(user.getDescription()).length() + "\n"); sb.append(" language: " + user.getLang() + "\n"); sb.append(" location: " + user.getLocation()); return sb.toString(); }
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 * /* w w w . j a v 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.eventattend.portal.bl.TwitterBL.java
License:Open Source License
public TwitterDTO fetchProfile(User user, TwitterDTO twitterDTO) { System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); String userDesc = null;/* www .j a v a2 s. c o 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.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 ww w . j av a 2 s . c o 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);/* w w w .j av a 2 s .c om*/ } } struct.put("WithheldInCountries", withheldInCountries); }
From source file:com.klinker.android.twitter.utils.UpdateUtils.java
License:Apache License
public static void checkUpdate(final Context context) { final SharedPreferences sharedPrefs = context .getSharedPreferences("com.klinker.android.twitter_world_preferences", 0); if (sharedPrefs.getBoolean("3.1.5", true)) { sharedPrefs.edit().putBoolean("3.1.5", false).commit(); // want to make sure if tweetmarker was on, it remains on. if (sharedPrefs.getBoolean("tweetmarker", false)) { sharedPrefs.edit().putString("tweetmarker_options", "1").commit(); AppSettings.invalidate();//from w w w . ja va 2 s . c o m } } if (sharedPrefs.getBoolean("4.0.0", true)) { SharedPreferences.Editor e = sharedPrefs.edit(); e.putBoolean("4.0.0", false); // show them all for now Set<String> set = new HashSet<String>(); set.add("0"); // activity set.add("1"); // timeline set.add("2"); // mentions set.add("3"); // dm's set.add("4"); // discover set.add("5"); // lists set.add("6"); // favorite users set.add("7"); // retweets set.add("8"); // favorite Tweets set.add("9"); // saved searches e.putStringSet("drawer_elements_shown_1", set); e.putStringSet("drawer_elements_shown_2", set); // reset their pages to just home, String pageIdentifier = "account_" + 1 + "_page_"; e.putInt(pageIdentifier + 1, AppSettings.PAGE_TYPE_ACTIVITY); e.putInt(pageIdentifier + 2, AppSettings.PAGE_TYPE_HOME); e.putInt(pageIdentifier + 3, AppSettings.PAGE_TYPE_MENTIONS); e.putInt(pageIdentifier + 4, AppSettings.PAGE_TYPE_DMS); pageIdentifier = "account_" + 2 + "_page_"; e.putInt(pageIdentifier + 1, AppSettings.PAGE_TYPE_ACTIVITY); e.putInt(pageIdentifier + 2, AppSettings.PAGE_TYPE_HOME); e.putInt(pageIdentifier + 3, AppSettings.PAGE_TYPE_MENTIONS); e.putInt(pageIdentifier + 4, AppSettings.PAGE_TYPE_DMS); e.putInt("default_timeline_page_" + 1, 1); e.putInt("default_timeline_page_" + 2, 1); e.commit(); } if (!sharedPrefs.getBoolean("displayed_upgrade_message", false) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { sharedPrefs.edit().putBoolean("displayed_upgrade_message", true).commit(); new AlertDialog.Builder(context).setTitle("Love Talon?").setMessage( "Consider upgrading to the Material Design version of the app! All the latest design elements, in the same Twitter app you have come to enjoy every day.\n\n" + "This 'classic' version of the app will continue to receive all the new features that are possible, just without the visual updates.") .setPositiveButton("Upgrade", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new WebIntentBuilder(context).setShouldForceExternal(true).setUrl( "https://play.google.com/store/apps/details?id=com.klinker.android.twitter_l") .build().start(); } }).setNegativeButton("Learn More", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new WebIntentBuilder(context).setShouldForceExternal(true) .setUrl("https://plus.google.com/+LukeKlinker/posts/KG4AcH3YA2U").build() .start(); } }).create().show(); } if (sharedPrefs.getBoolean("need_translation_update", true)) { sharedPrefs.edit().putBoolean("need_translation_update", false).commit(); new Thread(new Runnable() { @Override public void run() { try { User user = Utils.getTwitter(context).verifyCredentials(); sharedPrefs.edit().putString("translate_url", Utils.getTranslateURL(user.getLang())) .commit(); } catch (Exception e) { } } }).start(); } }