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


Java FavoriteList类代码示例

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


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

示例1: getFavoriteList

import net.oschina.app.bean.FavoriteList; //导入依赖的package包/类
/**
 * 用户收藏列表
 * @param uid 用户UID
 * @param type 0:全部收藏 1:软件 2:话题 3:博客 4:新闻 5:代码
 * @param pageIndex 页面索引 0表示第一页
 * @param pageSize 每页的数量
 * @return
 * @throws AppException
 */
public static FavoriteList getFavoriteList(AppContext appContext, final int uid, final int type, final int pageIndex, final int pageSize) throws AppException {
	String newUrl = _MakeURL(URLs.FAVORITE_LIST, new HashMap<String, Object>(){{
		put("uid", uid);
		put("type", type);
		put("pageIndex", pageIndex);
		put("pageSize", pageSize);
	}});
	
	try{
		return FavoriteList.parse(http_get(appContext, newUrl));		
	}catch(Exception e){
		if(e instanceof AppException)
			throw (AppException)e;
		throw AppException.network(e);
	}
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:26,代码来源:ApiClient.java

示例2: loadLvFavoriteData

import net.oschina.app.bean.FavoriteList; //导入依赖的package包/类
/**
    * 线程加载收藏数据
    * @param type 0:全部收藏 1:软件 2:话题 3:博客 4:新闻 5:代码
    * @param pageIndex 当前页数
    * @param handler 处理器
    * @param action 动作标识
    */
private void loadLvFavoriteData(final int type,final int pageIndex,final Handler handler,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 {
				FavoriteList favoriteList = ((AppContext)getApplication()).getFavoriteList(type, pageIndex, isRefresh);
				msg.what = favoriteList.getPageSize();
				msg.obj = favoriteList;
            } catch (AppException e) {
            	e.printStackTrace();
            	msg.what = -1;
            	msg.obj = e;
            }
			msg.arg1 = action;//告知handler当前action
			if(curFavoriteCatalog == type)
				handler.sendMessage(msg);
		}
	}.start();
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:31,代码来源:UserFavorite.java

示例3: initData

import net.oschina.app.bean.FavoriteList; //导入依赖的package包/类
private void initData()
	{			
mFavoriteHandler = new Handler()
{
	public void handleMessage(Message msg) {
		
		headButtonSwitch(DATA_LOAD_COMPLETE);

		if(msg.what >= 0){						
			FavoriteList list = (FavoriteList)msg.obj;
			Notice notice = list.getNotice();
			//处理listview数据
			switch (msg.arg1) {
			case UIHelper.LISTVIEW_ACTION_INIT:
			case UIHelper.LISTVIEW_ACTION_REFRESH:
			case UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG:
				lvSumData = msg.what;
				lvFavoriteData.clear();//先清除原有数据
				lvFavoriteData.addAll(list.getFavoritelist());
				break;
			case UIHelper.LISTVIEW_ACTION_SCROLL:
				lvSumData += msg.what;
				if(lvFavoriteData.size() > 0){
					for(Favorite fav1 : list.getFavoritelist()){
						boolean b = false;
						for(Favorite fav2 : lvFavoriteData){
							if(fav1.objid == fav2.objid){
								b = true;
								break;
							}
						}
						if(!b) lvFavoriteData.add(fav1);
					}
				}else{
					lvFavoriteData.addAll(list.getFavoritelist());
				}
				break;
			}	
			
			if(msg.what < 20){
				curLvDataState = UIHelper.LISTVIEW_DATA_FULL;
				lvFavoriteAdapter.notifyDataSetChanged();
				lvFavorite_foot_more.setText(R.string.load_full);
			}else if(msg.what == 20){					
				curLvDataState = UIHelper.LISTVIEW_DATA_MORE;
				lvFavoriteAdapter.notifyDataSetChanged();
				lvFavorite_foot_more.setText(R.string.load_more);
			}
			//发送通知广播
			if(notice != null){
				UIHelper.sendBroadCast(UserFavorite.this, notice);
			}
		}
		else if(msg.what == -1){
			//有异常--显示加载出错 & 弹出错误消息
			curLvDataState = UIHelper.LISTVIEW_DATA_MORE;
			lvFavorite_foot_more.setText(R.string.load_error);
			((AppException)msg.obj).makeToast(UserFavorite.this);
		}
		if(lvFavoriteData.size()==0){
			curLvDataState = UIHelper.LISTVIEW_DATA_EMPTY;
			lvFavorite_foot_more.setText(R.string.load_empty);
		}
		lvFavorite_foot_progress.setVisibility(View.GONE);
		if(msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH){
			mlvFavorite.onRefreshComplete(getString(R.string.pull_to_refresh_update) + new Date().toLocaleString());
			mlvFavorite.setSelection(0);
		}else if(msg.arg1 == UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG){
			mlvFavorite.onRefreshComplete();
			mlvFavorite.setSelection(0);
		}
	}
};
this.loadLvFavoriteData(curFavoriteCatalog,0,mFavoriteHandler,UIHelper.LISTVIEW_ACTION_INIT);
	}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:76,代码来源:UserFavorite.java


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