本文整理汇总了Java中com.sina.weibo.sdk.openapi.models.Comment类的典型用法代码示例。如果您正苦于以下问题:Java Comment类的具体用法?Java Comment怎么用?Java Comment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Comment类属于com.sina.weibo.sdk.openapi.models包,在下文中一共展示了Comment类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayComments
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
private void displayComments(String jsonContent, boolean isnew) {
if (!TextUtils.isEmpty(jsonContent)) {
CommentList comments = CommentList.parse(jsonContent);
if (comments != null) {
List<Comment> commentsList = comments.commentList;
if (commentsList != null) {
if (isnew) {
mCommentsList.clear();
}
mCommentsList.addAll(commentsList);
mCommentsAdapter.notifyDataSetChanged();
}
mViewCommentHelper.onRequestComplete();
}
}
}
示例2: toJsonObject
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
private static JSONObject toJsonObject(Comment comment) {
JSONObject jsonObject = new JSONObject();
if (comment == null) {
return jsonObject;
}
try {
jsonObject.put("created_at", comment.created_at);
jsonObject.put("id", comment.id);
jsonObject.put("text", comment.text);
jsonObject.put("source", comment.source);
jsonObject.put("user", toJsonObject(comment.user));
jsonObject.put("mid", comment.mid);
jsonObject.put("idstr", comment.idstr);
jsonObject.put("status", toJsonObject(comment.status));
jsonObject
.put("reply_comment", toJsonObject(comment.reply_comment));
} catch (JSONException e) {
e.printStackTrace();
}
return jsonObject;
}
示例3: toJson
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
public static String toJson(CommentList comments) {
JSONObject jsonObject = new JSONObject();
if (comments == null) {
return jsonObject.toString();
}
try {
jsonObject.put("previous_cursor", comments.previous_cursor);
jsonObject.put("next_cursor", comments.next_cursor);
jsonObject.put("total_number", comments.total_number);
JSONArray jsonArray = new JSONArray();
for (Comment comment : comments.commentList) {
jsonArray.put(toJsonObject(comment));
}
jsonObject.put("comments", jsonArray);
return jsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
}
return jsonObject.toString();
}
示例4: addComments
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
/**
* 加载更多评论
*
* @param comments
*/
public void addComments(List<Comment> comments) {
if (comments != null) {
int start = mComments.size() + 1;
mComments.addAll(comments);
notifyItemRangeInserted(start, comments.size());
}
}
示例5: setComments
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
public void setComments(List<Comment> comments) {
if (comments != null) {
mComments.clear();
mComments.addAll(comments);
notifyDataSetChanged();
}
}
示例6: addComments
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
public void addComments(List<Comment> comments) {
if (comments != null) {
int start = mComments.size();
mComments.addAll(comments);
notifyItemRangeInserted(start, comments.size());
}
}
示例7: updateComment
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
public static String updateComment(String response) {
String oldCache = getComments();
if (TextUtils.isEmpty(oldCache)) {
return update(TIMELINE_FILE, COMMENTS_KEY, response);
} else {
CommentList newCommentList = CommentList.parse(response);
if (newCommentList == null) {
return oldCache;
}
CommentList oldCommentList = CommentList.parse(oldCache);
ArrayList<Comment> newList = newCommentList.commentList;
if (newList == null || newList.size() == 0) {
return oldCache;
} else if (newList.size() > LIMIT) {
newList = (ArrayList<Comment>) newList.subList(0, LIMIT);
} else if (newList.size() < LIMIT) {
Comment lastComment = newList.get(newList.size() - 1);
for (Comment comment : oldCommentList.commentList) {
if (Long.valueOf(comment.id) < Long.valueOf(lastComment.id)) {
newList.add(comment);
}
}
}
newCommentList.commentList = newList;
return update(TIMELINE_FILE, COMMENTS_KEY,
Utils.toJson(newCommentList));
}
}
示例8: getView
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
/**
* 子项被滚入屏幕时会被调用
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
// 加载布局
if (convertView == null) {
view = LayoutInflater.from(mContext).inflate(resourceId, null);
mViewHolder = new ViewHolder(view);
view.setTag(mViewHolder);
} else {
view = convertView;
mViewHolder = (ViewHolder) view.getTag();
}
Comment comment = getItem(position);
WeiboItemAdapter.setAvatar(mViewHolder.mAvatar,
comment.user.avatar_large);
WeiboItemAdapter.setTextWithLink(mViewHolder.mScreenName,
comment.user.screen_name);
WeiboItemAdapter.setTextWithLink(mViewHolder.mCreateAt,
Utils.getFormatTime(comment.created_at));
WeiboItemAdapter.setTextWithAtAndLink(mViewHolder.mMainContent,
comment.text);
if (TextUtils.isEmpty(comment.status.text) == false) {
WeiboItemAdapter.setTextWithAtAndLink(mViewHolder.mRepostContent,
Utils.loadFromResource(R.string.comment_on_my_weibo)
+ comment.status.text);
}
return view;
}
示例9: setComments
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
public void setComments(List<Comment> comments) {
this.mComments.clear();
this.mComments.addAll(comments);
notifyDataSetChanged();
}
示例10: CommentsAdapter
import com.sina.weibo.sdk.openapi.models.Comment; //导入依赖的package包/类
public CommentsAdapter(Context context, int textViewReourceId,
List<Comment> objects) {
super(context, textViewReourceId, objects);
resourceId = textViewReourceId;
mContext = context;
}