當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。