Example usage for twitter4j Paging getMaxId

List of usage examples for twitter4j Paging getMaxId

Introduction

In this page you can find the example usage for twitter4j Paging getMaxId.

Prototype

public long getMaxId() 

Source Link

Usage

From source file:com.dwdesign.tweetings.loader.TweetSearchLoader.java

License:Open Source License

@Override
public List<Status> getStatuses(final Paging paging) throws TwitterException {
    if (mTwitter == null)
        return null;
    final Query query = new Query(mQuery);
    query.setRpp(paging.getCount());//from  w  w w.  j a  va  2 s .  co  m
    if (paging.getMaxId() > 0) {
        query.setMaxId(paging.getMaxId());
    }
    return Arrays.asList(mTwitter.search(query).getStatuses());
}

From source file:com.freshdigitable.udonroad.UserInfoPagerFragment.java

License:Apache License

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    final UserPageInfo reqPage = UserPageInfo.findByRequestCode(requestCode);
    if (reqPage == null) {
        super.onActivityResult(requestCode, resultCode, data);
        return;//  ww  w .ja  v a 2s . co m
    }
    final long userId = getArguments().getLong(ARGS_USER_ID);
    final Paging paging = (Paging) data.getSerializableExtra(TimelineFragment.EXTRA_PAGING);
    if (reqPage.isStatus()) {
        final StatusRequestWorker<SortedCache<Status>> statusRequestWorker = timelineSubscriberMap.get(reqPage);
        if (reqPage == UserPageInfo.TWEET) {
            statusRequestWorker.fetchHomeTimeline(userId, paging);
        } else if (reqPage == UserPageInfo.FAV) {
            statusRequestWorker.fetchFavorites(userId, paging);
        }
    } else if (reqPage.isUser()) {
        final UserRequestWorker<SortedCache<User>> userRequestWorker = userSubscriberMap.get(reqPage);
        final long nextCursor = paging != null ? paging.getMaxId() : -1;
        if (reqPage == UserPageInfo.FOLLOWER) {
            userRequestWorker.fetchFollowers(userId, nextCursor);
        } else if (reqPage == UserPageInfo.FRIEND) {
            userRequestWorker.fetchFriends(userId, nextCursor);
        }
    }
}

From source file:com.github.moko256.mastodon.MTRangeConverter.java

License:Apache License

public static Range convert(Paging paging) {
    return new Range(convertLong(paging.getMaxId()), convertLong(paging.getSinceId()),
            (paging.getCount() == -1) ? 0 : paging.getCount());
}

From source file:com.github.moko256.twitlatte.SearchResultFragment.java

License:Apache License

@Override
@NonNull//w w  w  . j ava2 s . c  om
protected ResponseList<Status> getResponseList(@NonNull Paging paging) throws TwitterException {
    SearchResultList result = new SearchResultList();
    if (!searchText.equals("")) {
        Query query = new Query(searchText).count(paging.getCount()).sinceId(paging.getSinceId())
                .maxId(paging.getMaxId()).resultType(Query.ResultType.recent);
        result.addAll(GlobalApplication.twitter.search().search(query).getTweets());
    }
    return result;
}

From source file:de.vanita5.twittnuker.loader.support.TweetSearchLoader.java

License:Open Source License

@Override
public List<Status> getStatuses(final Twitter twitter, final Paging paging) throws TwitterException {
    if (twitter == null)
        return null;
    final Query query = new Query(processQuery(mQuery));
    query.setRpp(paging.getCount());// w  ww.  j ava 2s .c  om
    if (paging.getMaxId() > 0) {
        query.setMaxId(paging.getMaxId());
    }
    return Arrays.asList(twitter.search(query).getStatuses());
}

From source file:org.getlantern.firetweet.loader.support.TweetSearchLoader.java

License:Open Source License

@NonNull
@Override//w w  w .jav  a 2 s.co m
public List<Status> getStatuses(@NonNull final Twitter twitter, final Paging paging) throws TwitterException {
    final Query query = new Query(processQuery(mQuery));
    query.setRpp(paging.getCount());
    if (paging.getMaxId() > 0) {
        query.setMaxId(paging.getMaxId());
    }
    return twitter.search(query);
}

From source file:org.tweetalib.android.TwitterUtil.java

License:Apache License

public static Query updateQueryWithPaging(Query query, Paging paging) {

    if (paging.getMaxId() > -1) {
        query.setMaxId(paging.getMaxId());
    }/*  w  ww .j av a  2  s  .com*/
    if (paging.getSinceId() > -1) {
        query.setSinceId(paging.getSinceId());
    }
    /*
     * if (paging.getPage() != 1 && paging.getPage() != -1) {
     * query.setPage(paging.getPage()); }
     */

    return query;
}