List of usage examples for twitter4j Twitter getUserListStatuses
ResponseList<Status> getUserListStatuses(long listId, Paging paging) throws TwitterException;
From source file:com.klinker.android.twitter.activities.drawer_activities.lists.ChoosenListActivity.java
License:Apache License
public void onRefreshStarted() { new Thread(new Runnable() { @Override/*from w w w . j av a 2 s.c o m*/ public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); paging.setPage(1); ResponseList<twitter4j.Status> lists = twitter.getUserListStatuses(listId, paging); statuses.clear(); for (Status status : lists) { statuses.add(status); } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { adapter = new TimelineArrayAdapter(context, statuses); listView.setAdapter(adapter); listView.setVisibility(View.VISIBLE); spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { mPullToRefreshLayout.setRefreshing(false); } }); } }).start(); }
From source file:com.klinker.android.twitter.activities.drawer_activities.lists.ChoosenListActivity.java
License:Apache License
public void getLists() { canRefresh = false;/*from w w w . j a v a 2 s.c o m*/ new Thread(new Runnable() { @Override public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); ResponseList<twitter4j.Status> lists = twitter.getUserListStatuses(listId, paging); paging.setPage(paging.getPage() + 1); for (Status status : lists) { statuses.add(status); } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (adapter == null) { adapter = new TimelineArrayAdapter(context, statuses); listView.setAdapter(adapter); listView.setVisibility(View.VISIBLE); } else { adapter.notifyDataSetChanged(); } spinner.setVisibility(View.GONE); canRefresh = true; } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { spinner.setVisibility(View.GONE); canRefresh = false; } }); } catch (OutOfMemoryError e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { spinner.setVisibility(View.GONE); canRefresh = false; } }); } } }).start(); }
From source file:de.vanita5.twittnuker.loader.support.UserListTimelineLoader.java
License:Open Source License
@Override protected ResponseList<Status> getStatuses(final Twitter twitter, final Paging paging) throws TwitterException { if (twitter == null) return null; if (mListId > 0) return twitter.getUserListStatuses(mListId, paging); else if (mListName == null) return null; else if (mUserId > 0) return twitter.getUserListStatuses(mListName.replace(' ', '-'), mUserId, paging); else if (mScreenName != null) return twitter.getUserListStatuses(mListName.replace(' ', '-'), mScreenName, paging); return null;//w w w . j av a 2 s . c o m }
From source file:examples.GetUserListStatuses.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserListStatuses [list id] * * @param args message/* w ww . j ava2s . co m*/ */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.GetUserListStatuses [list id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); Paging page = new Paging(1); ResponseList<Status> statuses; do { statuses = twitter.getUserListStatuses(Integer.parseInt(args[0]), page); for (Status status : statuses) { System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText()); } page.setPage(page.getPage() + 1); } while (statuses.size() > 0 && page.getPage() <= 10); System.out.println("done."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to list statuses: " + te.getMessage()); System.exit(-1); } }
From source file:org.examproject.tweet.service.SimpleTweetService.java
License:Apache License
private ResponseList<Status> getResponseList() { LOG.debug("called."); long cursol = -1; int listId = 0; int count = 50; int pageNumber = 1; Paging paging = new Paging(pageNumber, count); try {/* w ww .j a v a2 s . c o m*/ // TODO: polymorphism to here? -> plugin. // home if (paramValue.getResponseListMode().equals("home")) { Twitter twitter = getTwitter(); return twitter.getHomeTimeline(paging); } // user if (paramValue.getResponseListMode().equals("user")) { Twitter twitter = getTwitter(); return twitter.getUserTimeline(paging); } // list if (paramValue.getResponseListMode().equals("list")) { if (paramValue.getUserListName().length() != 0) { Twitter twitter = getTwitter(); PagableResponseList<UserList> lists = twitter.getUserLists(twitter.getScreenName(), cursol); for (UserList list : lists) { String listFullName = list.getFullName(); if (listFullName.equals(paramValue.getUserListName())) { listId = list.getId(); return twitter.getUserListStatuses(listId, paging); } } } } // default.. Twitter twitter = getTwitter(); return twitter.getHomeTimeline(); } catch (TwitterException te) { // TODO: transition to an error page here? throw new RuntimeException(te); } }
From source file:org.getlantern.firetweet.loader.support.UserListTimelineLoader.java
License:Open Source License
@NonNull @Override/* www . j ava2 s. com*/ protected ResponseList<Status> getStatuses(@NonNull final Twitter twitter, final Paging paging) throws TwitterException { if (mListId > 0) return twitter.getUserListStatuses(mListId, paging); else if (mListName == null) throw new TwitterException("No list name or id given"); else if (mUserId > 0) return twitter.getUserListStatuses(mListName.replace(' ', '-'), mUserId, paging); else if (mScreenName != null) return twitter.getUserListStatuses(mListName.replace(' ', '-'), mScreenName, paging); throw new TwitterException("User id or screen name is required for list name"); }
From source file:org.mariotaku.twidere.loader.ListTimelineLoader.java
License:Open Source License
@Override public ResponseList<Status> getStatuses(Paging paging) throws TwitterException { final Twitter twitter = getTwitter(); if (twitter == null) return null; if (mListId > 0) return twitter.getUserListStatuses(mListId, paging); else {/*from www.jav a 2 s . c o m*/ final UserList list = findUserList(twitter, mUserId, mScreenName, mListName); if (list != null && list.getId() > 0) return twitter.getUserListStatuses(list.getId(), paging); } return null; }