Search in sources :

Example 1 with ObservedTextView

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));
    }
}
Also used : Context(android.content.Context) ObservedTextView(com.hippo.widget.ObservedTextView) LayoutInflater(android.view.LayoutInflater) GalleryComment(com.hippo.ehviewer.client.data.GalleryComment) URLImageGetter(com.hippo.text.URLImageGetter) TextView(android.widget.TextView) ObservedTextView(com.hippo.widget.ObservedTextView) ImageView(android.widget.ImageView) LoadImageView(com.hippo.widget.LoadImageView) ProgressView(com.hippo.widget.ProgressView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ObservedTextView(com.hippo.widget.ObservedTextView) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 GalleryComment (com.hippo.ehviewer.client.data.GalleryComment)1 URLImageGetter (com.hippo.text.URLImageGetter)1 LoadImageView (com.hippo.widget.LoadImageView)1 ObservedTextView (com.hippo.widget.ObservedTextView)1 ProgressView (com.hippo.widget.ProgressView)1