Search in sources :

Example 1 with Comment

use of in.testpress.testpress.models.Comment 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)

Example 2 with Comment

use of in.testpress.testpress.models.Comment in project android by testpress.

the class CommentsListAdapter method onBindViewHolder.

@SuppressLint({ "SetTextI18n", "DefaultLocale" })
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
    if (viewHolder instanceof CommentsViewHolder) {
        final CommentsViewHolder holder = (CommentsViewHolder) viewHolder;
        Comment comment = comments.get(position);
        imageLoader.displayImage(comment.getUser().getMediumImage(), holder.userImage, options);
        if (comment.getUser().getMediumImage().isEmpty()) {
            holder.userImage.setColorFilter(Color.parseColor("#888888"));
        } else {
            holder.userImage.clearColorFilter();
        }
        holder.userName.setText(comment.getUser().getDisplayName());
        Spanned htmlSpan = Html.fromHtml(comment.getComment(), new UILImageGetter(holder.comment, activity), null);
        ZoomableImageString zoomableImageQuestion = new ZoomableImageString(activity);
        holder.comment.setText(zoomableImageQuestion.convertString(htmlSpan));
        holder.comment.setMovementMethod(LinkMovementMethod.getInstance());
        updateTimeSpan(comment, holder);
        holder.userName.setTypeface(TestpressSdk.getRubikMediumFont(activity));
        ViewUtils.setTypeface(new TextView[] { holder.submitDate, holder.comment }, TestpressSdk.getRubikRegularFont(activity));
    }
}
Also used : Comment(in.testpress.testpress.models.Comment) UILImageGetter(in.testpress.testpress.util.UILImageGetter) ZoomableImageString(in.testpress.testpress.util.ZoomableImageString) Spanned(android.text.Spanned) SuppressLint(android.annotation.SuppressLint)

Aggregations

Comment (in.testpress.testpress.models.Comment)2 SuppressLint (android.annotation.SuppressLint)1 Spanned (android.text.Spanned)1 CommentsPager (in.testpress.testpress.core.CommentsPager)1 UILImageGetter (in.testpress.testpress.util.UILImageGetter)1 ZoomableImageString (in.testpress.testpress.util.ZoomableImageString)1