本文整理匯總了Java中net.oschina.app.bean.BlogCommentList類的典型用法代碼示例。如果您正苦於以下問題:Java BlogCommentList類的具體用法?Java BlogCommentList怎麽用?Java BlogCommentList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlogCommentList類屬於net.oschina.app.bean包,在下文中一共展示了BlogCommentList類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBlogCommentList
import net.oschina.app.bean.BlogCommentList; //導入依賴的package包/類
/**
* 獲取博客評論列表
* @param id 博客id
* @param pageIndex
* @param pageSize
* @return
* @throws AppException
*/
public static BlogCommentList getBlogCommentList(AppContext appContext, final int id, final int pageIndex, final int pageSize) throws AppException {
String newUrl = _MakeURL(URLs.BLOGCOMMENT_LIST, new HashMap<String, Object>(){{
put("id", id);
put("pageIndex", pageIndex);
put("pageSize", pageSize);
}});
try{
return BlogCommentList.parse(http_get(appContext, newUrl));
}catch(Exception e){
if(e instanceof AppException)
throw (AppException)e;
throw AppException.network(e);
}
}
示例2: loadLvCommentData
import net.oschina.app.bean.BlogCommentList; //導入依賴的package包/類
/**
* 線程加載評論數據
* @param id 當前文章id
* @param pageIndex 當前頁數
* @param handler 處理器
* @param action 動作標識
*/
private void loadLvCommentData(final int id,final int pageIndex,final Handler handler,final int action){
new Thread(){
public void run() {
Message msg = new Message();
boolean isRefresh = false;
if(action == UIHelper.LISTVIEW_ACTION_REFRESH || action == UIHelper.LISTVIEW_ACTION_SCROLL)
isRefresh = true;
try {
BlogCommentList commentlist = ((AppContext)getApplication()).getBlogCommentList(id, pageIndex, isRefresh);
msg.what = commentlist.getPageSize();
msg.obj = commentlist;
} catch (AppException e) {
e.printStackTrace();
msg.what = -1;
msg.obj = e;
}
msg.arg1 = action;//告知handler當前action
handler.sendMessage(msg);
}
}.start();
}
示例3: initCommentData
import net.oschina.app.bean.BlogCommentList; //導入依賴的package包/類
private void initCommentData()
{
curId = blogId;
curCatalog = CommentPub.CATALOG_BLOG;
mCommentHandler = new Handler()
{
public void handleMessage(Message msg)
{
if(msg.what >= 0){
BlogCommentList list = (BlogCommentList)msg.obj;
Notice notice = list.getNotice();
//處理listview數據
switch (msg.arg1) {
case UIHelper.LISTVIEW_ACTION_INIT:
case UIHelper.LISTVIEW_ACTION_REFRESH:
lvSumData = msg.what;
lvCommentData.clear();//先清除原有數據
lvCommentData.addAll(list.getCommentlist());
break;
case UIHelper.LISTVIEW_ACTION_SCROLL:
lvSumData += msg.what;
if(lvCommentData.size() > 0){
for(Comment com1 : list.getCommentlist()){
boolean b = false;
for(Comment com2 : lvCommentData){
if(com1.getId() == com2.getId() && com1.getAuthorId() == com2.getAuthorId()){
b = true;
break;
}
}
if(!b) lvCommentData.add(com1);
}
}else{
lvCommentData.addAll(list.getCommentlist());
}
break;
}
//評論數更新
if(blogDetail != null && lvCommentData.size() > blogDetail.getCommentCount()){
blogDetail.setCommentCount(lvCommentData.size());
bv_comment.setText(lvCommentData.size()+"");
bv_comment.show();
}
if(msg.what < 20){
curLvDataState = UIHelper.LISTVIEW_DATA_FULL;
lvCommentAdapter.notifyDataSetChanged();
lvComment_foot_more.setText(R.string.load_full);
}else if(msg.what == 20){
curLvDataState = UIHelper.LISTVIEW_DATA_MORE;
lvCommentAdapter.notifyDataSetChanged();
lvComment_foot_more.setText(R.string.load_more);
}
//發送通知廣播
if(notice != null){
UIHelper.sendBroadCast(BlogDetail.this, notice);
}
}
else if(msg.what == -1){
//有異常--顯示加載出錯 & 彈出錯誤消息
curLvDataState = UIHelper.LISTVIEW_DATA_MORE;
lvComment_foot_more.setText(R.string.load_error);
((AppException)msg.obj).makeToast(BlogDetail.this);
}
if(lvCommentData.size()==0){
curLvDataState = UIHelper.LISTVIEW_DATA_EMPTY;
lvComment_foot_more.setText(R.string.load_empty);
}
lvComment_foot_progress.setVisibility(View.GONE);
if(msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH){
mLvComment.onRefreshComplete(getString(R.string.pull_to_refresh_update) + new Date().toLocaleString());
mLvComment.setSelection(0);
}
}
};
this.loadLvCommentData(curId,0,mCommentHandler,UIHelper.LISTVIEW_ACTION_INIT);
}