Search in sources :

Example 1 with CommentsPager

use of in.testpress.testpress.core.CommentsPager in project android by testpress.

the class PostActivity method getPreviousCommentsPager.

@SuppressLint("SimpleDateFormat")
CommentsPager getPreviousCommentsPager() {
    if (previousCommentsPager == null) {
        previousCommentsPager = new CommentsPager(getService(), post.getId());
        previousCommentsPager.queryParams.put(Constants.Http.ORDER, "-created");
        previousCommentsPager.queryParams.put(Constants.Http.UNTIL, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ").format(new Date()));
    }
    return previousCommentsPager;
}
Also used : CommentsPager(in.testpress.testpress.core.CommentsPager) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) SuppressLint(android.annotation.SuppressLint)

Example 2 with CommentsPager

use of in.testpress.testpress.core.CommentsPager in project android by testpress.

the class PostActivity method getNewCommentsPager.

CommentsPager getNewCommentsPager() {
    if (newCommentsPager == null) {
        newCommentsPager = new CommentsPager(getService(), post.getId());
    }
    List<Comment> comments = commentsAdapter.getComments();
    if (newCommentsPager.queryParams.isEmpty() && comments.size() != 0) {
        Comment latestComment = comments.get(comments.size() - 1);
        // noinspection ConstantConditions
        newCommentsPager.queryParams.put(Constants.Http.SINCE, latestComment.getCreated());
    }
    return newCommentsPager;
}
Also used : Comment(in.testpress.testpress.models.Comment) CommentsPager(in.testpress.testpress.core.CommentsPager)

Aggregations

CommentsPager (in.testpress.testpress.core.CommentsPager)2 SuppressLint (android.annotation.SuppressLint)1 Comment (in.testpress.testpress.models.Comment)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1