當前位置: 首頁>>代碼示例>>Java>>正文


Java Comment類代碼示例

本文整理匯總了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;未經允許,請勿轉載。