Search in sources :

Example 1 with CommentItem

use of org.fossasia.openevent.core.feed.facebook.api.CommentItem in project open-event-android by fossasia.

the class CommentsListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
    final CommentItem commentItem = commentItems.get(position);
    if (commentItem.getCreatedTime() != null) {
        String createdTime = commentItem.getCreatedTime();
        try {
            holder.commentTime.setText(DateConverter.getRelativeTimeFromTimestamp(createdTime));
        } catch (DateTimeParseException e) {
            Timber.e(e);
        }
    }
    if (!TextUtils.isEmpty(commentItem.getMessage())) {
        holder.comment.setText(commentItem.getMessage());
        holder.comment.setVisibility(View.VISIBLE);
    } else {
        // status is empty, remove from view
        holder.comment.setVisibility(View.GONE);
    }
    if (!TextUtils.isEmpty(commentItem.getFrom().getName())) {
        holder.commenter.setText(commentItem.getFrom().getName());
        holder.commenter.setVisibility(View.VISIBLE);
    } else {
        // status is empty, remove from view
        holder.commenter.setVisibility(View.GONE);
    }
}
Also used : DateTimeParseException(org.threeten.bp.format.DateTimeParseException) CommentItem(org.fossasia.openevent.core.feed.facebook.api.CommentItem)

Example 2 with CommentItem

use of org.fossasia.openevent.core.feed.facebook.api.CommentItem in project open-event-android by fossasia.

the class CommentsDialogFragment method onCreateView.

// TODO: Move implementation from MainActivity to respective fragment
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // inflate layout with recycler view
    View root = inflater.inflate(R.layout.list_comment, container, false);
    List<CommentItem> commentItems = this.getArguments().getParcelableArrayList(ConstantStrings.FACEBOOK_COMMENTS);
    RecyclerView recyclerView = root.findViewById(R.id.comment_recycler_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    CommentsListAdapter commentsAdapter = new CommentsListAdapter(commentItems);
    recyclerView.setAdapter(commentsAdapter);
    return root;
}
Also used : CommentItem(org.fossasia.openevent.core.feed.facebook.api.CommentItem) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

CommentItem (org.fossasia.openevent.core.feed.facebook.api.CommentItem)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 DateTimeParseException (org.threeten.bp.format.DateTimeParseException)1