use of com.hippo.widget.ObservedTextView in project EhViewer by seven332.
the class GalleryDetailScene method bindComments.
private void bindComments(GalleryComment[] comments) {
Context context = getContext2();
LayoutInflater inflater = getLayoutInflater2();
if (null == context || null == inflater || null == mComments || null == mCommentsText) {
return;
}
mComments.removeViews(0, mComments.getChildCount() - 1);
final int maxShowCount = 2;
if (comments == null || comments.length == 0) {
mCommentsText.setText(R.string.no_comments);
return;
} else if (comments.length <= maxShowCount) {
mCommentsText.setText(R.string.no_more_comments);
} else {
mCommentsText.setText(R.string.more_comment);
}
int length = Math.min(maxShowCount, comments.length);
for (int i = 0; i < length; i++) {
GalleryComment comment = comments[i];
View v = inflater.inflate(R.layout.item_gallery_comment, mComments, false);
mComments.addView(v, i);
TextView user = (TextView) v.findViewById(R.id.user);
user.setText(comment.user);
TextView time = (TextView) v.findViewById(R.id.time);
time.setText(ReadableTime.getTimeAgo(comment.time));
ObservedTextView c = (ObservedTextView) v.findViewById(R.id.comment);
c.setMaxLines(5);
c.setText(Html.fromHtml(comment.comment, new URLImageGetter(c, EhApplication.getConaco(context)), null));
}
}
Aggregations