• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Comment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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();
		}
	}
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:17,代码来源:CommentView.java


示例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;
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:24,代码来源:Utils.java


示例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();
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:25,代码来源:Utils.java


示例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());
    }
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:13,代码来源:CommentListAdapter.java


示例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();
    }
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:8,代码来源:MentionCmtsAdapter.java


示例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());
    }
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:8,代码来源:MentionCmtsAdapter.java


示例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));
	}
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:30,代码来源:Cache.java


示例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;
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:33,代码来源:CommentsAdapter.java


示例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();
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:6,代码来源:CommentListAdapter.java


示例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;
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:7,代码来源:CommentsAdapter.java



注:本文中的com.sina.weibo.sdk.openapi.models.Comment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RealmCore类代码示例发布时间:2022-05-16
下一篇:
Java RemoteEventService类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap