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);
}
}
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;
}
Aggregations