当前位置: 首页>>代码示例>>Java>>正文


Java BlogList类代码示例

本文整理汇总了Java中net.oschina.app.bean.BlogList的典型用法代码示例。如果您正苦于以下问题:Java BlogList类的具体用法?Java BlogList怎么用?Java BlogList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BlogList类属于net.oschina.app.bean包,在下文中一共展示了BlogList类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUserBlogList

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
/**
 * 获取某用户的博客列表
 * @param authoruid
 * @param uid
 * @param pageIndex
 * @param pageSize
 * @return
 * @throws AppException
 */
public static BlogList getUserBlogList(AppContext appContext, final int authoruid, final String authorname, final int uid, final int pageIndex, final int pageSize) throws AppException {
	String newUrl = _MakeURL(URLs.USERBLOG_LIST, new HashMap<String, Object>(){{
		put("authoruid", authoruid);
		put("authorname", URLEncoder.encode(authorname));
		put("uid", uid);
		put("pageIndex", pageIndex);
		put("pageSize", pageSize);
	}});

	try{
		return BlogList.parse(http_get(appContext, newUrl));		
	}catch(Exception e){
		if(e instanceof AppException)
			throw (AppException)e;
		throw AppException.network(e);
	}
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:27,代码来源:ApiClient.java

示例2: getBlogList

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
/**
 * 获取博客列表
 * @param type 推荐:recommend 最新:latest
 * @param pageIndex
 * @param pageSize
 * @return
 * @throws AppException
 */
public static BlogList getBlogList(AppContext appContext, final String type, final int pageIndex, final int pageSize) throws AppException {
	String newUrl = _MakeURL(URLs.BLOG_LIST, new HashMap<String, Object>(){{
		put("type", type);
		put("pageIndex", pageIndex);
		put("pageSize", pageSize);
	}});

	try{
		return BlogList.parse(http_get(appContext, newUrl));		
	}catch(Exception e){
		if(e instanceof AppException)
			throw (AppException)e;
		throw AppException.network(e);
	}
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:24,代码来源:ApiClient.java

示例3: loadLvBlogData

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
private void loadLvBlogData(final Handler handler, final int pageIndex, final int action){  
headButtonSwitch(DATA_LOAD_ING);
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 {
				BlogList bloglist= ((AppContext)getApplication()).getUserBlogList(_hisuid, _hisname, pageIndex, isRefresh);
				msg.what = bloglist.getPageSize();
				msg.obj = bloglist;
            } catch (AppException e) {
            	e.printStackTrace();
            	msg.what = -1;
            	msg.obj = e;
            }
			msg.arg1 = action;//告知handler当前action
               handler.sendMessage(msg);
		}
	}.start();
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:23,代码来源:UserCenter.java

示例4: loadLvBlogData

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
/**
 * 线程加载博客数据
 * 
 * @param catalog
 *            分类
 * @param pageIndex
 *            当前页数
 * @param handler
 *            处理器
 * @param action
 *            动作标识
 */
private void loadLvBlogData(final int catalog, final int pageIndex,
		final Handler handler, final int action) {
	mHeadProgress.setVisibility(ProgressBar.VISIBLE);
	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;
			String type = "";
			switch (catalog) {
			case BlogList.CATALOG_LATEST:
				type = BlogList.TYPE_LATEST;
				break;
			case BlogList.CATALOG_RECOMMEND:
				type = BlogList.TYPE_RECOMMEND;
				break;
			}
			try {
				BlogList list = appContext.getBlogList(type, pageIndex,
						isRefresh);
				msg.what = list.getPageSize();
				msg.obj = list;
			} catch (AppException e) {
				e.printStackTrace();
				msg.what = -1;
				msg.obj = e;
			}
			msg.arg1 = action;
			msg.arg2 = UIHelper.LISTVIEW_DATATYPE_BLOG;
			if (curNewsCatalog == catalog)
				handler.sendMessage(msg);
		}
	}.start();
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:49,代码来源:Main.java

示例5: loadLvBlogData

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
/**
    * 线程加载博客数据
    * @param catalog 分类
    * @param pageIndex 当前页数
    * @param handler 处理器
    * @param action 动作标识
    */
private void loadLvBlogData(final int catalog,final int pageIndex,final Handler handler,final int action){ 
	mHeadProgress.setVisibility(ProgressBar.VISIBLE);
	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;
			String type = "";
			switch (catalog) {
			case BlogList.CATALOG_LATEST:
				type = BlogList.TYPE_LATEST;
				break;
			case BlogList.CATALOG_RECOMMEND:
				type = BlogList.TYPE_RECOMMEND;
				break;
			}
			try {
				BlogList list = appContext.getBlogList(type, pageIndex, isRefresh);				
				msg.what = list.getPageSize();
				msg.obj = list;
            } catch (AppException e) {
            	e.printStackTrace();
            	msg.what = -1;
            	msg.obj = e;
            }
			msg.arg1 = action;
			msg.arg2 = UIHelper.LISTVIEW_DATATYPE_BLOG;
               if(curNewsCatalog == catalog)
               	handler.sendMessage(msg);
		}
	}.start();
}
 
