List of usage examples for twitter4j User getScreenName
String getScreenName();
From source file:com.tweetmyhome.TweetMyHome.java
@Override public void onBlock(User source, User blockedUser) { debug("onBlock source:@" + source.getScreenName() + " target:@" + blockedUser.getScreenName()); }
From source file:com.tweetmyhome.TweetMyHome.java
@Override public void onUnblock(User source, User unblockedUser) { debug("onUnblock source:@" + source.getScreenName() + " target:@" + unblockedUser.getScreenName()); }
From source file:com.twitstreet.db.data.Stock.java
License:Open Source License
public Stock(twitter4j.User twUser) { this.setId(twUser.getId()); this.setLongName(twUser.getName()); this.setName(twUser.getScreenName()); this.setTotal(twUser.getFollowersCount()); this.setPictureUrl(twUser.getProfileImageURL().toExternalForm()); this.setSold(0.0D); this.setVerified(twUser.isVerified()); this.setLanguage(twUser.getLang()); this.setCreatedAt(twUser.getCreatedAt()); this.setLocation(twUser.getLocation()); this.setDescription(twUser.getDescription()); }
From source file:com.twitstreet.twitter.SimpleTwitterUser.java
License:Open Source License
public SimpleTwitterUser(User user) { this.id = user.getId(); this.screenName = user.getScreenName(); this.pictureUrl = user.getProfileImageURL().toExternalForm(); this.followerCount = user.getFollowersCount(); this.verified = user.isVerified(); }
From source file:com.twitt4droid.data.dao.impl.sqlite.UserSQLiteDAO.java
License:Apache License
/** {@inheritDoc} */ @Override/*from w w w. j a va2 s . c o m*/ public void save(User user) { getSQLiteTemplate().execute(getSqlString(R.string.twitt4droid_insert_user_sql), new String[] { Objects.toString(user.getId()), user.getName(), user.getScreenName(), user.getProfileImageURL(), user.getProfileBannerURL(), user.getURL(), user.getDescription(), user.getLocation() }); }
From source file:com.twitt4droid.widget.TweetDialog.java
License:Apache License
/** * Sets up the authenticated user.//www . j ava2 s .com * * @param user the authenticated user. */ private void setUpUser(User user) { userUsername.setText(getContext().getString(R.string.twitt4droid_username_format, user.getScreenName())); userScreenName.setText(user.getName()); new ImageLoader(getContext()).setImageView(userProfileImage).execute(user.getProfileImageURL()); }
From source file:com.vodafone.twitter.service.TwitterService.java
License:Apache License
private boolean processStatus(Status status) { if (msgWithSameId(status.getId()) != null) { if (Config.LOGD) Log.i(LOGTAG, "processStatus() found msgWithSameId " + status.getId() + " - don't process"); return false; }/* ww w .j av a 2 s . c o m*/ boolean newMsgReceived = false; User user = status.getUser(); String channelImageString = null; try { java.net.URI uri = user.getProfileImageURL().toURI(); channelImageString = uri.toString(); } catch (java.net.URISyntaxException uriex) { Log.e(LOGTAG, String.format("ConnectThread processStatus() URISyntaxException %s ex=%s", user.getProfileImageURL().toString(), uriex)); errMsg = uriex.getMessage(); } String title = status.getText(); if (linkifyMessages) { title = linkify(title, null, true); // messageLink will contain the link-url } long timeMs = status.getCreatedAt().getTime(); // make timeMs unique in our messageList while (findIdxOfMsgWithSameTimeMs(timeMs) >= 0) timeMs++; EntryTopic feedEntry = new EntryTopic(0, 0, user.getName(), title, null, messageLink, timeMs, status.getId(), channelImageString); feedEntry.shortName = user.getScreenName(); synchronized (messageList) { // messageList is always sorted with the newest items on top int findIdxOfFirstOlder = findIdxOfFirstOlderMsg(feedEntry); if (findIdxOfFirstOlder < maxQueueMessages) { messageList.add(findIdxOfFirstOlder, feedEntry); newMsgReceived = true; totalNumberOfQueuedMessages++; if (activityPaused) numberOfQueuedMessagesSinceLastClientActivity++; // debug: for every regular msg, create 5 additional dummy messages //for(int i=1; i<=5; i++) { // feedEntry = new EntryTopic(0, // region // 0, // prio // "dummy", // "test message "+i, // null, // description // messageLink, // timeMs+i*100, // status.getId()+i, // todo: make sure the id was ot yet stored in messageList // channelImageString); // todo: must make use of this in MyWebView/JsObject/script.js // messageList.add(findIdxOfFirstOlder,feedEntry); // totalNumberOfQueuedMessages++; // if(activityPaused) // numberOfQueuedMessagesSinceLastClientActivity++; //} // if there are now more than 'maxQueueMessages' entrys in the queue, remove the oldest... while (messageList.size() > maxQueueMessages) messageList.removeLast(); } else { if (Config.LOGD) Log.i(LOGTAG, "processStatus() not findIdxOfFirstOlder<maxQueueMessages - don't process"); } } return newMsgReceived; }
From source file:com.yoshio3.javaee7.sampleapp.TwitterStreamImpl.java
@Override public void onStatus(Status status) { try {// w w w . j a v a2s . c om //Twitter ???????? User user = status.getUser(); String resStr = "@" + user.getScreenName() + " : " + status.getText(); String encodedString = encode(resStr); session.getBasicRemote().sendText(encodedString); System.out.println(encodedString); } catch (IOException ex) { Logger.getLogger(TwitterStreamImpl.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:d3V.GetFriendsIDs.java
License:Apache License
/** * Usage: java twitter4j.examples.friendsandfollowers.GetFollowersIDs [screen name] * * @param args message//from w w w . ja v a2s. c o m */ public static void main(String[] args) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("Em3WTI7jc90HcvKzPkTLQ") .setOAuthConsumerSecret("vg4p6rOF32bmffqRR8m0jAUClrxvtGiMB5PrSr3Zsw") .setOAuthAccessToken("1681973072-1q0zI0VPjHD3ttNuaBOL94frzCI9sXInxAcDK0w") .setOAuthAccessTokenSecret("ZRLkOyjmhHBkU1iNyEVNyIgIBsKrl0DUDKOcOMneYFYEM"); cb.setJSONStoreEnabled(true); TwitterFactory tf = new TwitterFactory(cb.build()); try { String core_user = "nytimes"; FileWriter writer = new FileWriter(core_user + "_friends.txt", true); Twitter twitter = tf.getInstance(); long cursor = -1; ArrayList<String> directFriends = new ArrayList<String>(); PagableResponseList<User> tempFriends = null; System.out.println("Listing " + core_user + " friends's ScreenNames."); int count = 0; //boolean first = true; //getFriends(writer, twitter, cursor, count, core_user); do { tempFriends = twitter.getFriendsList(core_user, cursor); for (User user : tempFriends) { directFriends.add(user.getScreenName()); writer.write(core_user + "\t" + user.getScreenName() + "\n"); } count += tempFriends.size(); System.out.println(core_user + ": " + count); if (count >= 100) break; Thread.sleep(300 * MILLISECOND); } while ((cursor = tempFriends.getNextCursor()) != 0); System.out.println("Size of DFs: " + directFriends.size()); // for (String user : directFriends){ for (int i = 0; i < directFriends.size(); i++) { // PagableResponseList<User> idrfriends = null; long _cursor = -1; int _count = 0; String _username = directFriends.get(i); System.out.println("\nFriends of Direct friend: " + _username + "(" + (i + 1) + ")"); try { getFriends(writer, twitter, _cursor, _count, _username); } catch (TwitterException e) { e.printStackTrace(); System.out.println("Failed to get friends' ids: " + e.getMessage()); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } writer.close(); System.out.println(count); System.exit(0); } catch (TwitterException e) { e.printStackTrace(); System.out.println("Failed to get friends' ids: " + e.getMessage()); System.exit(-1); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:d3V.GetFriendsIDs.java
License:Apache License
public static void getFriends(FileWriter writer, Twitter twitter, long _cursor, int _count, String _username) throws TwitterException, IOException, InterruptedException { PagableResponseList<User> idrfriends; do {/*from ww w. jav a 2 s . com*/ idrfriends = twitter.getFriendsList(_username, _cursor); for (User _user : idrfriends) { writer.write(_username + "\t" + _user.getScreenName() + "\n"); } _count += idrfriends.size(); System.out.println(_username + ": " + _count); if (_count >= 40) break; Thread.sleep(300 * MILLISECOND); } while ((_cursor = idrfriends.getNextCursor()) != 0); }