开发者ID:segerbing,项目名称:OSChina,代码行数:41,代码来源:Main.java

示例6: getView

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
/**
 * ListView Item设置
 */
public View getView(int position, View convertView, ViewGroup parent) {
	//Log.d("method", "getView");
	
	//自定义视图
	ListItemView  listItemView = null;
	
	if (convertView == null) {
		//获取list_item布局文件的视图
		convertView = listContainer.inflate(this.itemViewResource, null);
		
		listItemView = new ListItemView();
		//获取控件对象
		listItemView.title = (TextView)convertView.findViewById(R.id.blog_listitem_title);
		listItemView.author = (TextView)convertView.findViewById(R.id.blog_listitem_author);
		listItemView.count = (TextView)convertView.findViewById(R.id.blog_listitem_commentCount);
		listItemView.date = (TextView)convertView.findViewById(R.id.blog_listitem_date);
		listItemView.type = (ImageView)convertView.findViewById(R.id.blog_listitem_documentType);
		
		//设置控件集到convertView
		convertView.setTag(listItemView);
	}else {
		listItemView = (ListItemView)convertView.getTag();
	}	
	
	//设置文字和图片
	Blog blog = listItems.get(position);
	
	listItemView.title.setText(blog.getTitle());
	listItemView.title.setTag(blog);//设置隐藏参数(实体类)
	listItemView.date.setText(StringUtils.friendly_time(blog.getPubDate()));
	listItemView.count.setText(blog.getCommentCount()+"");
	if(blog.getDocumentType() == Blog.DOC_TYPE_ORIGINAL)
		listItemView.type.setImageResource(R.drawable.widget_original_icon);
	else
		listItemView.type.setImageResource(R.drawable.widget_repaste_icon);
	
	if(blogtype == BlogList.CATALOG_USER){
		listItemView.author.setVisibility(View.GONE);
	}else{
		listItemView.author.setText(blog.getAuthor()+"   发表于");
	}
	
	return convertView;
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:48,代码来源:ListViewBlogAdapter.java

示例7: lvBlogHandleMessage

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
private void lvBlogHandleMessage(Message msg){
	if(msg.what >= 0){
		BlogList bloglist = (BlogList)msg.obj;
		Notice notice = bloglist.getNotice();
		//显示用户博客数量
		String tabBlogText = String.format("博客(%d)", bloglist.getBlogsCount());
		mTabBlog.setText(tabBlogText);
		//处理listview数据			
		switch (msg.arg1) {
		case UIHelper.LISTVIEW_ACTION_INIT:
		case UIHelper.LISTVIEW_ACTION_REFRESH:
		case UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG:
			lvBlogSumData = msg.what;
			lvBlogData.clear();//先清除原有数据
			lvBlogData.addAll(bloglist.getBloglist());
			break;
		case UIHelper.LISTVIEW_ACTION_SCROLL:
			lvBlogSumData += msg.what;
			if(lvBlogData.size() > 0){
				for(Blog blog1 : bloglist.getBloglist()){
					boolean b = false;
					for(Blog blog2 : lvBlogData){
						if(blog1.getId() == blog2.getId()){
							b = true;
							break;
						}
					}
					if(!b) lvBlogData.add(blog1);
				}
			}else{
				lvBlogData.addAll(bloglist.getBloglist());
			}
			break;
		}
		if(msg.what<_pageSize){
			curLvBlogDataState = UIHelper.LISTVIEW_DATA_FULL;
			lvBlogAdapter.notifyDataSetChanged();
			lvBlog_foot_more.setText(R.string.load_full);
		}
		else if(msg.what == _pageSize){	
			curLvBlogDataState = UIHelper.LISTVIEW_DATA_MORE;
			lvBlogAdapter.notifyDataSetChanged();
			lvBlog_foot_more.setText(R.string.load_more);
		}
		//发送通知广播
		if(msg.obj != null){
			UIHelper.sendBroadCast(UserCenter.this, notice);
		}
	}
	else if(msg.what == -1){
		//有异常--显示加载出错 & 弹出错误消息
		curLvBlogDataState = UIHelper.LISTVIEW_DATA_MORE;
		lvBlog_foot_more.setText(R.string.load_error);
		((AppException)msg.obj).makeToast(UserCenter.this);
	}
	if(lvBlogData.size()==0){
		curLvBlogDataState = UIHelper.LISTVIEW_DATA_EMPTY;
		lvBlog_foot_more.setText(R.string.load_empty);
	}
	lvBlog_foot_progress.setVisibility(View.GONE);
	if(msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH){
		mLvBlog.onRefreshComplete(getString(R.string.pull_to_refresh_update) + new Date().toLocaleString());
		mLvBlog.setSelection(0);
	}else if(msg.arg1 == UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG){
		mLvBlog.setSelection(0);
	}
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:68,代码来源:UserCenter.java

示例8: initFrameButton

import net.oschina.app.bean.BlogList; //导入依赖的package包/类
/**
   * 初始化各个主页的按钮(资讯、问答、动弹、动态、留言)
   */
  private void initFrameButton()
  {
  	//初始化按钮控件
  	framebtn_News_lastest = (Button)findViewById(R.id.frame_btn_news_lastest);
  	framebtn_News_blog = (Button)findViewById(R.id.frame_btn_news_blog);
  	framebtn_News_recommend = (Button)findViewById(R.id.frame_btn_news_recommend);
  	framebtn_Question_ask = (Button)findViewById(R.id.frame_btn_question_ask);
  	framebtn_Question_share = (Button)findViewById(R.id.frame_btn_question_share);
  	framebtn_Question_other = (Button)findViewById(R.id.frame_btn_question_other);
  	framebtn_Question_job = (Button)findViewById(R.id.frame_btn_question_job);
  	framebtn_Question_site = (Button)findViewById(R.id.frame_btn_question_site);
  	framebtn_Tweet_lastest = (Button)findViewById(R.id.frame_btn_tweet_lastest);
  	framebtn_Tweet_hot = (Button)findViewById(R.id.frame_btn_tweet_hot);
  	framebtn_Tweet_my = (Button)findViewById(R.id.frame_btn_tweet_my);
  	framebtn_Active_lastest = (Button)findViewById(R.id.frame_btn_active_lastest);
  	framebtn_Active_atme = (Button)findViewById(R.id.frame_btn_active_atme);
  	framebtn_Active_comment = (Button)findViewById(R.id.frame_btn_active_comment);
  	framebtn_Active_myself = (Button)findViewById(R.id.frame_btn_active_myself);
  	framebtn_Active_message = (Button)findViewById(R.id.frame_btn_active_message);
  	//设置首选择项
  	framebtn_News_lastest.setEnabled(false);
  	framebtn_Question_ask.setEnabled(false);
  	framebtn_Tweet_lastest.setEnabled(false);
  	framebtn_Active_lastest.setEnabled(false);
  	//资讯+博客
  	framebtn_News_lastest.setOnClickListener(frameNewsBtnClick(framebtn_News_lastest,NewsList.CATALOG_ALL));
  	framebtn_News_blog.setOnClickListener(frameNewsBtnClick(framebtn_News_blog,BlogList.CATALOG_LATEST));
  	framebtn_News_recommend.setOnClickListener(frameNewsBtnClick(framebtn_News_recommend,BlogList.CATALOG_RECOMMEND));
  	//问答
  	framebtn_Question_ask.setOnClickListener(frameQuestionBtnClick(framebtn_Question_ask,PostList.CATALOG_ASK));
  	framebtn_Question_share.setOnClickListener(frameQuestionBtnClick(framebtn_Question_share,PostList.CATALOG_SHARE));
  	framebtn_Question_other.setOnClickListener(frameQuestionBtnClick(framebtn_Question_other,PostList.CATALOG_OTHER));
  	framebtn_Question_job.setOnClickListener(frameQuestionBtnClick(framebtn_Question_job,PostList.CATALOG_JOB));
  	framebtn_Question_site.setOnClickListener(frameQuestionBtnClick(framebtn_Question_site,PostList.CATALOG_SITE));
  	//动弹
  	framebtn_Tweet_lastest.setOnClickListener(frameTweetBtnClick(framebtn_Tweet_lastest,TweetList.CATALOG_LASTEST));
  	framebtn_Tweet_hot.setOnClickListener(frameTweetBtnClick(framebtn_Tweet_hot,TweetList.CATALOG_HOT));
  	framebtn_Tweet_my.setOnClickListener(new View.OnClickListener() {
	public void onClick(View v) {
		//判断登录
		int uid = appContext.getLoginUid();
		if(uid == 0){
			UIHelper.showLoginDialog(Main.this);
			return;
		}		
		
   		framebtn_Tweet_lastest.setEnabled(true);
   		framebtn_Tweet_hot.setEnabled(true);
   		framebtn_Tweet_my.setEnabled(false);
		
		curTweetCatalog = uid;
		loadLvTweetData(curTweetCatalog, 0, lvTweetHandler, UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG);
	}
});
  	//动态+留言
  	framebtn_Active_lastest.setOnClickListener(frameActiveBtnClick(framebtn_Active_lastest,ActiveList.CATALOG_LASTEST));
  	framebtn_Active_atme.setOnClickListener(frameActiveBtnClick(framebtn_Active_atme,ActiveList.CATALOG_ATME));
  	framebtn_Active_comment.setOnClickListener(frameActiveBtnClick(framebtn_Active_comment,ActiveList.CATALOG_COMMENT));
  	framebtn_Active_myself.setOnClickListener(frameActiveBtnClick(framebtn_Active_myself,ActiveList.CATALOG_MYSELF));
  	framebtn_Active_message.setOnClickListener(frameActiveBtnClick(framebtn_Active_message,0));
  	//特殊处理
  	framebtn_Active_atme.setText("@"+getString(R.string.frame_title_active_atme));
  }
 
开发者ID:segerbing,项目名称:OSChina,代码行数:67,代码来源:Main.java


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