<repo_name>xyTianZhao/XiyouLibrary<file_sep>/src/com/tz/xiyoulibrary/activity/bookdetial/presenter/BookDetialPresenter.java
package com.tz.xiyoulibrary.activity.bookdetial.presenter;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.bookdetial.model.BookDetialModel;
import com.tz.xiyoulibrary.activity.bookdetial.model.IBookDetialModel;
import com.tz.xiyoulibrary.activity.bookdetial.view.IBookDetialView;
import com.tz.xiyoulibrary.activity.callback.CallBack;

public class BookDetialPresenter {

	private IBookDetialView mBookDetialView;
	private IBookDetialModel mBookDetialModel;

	public BookDetialPresenter(IBookDetialView view) {
		this.mBookDetialView = view;
		mBookDetialModel = new BookDetialModel();
	}

	/**
	 * 获取书籍信息
	 */
	public void getBookDetial(RequestQueue queue, String url) {
		mBookDetialModel.getBookDetial(queue, url,
				new CallBack<BookDetialModel>() {

					@Override
					public void getModel(BookDetialModel model) {
						switch (model.state) {
						case IBookDetialModel.LOADING:
							mBookDetialView.showLoadingView();
							break;
						case IBookDetialModel.LOADING_FALUIRE:
							mBookDetialView.showLoadFaluireView();
							mBookDetialView.showMsg(model.msg);
							break;
						case IBookDetialModel.NO_DATA:
							mBookDetialView.showNoDataView();
							break;
						case IBookDetialModel.LOADING_SUCCESS:
							mBookDetialView
									.showBookDetialView(model.bookDetial);
							break;
						}
					}
				});
	}

	/**
	 * 添加收藏
	 */
	public void collection(RequestQueue queue, String id) {
		mBookDetialModel.collection(queue, id, new CallBack<BookDetialModel>() {

			@Override
			public void getModel(BookDetialModel model) {
				switch (model.state) {
				case IBookDetialModel.LOADING:
					mBookDetialView.showDialog();
					break;
				case IBookDetialModel.LOADING_FALUIRE:
				case IBookDetialModel.LOADING_SUCCESS:
					mBookDetialView.hidenDialog();
					mBookDetialView.showMsg(model.msg);
					break;
				}
			}
		});
	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/search/view/ISearchView.java
package com.tz.xiyoulibrary.activity.search.view;

import java.util.List;
import java.util.Map;

public interface ISearchView {
	void showBookListView(List<Map<String, String>> bookList);
	void showNoDataView();

}
<file_sep>/src/com/tz/xiyoulibrary/activity/homedetail/view/IHomeDetailView.java
package com.tz.xiyoulibrary.activity.homedetail.view;

import java.util.Map;

public interface IHomeDetailView {
	void showLoadingView();
	void showMsg(String msg);
	void showDetailData(Map<String, String> detailMap);
	void showNoDataView();
	void showLoadFailView();
	

}
<file_sep>/src/com/tz/xiyoulibrary/activity/mybroorw/view/MyBorrowAdapter.java
package com.tz.xiyoulibrary.activity.mybroorw.view;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.volley.Request.Method;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import com.android.volley.toolbox.StringRequest;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.application.Application;
import com.tz.xiyoulibrary.bean.BookBean;
import com.tz.xiyoulibrary.dialog.progressbar.MyProgressBar;
import com.tz.xiyoulibrary.toastview.CustomToast;
import com.tz.xiyoulibrary.utils.Constants;
import com.tz.xiyoulibrary.utils.adapter.CommonAdapter;
import com.tz.xiyoulibrary.utils.adapter.ViewHolder;

@SuppressLint("HandlerLeak")
public class MyBorrowAdapter extends CommonAdapter<BookBean> {
	private ImageLoader imageLoader;
	private int position;
	private MyProgressBar progressBar;
	private RequestQueue queue;

	public MyBorrowAdapter(Context context, List<BookBean> mDatas,
			int itemLayoutId, ImageLoader imageLoader, RequestQueue queue) {
		super(context, mDatas, itemLayoutId);
		this.imageLoader = imageLoader;
		this.queue = queue;
	}

	@Override
	public void convert(ViewHolder helper, final BookBean b) {
		helper.setText(R.id.tv_book_title_item_myborrow, b.getTitle());
		helper.setText(R.id.tv_book_department_item_myborrow,
				"分馆:" + b.getDepartment());
		helper.setText(R.id.tv_book_data_item_myborrow, b.getDate());
		ImageView bookImg = helper.getView(R.id.iv_book_img_item_myborrow);
		String imgUrl = b.getImgUrl();
		bookImg.setTag(imgUrl);
		if (TextUtils.equals(imgUrl, "")) {
			bookImg.setBackgroundResource(R.drawable.img_book_no);
		} else if (bookImg.getTag().toString().equals(imgUrl)) {
			ImageListener imageListener = ImageLoader.getImageListener(bookImg,
					R.drawable.img_book, R.drawable.img_book_no);
			imageLoader.get(imgUrl, imageListener, 240, 320);
		}
		TextView tv = helper.getView(R.id.tv_book_state_item_myborrow);
		Button bt = helper.getView(R.id.bt_book_state_item_myborrow);
		if (b.getCanRenew()) {
			bt.setVisibility(View.VISIBLE);
			tv.setVisibility(View.GONE);
			bt.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					position = mDatas.indexOf(b);
					progressBar = new MyProgressBar(mContext);
					progressBar.show();
					// 续借图书
					renewBook();
				}
			});
		} else {
			bt.setVisibility(View.GONE);
			tv.setVisibility(View.VISIBLE);
			tv.setText(b.getState());
		}
	}

	Handler handler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			if (progressBar.isShowing())
				progressBar.dismiss();
			switch (msg.what) {
			case 0x001:// 失败
				CustomToast.showToast(mContext, "续借失败", 2000);
				break;
			case 0x002:// 成功
				CustomToast.showToast(mContext, "续借成功", 2000);
				mDatas.get(position).setState((String) msg.obj);
				notifyDataSetChanged();
				break;
			}
		};
	};

	/**
	 * 续借图书
	 */
	private void renewBook() {
		StringRequest renewRequest = new StringRequest(Method.POST,
				Constants.GET_BOOK_RENEW, new Listener<String>() {

					@Override
					public void onResponse(String response) {
						try {
							JSONObject o = new JSONObject(response);
							if (o.getBoolean("Result")) {
								Message msg = Message.obtain();
								msg.what = 0x002;
								msg.obj = o.getString("Detail");
								handler.sendMessage(msg);
							} else {
								handler.sendEmptyMessage(0x001);
							}
						} catch (JSONException e) {
							e.printStackTrace();
							handler.sendEmptyMessage(0x001);
						}
					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {
						error.printStackTrace();
						handler.sendEmptyMessage(0x001);
					}
				}) {
			@Override
			protected Map<String, String> getParams() throws AuthFailureError {
				BookBean currBook  = mDatas.get(position);
				Map<String, String> map = new HashMap<String, String>();
				map.put("session", Application.SESSION);
				map.put("barcode", currBook.getBarCode());
				map.put("department_id", currBook.getDepartment_id());
				map.put("library_id", currBook.getLibrary_id());
				return map;
			}
		};
		renewRequest.setRetryPolicy(new DefaultRetryPolicy(
				Constants.TIMEOUT_MS, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
				DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
		queue.add(renewRequest);
	}

}
<file_sep>/src/com/tz/xiyoulibrary/utils/ConfigFile.java
package com.tz.xiyoulibrary.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 
 * @author tianzhao 配置文件类
 */
public class ConfigFile {

	private static SharedPreferences sp;

	private static final String CONFIG_FILE_NAME = "XiYou_Library";
	private static final String UserName = "username";
	private static final String PassWord = "<PASSWORD>";
	private static final String IsSavePassWord = "<PASSWORD>";
	private static final String IsAutoLogin = "isAutoLogin";

	// 消息通知
	private static final String SETTING_MESSAGE_NOTIC = "setting_message_notic";
	// 网络图片显示
	private static final String SETTING_NET = "setting_net";

	public static void saveUsername(Context context, String username) {
		initSp(context);
		sp.edit().putString(UserName, username).commit();
	}

	public static void savePassword(Context context, String password) {
		initSp(context);
		sp.edit().putString(PassWord, password).commit();
	}

	public static String getUsername(Context context) {
		initSp(context);
		return sp.getString(UserName, "");
	}

	public static String getPassword(Context context) {
		initSp(context);
		return sp.getString(PassWord, "");
	}

	public static void saveIsSavePass(Context context, boolean isSavePass) {
		initSp(context);
		sp.edit().putBoolean(IsSavePassWord, isSavePass).commit();
	}

	public static boolean getIsSavePass(Context context) {
		initSp(context);
		return sp.getBoolean(IsSavePassWord, false);
	}
	
	public static void saveIsAutoLogin(Context context, boolean isAutoLogin) {
		initSp(context);
		sp.edit().putBoolean(IsAutoLogin, isAutoLogin).commit();
	}

	public static boolean getIsAutoLogin(Context context) {
		initSp(context);
		return sp.getBoolean(IsAutoLogin, false);
	}

	public static boolean getMessageNotic(Context context) {
		initSp(context);
		return sp.getBoolean(SETTING_MESSAGE_NOTIC, true);
	}

	public static void saveMessageNotic(Context context,
			boolean message_notic_status) {
		initSp(context);
		sp.edit().putBoolean(SETTING_MESSAGE_NOTIC, message_notic_status).commit();
	}

	public static boolean getNet(Context context) {
		initSp(context);
		return sp.getBoolean(SETTING_NET, true);
	}

	public static void saveNet(Context context, boolean net_status) {
		initSp(context);
		sp.edit().putBoolean(SETTING_NET, net_status).commit();
	}

	private static void initSp(Context context) {
		sp = context.getSharedPreferences(CONFIG_FILE_NAME,
				Context.MODE_PRIVATE);
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/about/AboutActivity.java
package com.tz.xiyoulibrary.activity.about;

import java.io.File;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.activity.advice.AdviceActivity_;
import com.tz.xiyoulibrary.activity.baseactivity.BaseActivity;
import com.tz.xiyoulibrary.activity.question.QuestionActivity_;
import com.tz.xiyoulibrary.dialog.progressbar.MyProgressBar;
import com.tz.xiyoulibrary.dialog.progressdialog.MyAlertDialog;
import com.tz.xiyoulibrary.toastview.CustomToast;
import com.tz.xiyoulibrary.utils.Constants;
import com.tz.xiyoulibrary.utils.LogUtils;
import com.tz.xiyoulibrary.utils.UpDateUtils;

@SuppressLint("HandlerLeak")
@EActivity(R.layout.activity_about)
public class AboutActivity extends BaseActivity {
	@ViewById(R.id.rl_back_actionbar)
	RelativeLayout mRelativeLayoutBack;
	@ViewById(R.id.tv_title_actionbar)
	TextView mTextViewTitle;
	@ViewById(R.id.tv_version_about_activity)
	TextView mTextViewVersion;
	@ViewById(R.id.tv_update_about_activity)
	TextView mTextViewUpdate;
	@ViewById(R.id.tv_question_about_activity)
	TextView mTextViewQuestion;
	@ViewById(R.id.tv_back_advice_about_activity)
	TextView mTextViewBackAdvice;
	@ViewById(R.id.tv_our_web_about_activity)
	TextView mTextViewOurWeb;
	
	private MyProgressBar progressBar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		progressBar = new MyProgressBar(AboutActivity.this);
	}

	@AfterViews
	public void initWidgetAfter() {
		mRelativeLayoutBack.setVisibility(View.VISIBLE);
		mTextViewTitle.setText("关于我们");
		mTextViewOurWeb.setText(Html.fromHtml("<u>" + "访问我们的主页" + "</u>"));
		mTextViewVersion.setText("Version" + Constants.versionName);
	}

	@Click(R.id.rl_back_actionbar)
	public void back() {
		finish();
	}

	@Click(R.id.tv_update_about_activity)
	public void update() {
		if (!UpDateUtils.isNew) {
			showUpdateView();
		} else {
			progressBar.show();
			handler.sendEmptyMessageDelayed(0x004, 2000);
		}
	}


	Handler handler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			if (msg.what == 0x001) {
				progressBar.show();
				CustomToast.showToast(AboutActivity.this, "开始下载", 2000);
			} else if (msg.what == 0x003) {// 下载完成
				CustomToast.showToast(AboutActivity.this, "下载完成", 2000);
				LogUtils.d("MainActivity", "下载完成");
				progressBar.dismiss();
				File apkFile = (File) msg.obj;
				Intent intent = new Intent(Intent.ACTION_VIEW);
				intent.setDataAndType(Uri.fromFile(apkFile),
						"application/vnd.android.package-archive");
				startActivity(intent);
			} else if (msg.what == 0x004) {
				progressBar.dismiss();
				CustomToast.showToast(AboutActivity.this, "已是最新版本", 2000);
			} else {// 正在下载
				LogUtils.d("MainActivity : currProgress", msg.what + "%");
				progressBar.setCurrProgress(msg.what);
			}
		};
	};

	private void showUpdateView() {
		MyAlertDialog alertDialog = new MyAlertDialog(AboutActivity.this,
				"亲！出新版本了，是否下载？", new MyAlertDialog.MyAlertDialogListener() {

					@Override
					public void confirm() {
						// 下载新文件
						UpDateUtils.downLoadApk(handler);
					}
				});
		alertDialog.setCancelable(false);
		alertDialog.show();
	}

	/**
	 * 常见问题
	 */
	@Click(R.id.tv_question_about_activity)
	public void question() {
		startActivity(new Intent(AboutActivity.this, QuestionActivity_.class));
	}

	/**
	 * 意见反馈
	 */
	@Click(R.id.tv_back_advice_about_activity)
	public void backAdvice() {
		startActivity(new Intent(AboutActivity.this, AdviceActivity_.class));
	}

	@Click(R.id.tv_our_web_about_activity)
	public void uourWeb() {
		Uri uri = Uri.parse("http://xiyoumobile.com");
		Intent intent = new Intent(Intent.ACTION_VIEW, uri);
		startActivity(intent);
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/mycollection/activity/presenter/MyCollectionPresenter.java
package com.tz.xiyoulibrary.activity.mycollection.activity.presenter;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.activity.mycollection.activity.model.IMyCollectionModel;
import com.tz.xiyoulibrary.activity.mycollection.activity.model.MyCollectionModel;
import com.tz.xiyoulibrary.activity.mycollection.activity.view.IMyCollectionView;

public class MyCollectionPresenter {

	private IMyCollectionView mMyCollectionView;
	private IMyCollectionModel mMyCollectionModel;

	public MyCollectionPresenter(IMyCollectionView view) {
		this.mMyCollectionView = view;
		mMyCollectionModel = new MyCollectionModel();
	}

	/**
	 * »ñÈ¡ÊÕ²ØÊé¼®
	 */
	public void getFavoriteData(RequestQueue queue) {
		mMyCollectionModel.getFavoriteData(queue,
				new CallBack<MyCollectionModel>() {

					@Override
					public void getModel(MyCollectionModel model) {
						switch (model.status) {
						case IMyCollectionModel.LOADING:
							mMyCollectionView.showLoadView();
							break;
						case IMyCollectionModel.LOADING_FALUIRE:
							mMyCollectionView.showGetDataFaluire();
							mMyCollectionView.showMsg(model.msg);
							break;
						case IMyCollectionModel.NO_DATA:
							mMyCollectionView.showGetDataNoData();
							break;
						case IMyCollectionModel.LOADING_SUCCESS:
							mMyCollectionView
									.showFavoriteData(model.favoriteData);
							break;
						}
					}
				});
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/homedetail/model/HomeDetailModel.java
package com.tz.xiyoulibrary.activity.homedetail.model;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.tz.xiyoulibrary.activity.callback.CallBack;

public class HomeDetailModel implements IHomeDetailModel{
	
	public int status;
	public String message;
//	public String detailMsg;
	public Map<String, String> detailMap;

	
	

	@Override
	public void getDetailData(RequestQueue queue, String url,
			final CallBack<HomeDetailModel> callBack) {
		// TODO Auto-generated method stub
		status = LOADING;
		callBack.getModel(this);
		StringRequest request = new StringRequest(url, new Response.Listener<String>() {

			@Override
			public void onResponse(String response) {
				// TODO Auto-generated method stub
				System.out.println("response="+response);
				getDataByJson(response, callBack);
			}
		}, new Response.ErrorListener() {

			@Override
			public void onErrorResponse(VolleyError error) {
				// TODO Auto-generated method stub
				status = LOADING_FALUIRE;
				message = "加载失败";
				callBack.getModel(HomeDetailModel.this);
			}
		}); 
		queue.add(request);

	}
	
	public void getDataByJson(String response,CallBack<HomeDetailModel> callBack){
		detailMap = new HashMap<String, String>();
			try {
				JSONObject obj1 = new JSONObject(response);
				if(obj1.getBoolean("Result")){
					JSONObject obj2 = obj1.getJSONObject("Detail");
					detailMap.put("Title",obj2.getString("Title"));
					detailMap.put("Publisher", obj2.getString("Publisher"));
					detailMap.put("Date", obj2.getString("Date"));
					detailMap.put("Passage", obj2.getString("Passage"));
					status = LOADING_SUCCESS;
				}else{
					status = LOADING_FALUIRE;
					message = "获取信息失败";
				}
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				status = LOADING_FALUIRE;
				message = "获取信息失败";
			}
			callBack.getModel(HomeDetailModel.this);
		
		
	}
	

}
<file_sep>/src/com/tz/xiyoulibrary/activity/mycollection/fragment/BookPagerAdapter.java
package com.tz.xiyoulibrary.activity.mycollection.fragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.android.volley.toolbox.ImageLoader;

/**
 * User: shine Date: 2015-03-13 Time: 09:21 Description:
 */
@SuppressWarnings("unchecked")
public class BookPagerAdapter extends FragmentStatePagerAdapter {

	private List<Map<String, String>> mBookList;
	@SuppressWarnings("rawtypes")
	private List<Fragment> mFragments = new ArrayList();

	public BookPagerAdapter(FragmentManager fragmentManager,
			List<Map<String, String>> bookList,ImageLoader imageLoader) {
		super(fragmentManager);
		int position = 0;
		// 使用迭代器遍历List,
		@SuppressWarnings("rawtypes")
		Iterator iterator = bookList.iterator();
		while (iterator.hasNext()) {
			position++;
			Map<String, String> book = (Map<String, String>) iterator.next();
			book.put("position", position + "");
			// 实例化相应的Fragment并添加到List中
			mFragments.add(MyBorrowFragment.getInstance(book,imageLoader));
		}
		mBookList = bookList;
	}

	public int getCount() {
		return mFragments.size();
	}

	@Override
	public Fragment getItem(int position) {
		return mFragments.get(position);
	}

	public List<Map<String, String>> getCardList() {
		return mBookList;
	}

	public List<Fragment> getFragments() {
		return mFragments;
	}

	public void setDatas(List<Map<String, String>> bookList) {
		this.mBookList = bookList;
		notifyDataSetChanged();
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/search/view/SearchAdapter.java
package com.tz.xiyoulibrary.activity.search.view;

import java.util.List;
import java.util.Map;

import android.content.Context;

import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.utils.adapter.CommonAdapter;
import com.tz.xiyoulibrary.utils.adapter.ViewHolder;

public class SearchAdapter extends CommonAdapter<Map<String,String>>{

	public SearchAdapter(Context context, List<Map<String, String>> mDatas,
			int itemLayoutId) {
		super(context, mDatas, itemLayoutId);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void convert(ViewHolder helper, Map<String, String> map) {
		// TODO Auto-generated method stub
		helper.setText(R.id.book_title,map.get("Title").toString());
		helper.setText(R.id.book_author, map.get("Author").toString());
		helper.setText(R.id.book_id, map.get("ID").toString());
	}
	

}
<file_sep>/src/com/tz/xiyoulibrary/bean/BookBean.java
package com.tz.xiyoulibrary.bean;

import java.io.Serializable;

/**
 * 
 * @author tianzhao 图书馆图书信息
 */
public class BookBean implements Serializable {

	private static final long serialVersionUID = -5223987826917760780L;
	private String id;// 图书馆内控制号
	private String ISBN;//标准号
	private String title;// 标题
	private String secondTitle;// 副标题
	private String pub;// 出版社
	private String author;// 责任者，作者
	private String sort;// 图书馆索书号
	private String subject; // 主题
	private String total;// 图书馆藏书数量
	private String avaliable;// 可借阅数量
	private String barCode;// 条形码
	private String department;// 所在分馆
	private String state;// 当前状态
	private String date;// 应还日期
	private boolean canRenew;// 是否可续借
	private String department_id;// 书库ID号，用于续借
	private String library_id;// 分馆ID号，用于续借
	private String imgUrl;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBarCode() {
		return barCode;
	}

	public void setBarCode(String barCode) {
		this.barCode = barCode;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public boolean getCanRenew() {
		return canRenew;
	}

	public void setCanRenew(boolean canRenew) {
		this.canRenew = canRenew;
	}

	public String getDepartment_id() {
		return department_id;
	}

	public void setDepartment_id(String department_id) {
		this.department_id = department_id;
	}

	public String getLibrary_id() {
		return library_id;
	}

	public void setLibrary_id(String library_id) {
		this.library_id = library_id;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getISBN() {
		return ISBN;
	}

	public void setISBN(String iSBN) {
		ISBN = iSBN;
	}

	public String getSecondTitle() {
		return secondTitle;
	}

	public void setSecondTitle(String secondTitle) {
		this.secondTitle = secondTitle;
	}

	public String getPub() {
		return pub;
	}

	public void setPub(String pub) {
		this.pub = pub;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getTotal() {
		return total;
	}

	public void setTotal(String total) {
		this.total = total;
	}

	public String getAvaliable() {
		return avaliable;
	}

	public void setAvaliable(String avaliable) {
		this.avaliable = avaliable;
	}

	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}
	
}
<file_sep>/src/com/tz/xiyoulibrary/activity/mycollection/activity/view/IMyCollectionView.java
package com.tz.xiyoulibrary.activity.mycollection.activity.view;

import java.util.List;
import java.util.Map;

public interface IMyCollectionView {

	/**
	 * 显示收藏数据/获取数据成功
	 * 
	 * @param favoriteData
	 */
	void showFavoriteData(List<Map<String, String>> favoriteData);

	/**
	 * 获取数据失败
	 */
	void showGetDataFaluire();

	/**
	 * 当前没有收藏
	 */
	void showGetDataNoData();
	
	/**
	 * 显示获取视图
	 */
	void showLoadView();
	
	void showMsg(String msg);
}
<file_sep>/src/com/tz/xiyoulibrary/activity/homedetail/view/HomeDetailActivity.java
package com.tz.xiyoulibrary.activity.homedetail.view;

import java.util.Map;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.activity.baseactivity.BaseActivity;
import com.tz.xiyoulibrary.activity.homedetail.presenter.HomeDetailPresenter;
import com.tz.xiyoulibrary.titanicview.Titanic;
import com.tz.xiyoulibrary.titanicview.TitanicTextView;
import com.tz.xiyoulibrary.titanicview.Typefaces;
import com.tz.xiyoulibrary.toastview.CustomToast;
import com.tz.xiyoulibrary.utils.Constants;
import com.tz.xiyoulibrary.utils.LogUtils;

@SuppressLint("HandlerLeak")
@EActivity(R.layout.home_list_detail)
public class HomeDetailActivity extends BaseActivity implements IHomeDetailView {

	@ViewById(R.id.rl_back_actionbar)
	RelativeLayout mRelativeLayoutBack;
	@ViewById(R.id.tv_title_actionbar)
	TextView mTextViewTitle;

	Titanic mTitanic;
	@ViewById(R.id.loading_text)
	TitanicTextView mTitanicTextView;
	@ViewById(R.id.rl_loading)
	RelativeLayout mRelativeLayoutLoading;
	@ViewById(R.id.rl_load_faluire)
	RelativeLayout mRelativeLayoutLoadFaluire;
	@ViewById(R.id.rl_load_no_data)
	RelativeLayout mRelativeLayoutLoadNoData;
	@ViewById(R.id.tv_load_no_data_tip)
	TextView mTextViewTip;

	@ViewById(R.id.layout_homedetail)
	RelativeLayout layout_homedetail;
	@ViewById(R.id.homedetail)
	WebView homeDetailWebView;
	@ViewById(R.id.iv_home_moreoption)
	ImageView home_MoreOption;
	@ViewById(R.id.publisher)
	TextView homedetail_published;
	@ViewById(R.id.publish_date)
	TextView homedetail_publish_date;
	@ViewById(R.id.homeTitle)
	TextView homedetail_title;
	
	@ViewById(R.id.layout_publisher)
	LinearLayout layout_publisher;
	@ViewById(R.id.layout_publish_date)
	LinearLayout layout_publish_date;

	private String url;
	private HomeDetailPresenter mPresenter;
	private RequestQueue queue;
	private Map<String, String> detailMap;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		queue = Volley.newRequestQueue(HomeDetailActivity.this);
		url = Constants.GET_NEWS_DETAIL
				+ getIntent().getStringExtra("laterUrl");
		mPresenter = new HomeDetailPresenter(this);
		LogUtils.d("HomeDetailActivity : ", "传过来的url=" + url);

	}

	@AfterViews
	public void init() {
		homeDetailWebView.setVerticalScrollBarEnabled(false); // 垂直不显示 ,去掉垂直滚动条

		mTitanicTextView
				.setTypeface(Typefaces.get(this, "Satisfy-Regular.ttf"));
		mTitanic = new Titanic();
		mRelativeLayoutBack.setVisibility(View.VISIBLE);
		mTextViewTitle.setText("详情");
		mPresenter.getHomeDetailData(queue, url);
	}

	@Click(R.id.iv_home_moreoption)
	public void moreOption() {
		// 弹出更多选项

	}

	@Override
	public void showLoadingView() {
		mRelativeLayoutLoading.setVisibility(View.VISIBLE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mTitanic.start(mTitanicTextView);

	}

	@Override
	public void showMsg(String msg) {
		CustomToast.showToast(this, msg, 2000);
	}

	Handler handler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			layout_publisher.setVisibility(View.VISIBLE);
			layout_publish_date.setVisibility(View.VISIBLE);
			homedetail_published.setText(detailMap.get("Publisher"));
			homedetail_publish_date.setText(detailMap.get("Date"));
		};
	};

	@Override
	public void showDetailData(Map<String, String> detailMap) {

		// 关闭加载动画
		mTitanic.cancel();
		// 隐藏加载视图
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		this.detailMap = detailMap;
		
		homedetail_title.setText(detailMap.get("Title"));
		System.out.println("title = " + detailMap.get("Title"));
		System.out.println("passage = " + detailMap.get("Passage"));
		homeDetailWebView.loadDataWithBaseURL(null, detailMap.get("Passage"),
				"text/html", "utf-8", null);
		handler.sendEmptyMessageDelayed(0, 1000);
	}

	@Override
	public void showNoDataView() {
		mTitanic.cancel();
		mRelativeLayoutLoadNoData.setVisibility(View.VISIBLE);
		mTextViewTip.setText("哦啊~当前没有排行信息!");
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mRelativeLayoutLoading.setVisibility(View.GONE);

	}

	@Override
	public void showLoadFailView() {
		mTitanic.cancel();
		mRelativeLayoutLoadFaluire.setVisibility(View.VISIBLE);
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);

	}

	@Click(R.id.rl_back_actionbar)
	public void back() {
		finish();
	}

	@Click(R.id.rl_load_faluire)
	public void resetData() {
		mPresenter.getHomeDetailData(queue, url);

	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/bookdetial/view/ReferAdapter.java
package com.tz.xiyoulibrary.activity.bookdetial.view;

import java.util.List;
import java.util.Map;
import android.content.Context;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.utils.adapter.CommonAdapter;
import com.tz.xiyoulibrary.utils.adapter.ViewHolder;

public class ReferAdapter extends CommonAdapter<Map<String, String>> {

	public ReferAdapter(Context context, List<Map<String, String>> mDatas,
			int itemLayoutId) {
		super(context, mDatas, itemLayoutId);
	}

	@Override
	public void convert(ViewHolder helper, Map<String, String> map) {
		helper.setText(R.id.tv_title_item_refer, "¡¶"+map.get("Title")+"¡·");
		helper.setText(R.id.tv_author_item_refer, map.get("Author"));
		helper.setText(R.id.tv_id_item_refer, map.get("ID"));
	}

}
<file_sep>/src/com/tz/xiyoulibrary/bubblesbackview/BubbleBackView.java
package com.tz.xiyoulibrary.bubblesbackview;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import java.util.Random;
import com.tz.xiyoulibrary.R;

/**
 * Created by tianzhao on 2015/10/25. Date 21:38
 */
public class BubbleBackView extends View {

	private int circleSum;// 圆的数量
	private int circleRadio;// 圆的半径
	private int circleColor;// 圆的颜色
	private int backColor;// 背景颜色
	private Paint backPaint;// 背景画笔
	private Paint circlePaint;// 圆的画笔

	private Circle[] circles;
	private int[] direction = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };

	private Random random;

	private float width;
	private float height;
	private int[] location = new int[2];

	private MyThread mMyThread;
	private boolean running = true;

	public BubbleBackView(Context context) {
		super(context);
		backPaint = new Paint();
		init();
	}

	public BubbleBackView(Context context, AttributeSet attrs) {
		super(context, attrs);
		TypedArray ta = context.obtainStyledAttributes(attrs,
				R.styleable.BubbleBackView);
		circleSum = ta.getInteger(R.styleable.BubbleBackView_circleSum, 15);
		circleColor = ta.getColor(R.styleable.BubbleBackView_circleColor,
				Color.parseColor("#11ffffff"));
		backColor = ta.getColor(R.styleable.BubbleBackView_backColor,
				getResources().getColor(R.color.theme_color));
		circleRadio = ta.getInteger(R.styleable.BubbleBackView_circleRadio, 15);
		ta.recycle();
		init();
	}

	/**
	 * 初始化画笔
	 */
	private void init() {
		backPaint = new Paint();
		backPaint.setColor(backColor);

		circlePaint = new Paint();
		circlePaint.setColor(circleColor);
	}

	/**
	 * 比onDraw先执行
	 * <p/>
	 * 一个MeasureSpec封装了父布局传递给子布局的布局要求，每个MeasureSpec代表了一组宽度和高度的要求。
	 * 一个MeasureSpec由大小和模式组成
	 * 它有三种模式：UNSPECIFIED(未指定),父元素部队自元素施加任何束缚，子元素可以得到任意想要的大小;
	 * EXACTLY(完全)，父元素决定自元素的确切大小，子元素将被限定在给定的边界里而忽略它本身大小；
	 * AT_MOST(至多)，子元素至多达到指定大小的值。
	 * <p/>
	 * 　　它常用的三个函数： 1.static int getMode(int
	 * measureSpec):根据提供的测量值(格式)提取模式(上述三个模式之一) 2.static int getSize(int
	 * measureSpec):根据提供的测量值(格式)提取大小值(这个大小也就是我们通常所说的大小) 3.static int
	 * makeMeasureSpec(int size,int mode):根据提供的大小值和模式创建一个测量值(格式)
	 */
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		// 获取控件宽度
		width = getMeasuredWidth();
		// 获取控件高度
		height = getMeasuredHeight();
		// 获取控件相对于父控件的位置坐标
		this.getLocationInWindow(location);

		// 初始化圆
		initCircle();
	}

	/**
	 * 初始化圆
	 */
	private void initCircle() {
		circles = new Circle[circleSum];
		random = new Random();
		for (int i = 0; i < circleSum; i++) {
			int d = random.nextInt(direction.length);
			int x = random.nextInt((int) width);
			int y = random.nextInt((int) height);
			int r = random.nextInt(circleRadio) + circleRadio;
			circles[i] = new Circle(x, y, d, dpTopx(r));
		}
	}

	@Override
	protected void onDraw(Canvas canvas) {
		// 绘制背景
		canvas.drawRect(0, 0, location[0] + width, location[1] + height,
				backPaint);
		// 遍历绘制每一个圆
		for (Circle c : circles) {
			canvas.drawCircle(c.getX(), c.getY(), c.getR(), circlePaint);
		}
		if (mMyThread == null) {
			mMyThread = new MyThread();
			mMyThread.start();
		}
	}

	/**
	 * 不在窗口显示的时候停止线程
	 */
	@Override
	protected void onDetachedFromWindow() {
		running = false;
		super.onDetachedFromWindow();
	}

	class MyThread extends Thread {
		@Override
		public void run() {
			while (running) {
				for (int i = 0; i < circles.length; i++) {
					Circle c = circles[i];
					changeDirection(c);
					if (c.getY() < 0) {// 超出上边
						int d;
						while (true) {
							d = random.nextInt(direction.length);
							if (d % 2 != 0)
								break;
						}
						circles[i].setDirection(d);
					} else if (c.getY() > height) {// 超出下边
						int d;
						while (true) {
							d = random.nextInt(direction.length);
							if (d % 2 != 1)
								break;
						}
						circles[i].setDirection(d);
					} else if (c.getX() < 0) {// 超出左边
						int d;
						while (true) {
							d = random.nextInt(direction.length);
							if (d == 6 || d == 10 || d == 3 || d == 7
									|| d == 11)
								break;
						}
						circles[i].setDirection(d);
					} else if (c.getX() > width) {// 超出右边
						int d;
						while (true) {
							d = random.nextInt(direction.length);
							if (d == 4 || d == 8 || d == 2 || d == 5 || d == 9)
								break;
						}
						circles[i].setDirection(d);
					}
				}
				try {
					Thread.sleep(30);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				postInvalidate();
			}
		}

		private void changeDirection(Circle c) {
			float dx = 0.3f;
			int d;
			try {
				d = c.getDirection();
			} catch (Exception e) {
				d = 0;
			}
			switch (d) {
			case 0:// 上
				c.setY(c.getY() - dx);
				break;
			case 1:// 下
				c.setY(c.getY() + dx);
				break;
			case 2:// 左
				c.setX(c.getX() - dx);
				break;
			case 3:// 右
				c.setX(c.getX() + dx);
				break;
			case 4:// 左上
				c.setX(c.getX() - dx);
				c.setY(c.getY() - dx);
				break;
			case 5:// 左下
				c.setX(c.getX() - dx);
				c.setY(c.getY() + dx);
				break;
			case 6:// 右上
				c.setX(c.getX() + dx);
				c.setY(c.getY() - dx);
				break;
			case 7:// 右下
				c.setX(c.getX() + dx);
				c.setY(c.getY() + dx);
				break;
			case 8:// 左上
				c.setX(c.getX() - dx);
				c.setY(c.getY() - dx * 2);
				break;
			case 9:// 左下
				c.setX(c.getX() - dx * 2);
				c.setY(c.getY() + dx);
				break;
			case 10:// 右上
				c.setX(c.getX() + dx);
				c.setY(c.getY() - dx * 2);
				break;
			case 11:// 右下
				c.setX(c.getX() + dx);
				c.setY(c.getY() + dx * 2);
				break;
			}
		}
	}

	class Circle {
		private float x;
		private float y;
		private float r;
		private int direction = 0;

		public Circle(float x, float y, int d) {
			this.x = x;
			this.y = y;
			this.direction = d;
		}

		public Circle(float x, float y, int d, int r) {
			this.x = x;
			this.y = y;
			this.r = r;
			this.direction = d;
		}

		public float getX() {
			return x;
		}

		public void setX(float x) {
			this.x = x;
		}

		public void setY(float y) {
			this.y = y;
		}

		public float getY() {
			return y;
		}

		public void setDirection(int direction) {
			this.direction = direction;
		}

		public int getDirection() {
			return direction;
		}

		public float getR() {
			return r;
		}

		public void setR(float r) {
			this.r = r;
		}
	}

	private int dpTopx(int dp) {
		float scale = getResources().getDisplayMetrics().density;
		return (int) (dp * scale + 0.5f);
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/mybroorw/view/IMyborrowView.java
package com.tz.xiyoulibrary.activity.mybroorw.view;

import java.util.List;

import com.tz.xiyoulibrary.bean.BookBean;

public interface IMyborrowView {

	void showLoadingView();
	
	void showBorrowView(List<BookBean> borrowData);
	
	void showLoadFaluireView();
	
	void showNoDataView();
	
	void showMsg(String msg);
}
<file_sep>/src/com/tz/xiyoulibrary/activity/mybroorw/presenter/MyBorrowPresenter.java
package com.tz.xiyoulibrary.activity.mybroorw.presenter;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.activity.mybroorw.model.IMyBorrowModel;
import com.tz.xiyoulibrary.activity.mybroorw.model.MyBorrowModel;
import com.tz.xiyoulibrary.activity.mybroorw.view.IMyborrowView;

public class MyBorrowPresenter {

	private IMyborrowView mMyborrowView;
	private IMyBorrowModel mMyBorrowModel;

	public MyBorrowPresenter(IMyborrowView view) {
		this.mMyborrowView = view;
		mMyBorrowModel = new MyBorrowModel();
	}

	public void getBorrowData(RequestQueue queue) {
		mMyBorrowModel.getBorrowData(queue, new CallBack<MyBorrowModel>() {

			@Override
			public void getModel(MyBorrowModel model) {
				switch (model.status) {
				case IMyBorrowModel.LOADING:
					mMyborrowView.showLoadingView();
					break;
				case IMyBorrowModel.LOADING_FALUIRE:
					mMyborrowView.showLoadFaluireView();
					mMyborrowView.showMsg(model.msg);
					break;
				case IMyBorrowModel.NO_DATA:
					mMyborrowView.showNoDataView();
					break;
				case IMyBorrowModel.LOADING_SUCCESS:
					mMyborrowView.showBorrowView(model.borrowData);
					break;
				}
			}
		});
	}
}
<file_sep>/src/com/tz/xiyoulibrary/utils/Constants.java
package com.tz.xiyoulibrary.utils;

import android.os.Environment;

/**
 * 
 * @author tianzhao 全局常量
 */
public class Constants {

	// 请求网络超时时间
	public static final int TIMEOUT_MS = 10000;
	//当前版本号
	public static int versionCode;
	//当前版本名
	public static String versionName;
	//2G、3G、4G下是否下载图片
	public static boolean isLoadImg;
	//当前网络类型
	public static int network_type = 0x123;

	// 图片缓存路径
	public static final String IMG_CACHE_DIR_PATH = Environment
			.getExternalStorageDirectory().getPath() + "/xiyouLibrary";

	// 服务器地址
	private static final String ROOT_URL = "http://api.xiyoumobile.com/xiyoulibv2/";

	/***************************** 用户 ********************************/
	/**
	 * 登录
	 */
	public static final String GET_USER_LOGIN = ROOT_URL + "user/login";
	/**
	 * 用户信息
	 */
	public static final String GET_USER_INFO = ROOT_URL + "user/info";
	/**
	 * 修改密码
	 */
	public static final String GET_USER_MODIFY_PASSWORD = ROOT_URL + "user/modifyPassword";
	

	/***************************** 图书 ********************************/
	/**
	 * 用户借阅历史
	 */
	public static final String GET_BOOK_HISTORY = ROOT_URL + "user/history";
	/**
	 * 用户当前借阅情况
	 */
	public static final String GET_BOOK_RENT = ROOT_URL + "user/rent";
	/**
	 * 图书续借
	 */
	public static final String GET_BOOK_RENEW = ROOT_URL + "user/renew";
	/**
	 * 图书收藏
	 */
	public static final String GET_BOOK_FAVORITE = ROOT_URL + "user/favorite";
	/**
	 * 图书收藏(有图片)
	 */
	public static final String GET_BOOK_FAVORITE_IMG = ROOT_URL
			+ "user/favoriteWithImg";
	/**
	 * 添加图书收藏
	 */
	public static final String GET_BOOK_ADD_FAVORITE = ROOT_URL + "user/addFav";
	/**
	 * 删除图书收藏
	 */
	public static final String GET_BOOK_DELETE_FAVORITE = ROOT_URL
			+ "user/delFav";
	/**
	 * 图书检索
	 */
	public static final String GET_BOOK_SEARCH = ROOT_URL + "book/search";

	/**
	 * 图书详情by--barcode
	 * eg:http://api.xiyoumobile.com/xiyoulibv2/book/detail/Barcode/03277606
	 */
	public static final String GET_BOOK_DETAIL_BY_BARCODE = ROOT_URL
			+ "book/detail/Barcode/";
	/**
	 * 图书详情by--id
	 * eg:http://api.xiyoumobile.com/xiyoulibv2/book/detail/id/0100000015
	 */
	public static final String GET_BOOK_DETAIL_BY_ID = ROOT_URL
			+ "book/detail/id/";

	/**
	 * 图书排行榜
	 */
	public static final String GET_BOOK_RANK = ROOT_URL + "book/rank";

	/***************************** 新闻、公告 ********************************/
	/**
	 * 公告、新闻列表 参数1：type:news or announce 参数2：page:1、2、3......
	 * 新闻eg:http://api.xiyoumobile.com/xiyoulibv2/news/getList/news/1
	 * 公告eg:http://api.xiyoumobile.com/xiyoulibv2/news/getList/announce/1
	 */
	public static final String GET_NEWS_LIST = ROOT_URL + "news/getList/";
	/**
	 * 公告、新闻详情 参数1：type:news or announce 参数2：format:text or html 参数3：id
	 * 新闻eg:http://api.xiyoumobile.com/xiyoulibv2/news/getDetail/news/text/132
	 * 公告eg
	 * :http://api.xiyoumobile.com/xiyoulibv2/news/getDetail/announce/html/200
	 */
	public static final String GET_NEWS_DETAIL = ROOT_URL + "news/getDetail/";
	
	

}
<file_sep>/src/com/tz/xiyoulibrary/activity/bookdetial/model/IBookDetialModel.java
package com.tz.xiyoulibrary.activity.bookdetial.model;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;

public interface IBookDetialModel {
	static final int LOADING_SUCCESS = 0;
	static final int LOADING_FALUIRE = 1;
	static final int NO_DATA = 2;
	static final int LOADING = 3;

	void getBookDetial(RequestQueue queue,String url, CallBack<BookDetialModel> callBack);
	
	void collection(RequestQueue queue,String id,CallBack<BookDetialModel> callBack);
}
<file_sep>/src/com/tz/xiyoulibrary/dialog/progressbar/MyProgressBar.java
package com.tz.xiyoulibrary.dialog.progressbar;

import com.tz.xiyoulibrary.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

public class MyProgressBar extends Dialog {

	private TextView textView;

	public MyProgressBar(Context context) {
		super(context, R.style.MyDialog);
		setCancelable(false);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.progressbar);
		textView = (TextView) findViewById(R.id.tv_progressbar2_msg);
	}

	public void setCurrProgress(int curr) {
		textView.setText(curr + "%");
	}
}
<file_sep>/src/com/tz/xiyoulibrary/application/Application.java
package com.tz.xiyoulibrary.application;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.view.View;
import android.widget.ImageView;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.Request.Method;
import com.android.volley.Response.Listener;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.avos.avoscloud.AVOSCloud;
import com.baidu.batsdk.BatSDK;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.activity.event.LoginSuccessEvent;
import com.tz.xiyoulibrary.bean.UserBean;
import com.tz.xiyoulibrary.utils.ConfigFile;
import com.tz.xiyoulibrary.utils.Constants;
import com.tz.xiyoulibrary.utils.LogUtils;
import com.tz.xiyoulibrary.utils.UpDateUtils;
import com.ypy.eventbus.EventBus;

public class Application extends android.app.Application {

	// 百度统计appkey
	private static final String BAIDU_APP_KEY = "<KEY>";
	public static final String BAIDU_REPORTID = "af8750724a";
	// LeanCloud
	private static final String LEANCLOUD_APP_ID = "9cgrBU19DR43tPm4N47koSDi";
	private static final String LEANCLOUD_APP_KEY = "<KEY>";

	public static String SESSION = "";
	public static String USERNAME = "";
	public static UserBean user;
	public static String HOME_RESPONSE = "";
	public static List<Map<String, Object>> HOME_NOTICE_LIST;
	public static List<Map<String, Object>> HOME_NEWS_LIST;
	public static List<View> homeAdViews;
	private int[] homeAdViewsId = { R.drawable.home_image1,
			R.drawable.home_image2, R.drawable.home_image3 };
	public static List<View> settingAdViews;
	private int[] settingAdViewsId = { R.drawable.h1, R.drawable.h3,
			R.drawable.h5 };

	private RequestQueue queue;

	@Override
	public void onCreate() {
		super.onCreate();
		queue = Volley.newRequestQueue(this);
		/**
		 * 初始化配置信息
		 */
		initConfig();
		/**
		 * 获取版本信息
		 */
		initVersion();

		/**
		 * 初始化轮播图片的数据
		 */
		initAdViews();
		/**
		 * 初始化百度统计
		 */
		BatSDK.init(this, BAIDU_APP_KEY);
		/**
		 * 初始化LeanCloud统计
		 */
		AVOSCloud.initialize(this, LEANCLOUD_APP_ID, LEANCLOUD_APP_KEY);
		AVOSCloud.setLastModifyEnabled(true);
		AVOSCloud.setDebugLogEnabled(true);

		/**
		 * 检查更新
		 */
		UpDateUtils.checkUpdate();
		/**
		 * 自动登录
		 */
		autoLogin();
	}


	/**
	 * 自动登录
	 */
	private void autoLogin() {
		if (!ConfigFile.getIsAutoLogin(this)
				|| ConfigFile.getPassword(this).equals(""))
			return;
		final String username = ConfigFile.getUsername(this);
		final String password = ConfigFile.getPassword(this);
		StringRequest request = new StringRequest(Method.POST,
				Constants.GET_USER_LOGIN, new Listener<String>() {

					@Override
					public void onResponse(String response) {
						LogUtils.d("LoginResponse:", response);
						try {
							JSONObject o = new JSONObject(response);
							if (o.getBoolean("Result")) {
								SESSION = o.getString("Detail");
								USERNAME = username;
								getUserInfo();
							}
						} catch (JSONException e) {
							e.printStackTrace();
						}

					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {
						error.printStackTrace();
					}
				}) {
			@Override
			protected Map<String, String> getParams() throws AuthFailureError {
				Map<String, String> map = new HashMap<String, String>();
				map.put("username", username);
				map.put("password", <PASSWORD>);
				return map;
			}
		};
		request.setRetryPolicy(new DefaultRetryPolicy(Constants.TIMEOUT_MS,
				DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
				DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
		queue.add(request);
	}

	public void getUserInfo() {
		StringRequest request = new StringRequest(Method.POST,
				Constants.GET_USER_INFO, new Listener<String>() {

					@Override
					public void onResponse(String response) {
						LogUtils.d("LoginResponse:", response);
						try {
							JSONObject o = new JSONObject(response);
							if (o.getBoolean("Result")) {
								JSONObject info = o.getJSONObject("Detail");
								UserBean user = new UserBean();
								user.setId(info.getString("ID"));
								user.setName(info.getString("Name"));
								user.setFromData(info.getString("From"));
								user.setToData(info.getString("To"));
								user.setReaderType(info.getString("ReaderType"));
								user.setDepartment(info.getString("Department"));
								user.setDebt(info.get("Debt") + "");
								Application.user = user;
								EventBus.getDefault().post(
										new LoginSuccessEvent());
							}
						} catch (JSONException e) {
							e.printStackTrace();
						}

					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {
						error.printStackTrace();
					}
				}) {
			@Override
			protected Map<String, String> getParams() throws AuthFailureError {
				Map<String, String> map = new HashMap<String, String>();
				map.put("session", SESSION);
				return map;
			}
		};
		queue.add(request);
	}

	private void initConfig() {
		/**
		 * 初始化配置信息
		 */
		Constants.isLoadImg = ConfigFile.getNet(this);
		ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
		NetworkInfo ni = cm.getActiveNetworkInfo();
		if (ni != null)
			Constants.network_type = ni.getType();
	}

	/**
	 * 获取版本信息
	 */
	private void initVersion() {
		try {
			PackageManager pm = getPackageManager();
			PackageInfo pi = pm.getPackageInfo(getPackageName(), 0);
			Constants.versionCode = pi.versionCode;
			Constants.versionName = pi.versionName;
			LogUtils.d("Version", "versionCode : " + Constants.versionCode
					+ "  versionName : " + Constants.versionName);
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 初始化轮播图片的数据
	 */
	public void initAdViews() {
		// 初始化首页图片数据
		homeAdViews = new ArrayList<View>();
		for (int i = 0; i < homeAdViewsId.length; i++) {
			ImageView imageView = new ImageView(this);
			imageView.setBackgroundResource(homeAdViewsId[i]);
			homeAdViews.add(imageView);
		}

		// 初始化设置图片数据
		settingAdViews = new ArrayList<View>();
		for (int i = 0; i < settingAdViewsId.length; i++) {
			ImageView imageView = new ImageView(this);
			imageView.setBackgroundResource(settingAdViewsId[i]);
			settingAdViews.add(imageView);
		}
	}
}
<file_sep>/src/com/tz/xiyoulibrary/fragment/home/model/HomeModel.java
package com.tz.xiyoulibrary.fragment.home.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.application.Application;
import com.tz.xiyoulibrary.utils.Constants;

public class HomeModel implements IHomeModel{
	public int status;
	public String message;
	
	String partUrl = Constants.GET_NEWS_LIST;
	String url;
	
	public Map<String,Object> map = new HashMap<String, Object>();
	public List<Map<String,Object>> list;

//	网络请求
	@Override
	public void getHomeData(RequestQueue queue,final int CurrentPage ,final int whichTag,
			final CallBack<HomeModel> callBack) {
		// TODO Auto-generated method stub
		status = IHomeModel.LOADING;
		callBack.getModel(this);
		if(whichTag == 0)
			url = partUrl + "announce/"+CurrentPage;
		else
			url = partUrl + "news/"+CurrentPage;
		System.out.println("当前url="+url);
		
		StringRequest request  = new StringRequest(url, new Response.Listener<String>() {

			@Override
			public void onResponse(String response) {
				System.out.println(response);
				getDataByJson(response,callBack,whichTag,LOADING_SUCCESS);
				
			}
		}, new Response.ErrorListener() {

			@Override
			public void onErrorResponse(VolleyError error) {
				status = LOADING_FALUIRE;
				message = "网络异常";
				callBack.getModel(HomeModel.this);
				
			}
		});
		
		request.setRetryPolicy(new DefaultRetryPolicy(Constants.TIMEOUT_MS,
				DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
				DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
		queue.add(request);
		
	}
	
//解析数据
	protected void getDataByJson(String response,CallBack<HomeModel> callBack,int whichTag,int what) {
		
		list = new ArrayList<Map<String,Object>>();
		try {
			JSONObject obj1 = new JSONObject(response);
			if(obj1.getBoolean("Result")){
//				用于判断是否需要再请求
				Application.HOME_RESPONSE = response;
				
				JSONObject obj2 = obj1.getJSONObject("Detail");
				map.put("CurrentPage", obj2.getInt("CurrentPage"));
				map.put("Pages", obj2.get("Pages"));
				map.put("Amount", obj2.get("Amount"));
				JSONArray arr = obj2.getJSONArray("Data");
				for (int i = 0; i < arr.length(); i++) {
					JSONObject obj3 = arr.getJSONObject(i);
					Map<String, Object> map0 = new HashMap<String, Object>();
					map0.put("ID", obj3.getInt("ID"));
					map0.put("Title", obj3.getString("Title"));
					map0.put("Date", obj3.getString("Date"));
					list.add(map0);
				}
				map.put("Detail", list);
				status = what;
				if(whichTag == 0){
					System.out.println("whichTag = 0  ");
					Application.HOME_NOTICE_LIST = list;
				}else{
					System.out.println("whichTag = 1");
					Application.HOME_NEWS_LIST = list;
				}
				
			}else{
				status = REFER_FALUIRE;
				message = "获取信息失败";
				
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			status = REFER_FALUIRE;
			message = "获取信息失败";
			
		}
		callBack.getModel(HomeModel.this);
		
		
	}


//	刷新数据
	@Override
	public void refershHomeData(RequestQueue queue, int CurrentPage,final int whichTag,final int what,
			final CallBack<HomeModel> callBack) {
		if(whichTag == 0)
			url = partUrl + "announce/"+CurrentPage;
		else
			url = partUrl + "news/"+CurrentPage;
		System.out.println("刷新的url="+url);
		
		StringRequest request  = new StringRequest(url, new Response.Listener<String>() {

			@Override
			public void onResponse(String response) {
				System.out.println(response);
				getDataByJson(response,callBack,whichTag,what);
				
			}
		}, new Response.ErrorListener() {

			@Override
			public void onErrorResponse(VolleyError error) {
				status = REFER_FALUIRE;
				message = "网络请求错误";
				callBack.getModel(HomeModel.this);
				
			}
		});
		queue.add(request);
			
	}

//	@Override
//	public int getItemId(int position) {
//		// TODO Auto-generated method stub
//		System.out.println("getItemId = "+(Integer) list.get(position).get("ID"));
//		return (Integer) list.get(position).get("ID");
//	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/search/presenter/SearchPresenter.java
package com.tz.xiyoulibrary.activity.search.presenter;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.activity.search.model.ISearchModel;
import com.tz.xiyoulibrary.activity.search.model.SearchModel;
import com.tz.xiyoulibrary.activity.search.view.ISearchView;

public class SearchPresenter {
	public ISearchModel searchModel;
	public ISearchView searchView;
	public CallBack<SearchModel> callBack;
	
	public SearchPresenter(ISearchView view){
		this.searchView = view;
		searchModel = new SearchModel();
		callBack = new CallBack<SearchModel>() {

			@Override
			public void getModel(SearchModel model) {
				// TODO Auto-generated method stub
				switch (model.status) {
				case ISearchModel.SEARCH_FAILURE:
//					不再显示
					System.out.println("failure");
					break;
				case ISearchModel.SEARCH_NO_DATA:
					System.out.println("没有数据");
					searchView.showNoDataView();
					break;
				case ISearchModel.SEARCH_SUCCESS:
					System.out.println("进入success");
					searchView.showBookListView(model.contentList);
					System.out.println("list="+model.contentList);
					
					break;
				
				}
				
			}
		};
	}
	
	public void getSearchList(RequestQueue queue,String keyword){
		searchModel.SearchQuery(queue,keyword , callBack);
		
		
	}
	public String getItemId(int position){
		return searchModel.getId(position);
		
	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/mybroorw/view/MyBorrowActivity.java
package com.tz.xiyoulibrary.activity.mybroorw.view;

import java.util.List;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.ViewById;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.activity.baseactivity.BaseActivity;
import com.tz.xiyoulibrary.activity.bookdetial.view.BookDetialActivity_;
import com.tz.xiyoulibrary.activity.mybroorw.presenter.MyBorrowPresenter;
import com.tz.xiyoulibrary.bean.BookBean;
import com.tz.xiyoulibrary.titanicview.Titanic;
import com.tz.xiyoulibrary.titanicview.TitanicTextView;
import com.tz.xiyoulibrary.titanicview.Typefaces;
import com.tz.xiyoulibrary.toastview.CustomToast;
import com.tz.xiyoulibrary.utils.BitmapCache;
import com.tz.xiyoulibrary.utils.Constants;

/**
 * 
 * @author Administrator 我的借阅
 */
@EActivity(R.layout.activity_myborrow)
public class MyBorrowActivity extends BaseActivity implements IMyborrowView {

	@ViewById(R.id.rl_back_actionbar)
	RelativeLayout mRelativeLayoutBack;
	@ViewById(R.id.tv_title_actionbar)
	TextView mTextViewTitle;

	@ViewById(R.id.lv_borrow_activity_myborrow)
	ListView mListViewBorrow;
	private MyBorrowAdapter mMyBorrowAdapter;
	private RequestQueue queue;
	private ImageLoader imageLoader;
	private MyBorrowPresenter mPresenter;

	private Titanic mTitanic;
	@ViewById(R.id.loading_text)
	TitanicTextView mTitanicTextView;

	@ViewById(R.id.rl_loading)
	RelativeLayout mRelativeLayoutLoading;
	@ViewById(R.id.rl_load_faluire)
	RelativeLayout mRelativeLayoutLoadFaluire;
	@ViewById(R.id.rl_load_no_data)
	RelativeLayout mRelativeLayoutLoadNoData;
	@ViewById(R.id.tv_load_no_data_tip)
	TextView mTextViewTip;

	private List<BookBean> borrowData;

	private int borrow = 0;// 已借图书数量
	private int canBorrow = 0;// 剩余可借数量
	private int renewBorrow = 0;// 续借图书数量
	private int exceedBorrow = 0;// 超期图书数量

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		mPresenter = new MyBorrowPresenter(this);
		queue = Volley.newRequestQueue(MyBorrowActivity.this);
		imageLoader = new ImageLoader(queue, new BitmapCache());
	}

	@AfterViews
	public void initWidgetAfter() {
		mTitanicTextView
				.setTypeface(Typefaces.get(this, "Satisfy-Regular.ttf"));
		mTitanic = new Titanic();
		mRelativeLayoutBack.setVisibility(View.VISIBLE);
		mTextViewTitle.setText("我的借阅");
		// 获取借阅数据
		getBorrowData();
	}

	/**
	 * 获取借阅数据
	 */
	private void getBorrowData() {
		mPresenter.getBorrowData(queue);
	}

	@Click(R.id.rl_back_actionbar)
	public void back() {
		finish();
	}

	@ItemClick(R.id.lv_borrow_activity_myborrow)
	public void pushBookDetial(int position) {
		if (position == 0)
			return;
		Intent intent = new Intent(MyBorrowActivity.this,
				BookDetialActivity_.class);
		intent.putExtra("url", Constants.GET_BOOK_DETAIL_BY_BARCODE
				+ borrowData.get(position - 1).getBarCode());
		startActivity(intent);
	}

	@Click(R.id.rl_load_faluire)
	public void resetLoad() {
		// 重新加载
		getBorrowData();
	}

	@Override
	public void showLoadingView() {
		mRelativeLayoutLoading.setVisibility(View.VISIBLE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mTitanic.start(mTitanicTextView);
	}

	@Override
	public void showBorrowView(List<BookBean> borrowData) {
		// 关闭加载动画
		mTitanic.cancel();
		// 隐藏加载视图
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		this.borrowData = borrowData;
		// 初始化借阅数量
		initBorrowCount();
		LayoutInflater inflater = LayoutInflater.from(MyBorrowActivity.this);

		// 添加头布局
		LinearLayout head = (LinearLayout) inflater.inflate(
				R.layout.activity_myborrow_head, null);
		TextView tv_borrow = (TextView) head
				.findViewById(R.id.tv_borrow_book_activity_my_borrow);
		tv_borrow.setText("已借图书：   " + borrow + "本");
		TextView tv_can_borrow = (TextView) head
				.findViewById(R.id.tv_can_borrow_book_activity_my_borrow);
		tv_can_borrow.setText("剩余可借：   " + canBorrow + "本");
		TextView tv_renew_borrow = (TextView) head
				.findViewById(R.id.tv_renew_book_activity_my_borrow);
		tv_renew_borrow.setText("续借图书：   " + renewBorrow + "本");
		TextView tv_exceed_borrow = (TextView) head
				.findViewById(R.id.tv_exceed_book_activity_my_borrow);
		tv_exceed_borrow.setText("超期图书：   " + exceedBorrow + "本");

		mListViewBorrow.addHeaderView(head);

		mMyBorrowAdapter = new MyBorrowAdapter(MyBorrowActivity.this,
				this.borrowData, R.layout.item_activity_myborrow, imageLoader,queue);
		mListViewBorrow.setAdapter(mMyBorrowAdapter);
	}

	private void initBorrowCount() {
		borrow = borrowData.size();
		canBorrow = 15 - borrow;
		for (BookBean b : borrowData) {
			if (b.getState().equals("本馆续借")) {
				renewBorrow++;
			} else if (b.getState().equals("过期暂停")) {
				exceedBorrow++;
			}
		}
	}

	@Override
	public void showLoadFaluireView() {
		mTitanic.cancel();
		mRelativeLayoutLoadFaluire.setVisibility(View.VISIBLE);
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
	}

	@Override
	public void showNoDataView() {
		mTitanic.cancel();
		mRelativeLayoutLoadNoData.setVisibility(View.VISIBLE);
		mTextViewTip.setText("亲！您当前没有借阅书籍哦~");
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mRelativeLayoutLoading.setVisibility(View.GONE);
	}

	@Override
	public void showMsg(String msg) {
		CustomToast.showToast(this, msg, 2000);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		queue.cancelAll(this);
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/bookdetial/model/BookDetialModel.java
package com.tz.xiyoulibrary.activity.bookdetial.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.Request.Method;
import com.android.volley.toolbox.StringRequest;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.application.Application;
import com.tz.xiyoulibrary.utils.Constants;
import com.tz.xiyoulibrary.utils.JsonUtils;
import com.tz.xiyoulibrary.utils.LogUtils;

public class BookDetialModel implements IBookDetialModel {

	public int state;
	public String msg;
	public Map<String, Object> bookDetial;

	@Override
	public void getBookDetial(RequestQueue queue, String url,
			final CallBack<BookDetialModel> callBack) {
		state = LOADING;
		callBack.getModel(this);
		StringRequest request = new StringRequest(Method.POST, url,
				new Response.Listener<String>() {

					@Override
					public void onResponse(String response) {
						LogUtils.d("getBookDetial:", response);
						// 解析数据
						formatBookDetialDataByJson(response, callBack);
					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {
						state = LOADING_FALUIRE;
						msg = "加载失败";
						callBack.getModel(BookDetialModel.this);
					}
				});
		request.setRetryPolicy(new DefaultRetryPolicy(Constants.TIMEOUT_MS,
				DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
				DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
		queue.add(request);
	}

	@Override
	public void collection(RequestQueue queue, final String id,
			final CallBack<BookDetialModel> callBack) {
		state = LOADING;
		callBack.getModel(this);
		StringRequest request = new StringRequest(Method.POST,
				Constants.GET_BOOK_ADD_FAVORITE,
				new Response.Listener<String>() {

					@Override
					public void onResponse(String response) {
						LogUtils.d("collection:", response);
						// 解析数据
						formatCollectionDataByJson(response, callBack);
					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {
						state = LOADING_FALUIRE;
						msg = "网络异常";
						callBack.getModel(BookDetialModel.this);
					}
				}) {
			@Override
			protected Map<String, String> getParams() throws AuthFailureError {
				Map<String, String> map = new HashMap<String, String>();
				map.put("session", Application.SESSION);
				map.put("id", id);
				return map;
			}
		};
		request.setRetryPolicy(new DefaultRetryPolicy(Constants.TIMEOUT_MS,
				DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
				DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
		queue.add(request);
	}

	/**
	 * 解析收藏数据
	 */
	protected void formatCollectionDataByJson(String response,
			CallBack<BookDetialModel> callBack) {
		try {
			JSONObject o = new JSONObject(response);
			if (o.getBoolean("Result")) {
				state = LOADING_SUCCESS;
				msg = getMsgByDetial(o.getString("Detail"));
			} else {
				state = LOADING_FALUIRE;
				msg = "收藏失败";
			}
		} catch (Exception e) {
			e.printStackTrace();
			state = LOADING_FALUIRE;
			msg = "收藏失败";
		}
		callBack.getModel(this);
	}

	private String getMsgByDetial(String detial) {
		String s = null;
		if (detial.equals("ADDED_SUCCEED")) {
			s = "收藏成功";
		} else if (detial.equals("ALREADY_IN_FAVORITE")) {
			s = "已经收藏过了";
		} else if (detial.equals("USER_NOT_LOGIN")) {
			s = "用户登录失效,请重新登录";
		} else if (detial.equals("PARAM_ERROR")) {
			s = "参数错误，缺少参数";
		} else {
			s = "收藏失败";
		}
		return s;
	}

	/**
	 * 解析获取详情信息数据
	 */
	protected void formatBookDetialDataByJson(String response,
			CallBack<BookDetialModel> callBack) {
		try {
			JSONObject o = new JSONObject(response);
			if (o.getBoolean("Result")) {
				bookDetial = new HashMap<String, Object>();
				try {
					JSONObject o2 = o.getJSONObject("Detail");
					bookDetial.put("Title", o2.getString("Title"));
					try {
						bookDetial.put("Pub", o2.getString("Pub"));
					} catch (Exception e) {
						bookDetial.put("Pub", "暂无");
					}
					try {
						bookDetial.put("Summary", o2.getString("Summary"));
					} catch (Exception e) {
						bookDetial.put("Summary", "暂无");
					}
					try {
						bookDetial.put("Sort", o2.getString("Sort"));
					} catch (Exception e) {
						bookDetial.put("Sort", "暂无");
					}
					try {
						bookDetial.put("ISBN", o2.getString("ISBN"));
					} catch (Exception e) {
						bookDetial.put("ISBN", "暂无");
					}
					try {
						bookDetial.put("Author", o2.getString("Author"));
					} catch (Exception e) {
						bookDetial.put("Author", "暂无");
					}
					try {
						bookDetial.put("ID", o2.getString("ID"));
					} catch (Exception e) {
						bookDetial.put("ID", "暂无");
					}
					try {
						bookDetial.put("Form", o2.getString("Form"));
					} catch (Exception e) {
						bookDetial.put("Form", "暂无记录");
					}
					try {
						bookDetial.put("Subject", o2.getString("Subject"));
					} catch (Exception e) {
						bookDetial.put("Subject", "暂无记录");
					}
					try {
						bookDetial.put("RentTimes", o2.getString("RentTimes"));
					} catch (Exception e) {
						bookDetial.put("RentTimes", "暂无");
					}
					try {
						bookDetial.put("FavTimes", o2.getString("FavTimes"));
					} catch (Exception e) {
						bookDetial.put("FavTimes", "暂无");
					}
					try {
						bookDetial.put("BrowseTimes",
								o2.getString("BrowseTimes"));
					} catch (Exception e) {
						bookDetial.put("BrowseTimes", "暂无");
					}
					try {
						bookDetial.put("Total", o2.getString("Total"));
					} catch (Exception e) {
						bookDetial.put("Total", "暂无");
					}
					try {
						bookDetial.put("Avaliable", o2.getString("Avaliable"));
					} catch (Exception e) {
						bookDetial.put("Avaliable", "暂无");
					}
					// 流通信息数组
					LogUtils.d("BookDetial", "开始解析流通信息");
					JSONArray array = o2.getJSONArray("CirculationInfo");
					List<Map<String, String>> circulationInfoList = new ArrayList<Map<String, String>>();
					int size = array.length() > 50 ? 50 : array.length();
					for (int i = 0; i < size; i++) {
						JSONObject o3 = array.getJSONObject(i);
						Map<String, String> map = new HashMap<String, String>();
						map.put("Barcode", o3.getString("Barcode"));
						map.put("Sort", o3.getString("Sort"));
						map.put("Department", o3.getString("Department"));
						map.put("Status", o3.getString("Status"));
						map.put("Date", o3.getString("Date"));
						circulationInfoList.add(map);
					}
					bookDetial.put("CirculationInfo", circulationInfoList);
					LogUtils.d("BookDetial", "流通信息解析完成");
					LogUtils.d("BookDetial", "开始解析相关图书数据");
					// 相关图书信息数组
					JSONArray array2 = o2.getJSONArray("ReferBooks");
					List<Map<String, String>> referBooksList = new ArrayList<Map<String, String>>();
					for (int i = 0; i < array2.length(); i++) {
						JSONObject o3 = array2.getJSONObject(i);
						Map<String, String> map = new HashMap<String, String>();
						map.put("ID", o3.getString("ID"));
						map.put("Title", o3.getString("Title"));
						map.put("Author", o3.getString("Author"));
						referBooksList.add(map);
					}
					bookDetial.put("ReferBooks", referBooksList);
					LogUtils.d("BookDetial", "相关推荐解析完成");
					LogUtils.d("BookDetial", "开始解析来自豆瓣的数据");
					// 来自豆瓣的信息，没有该书则为null
					try {
						JSONObject o3 = o2.getJSONObject("DoubanInfo");
						if (o3.getString("Pages").equals("null")
								|| o3.getString("Pages").equals("")) {
							bookDetial.put("Pages", "暂无记录");
						} else {
							bookDetial.put("Pages", o3.getString("Pages")
									+ " 页");
						}
						try {
							JSONObject o4 = o3.getJSONObject("Images");
							bookDetial.put("medium", o4.getString("large"));
							// bookDetial.put("small", o3.getString("small"));
							// bookDetial.put("large", o3.getString("large"));
						} catch (Exception e) {
							bookDetial.put("medium", "");
							e.printStackTrace();
							LogUtils.d("BookDetial", "解析豆瓣书籍图片异常");
						}
						bookDetial.put("Summary", o3.getString("Summary"));
						bookDetial.put("Author_Info",
								o3.getString("Author_Info"));
					} catch (Exception e) {
						bookDetial.put("Summary", "暂无");
						bookDetial.put("Author_Info", "暂无");
						bookDetial.put("Pages", "暂无记录");
						bookDetial.put("medium", "");
					}
					state = LOADING_SUCCESS;
				} catch (Exception e) {
					Object[] object = JsonUtils.getErrorMsg(o
							.getString("Detail"));
					state = (Integer) object[0];
					msg = (String) object[1];
				}
			} else {
				state = LOADING_FALUIRE;
				msg = "获取信息失败";
			}
		} catch (Exception e) {
			e.printStackTrace();
			state = LOADING_FALUIRE;
			msg = "获取信息失败";
		}
		callBack.getModel(this);
	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/login/presenter/LoginPresenter.java
package com.tz.xiyoulibrary.activity.login.presenter;

import android.content.Context;
import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.activity.login.model.ILoginModel;
import com.tz.xiyoulibrary.activity.login.model.LoginModel;
import com.tz.xiyoulibrary.activity.login.view.ILoginView;

public class LoginPresenter {

	private ILoginView mLoginView;
	private ILoginModel mLoginModel;

	public LoginPresenter(ILoginView view) {
		this.mLoginView = view;
		mLoginModel = new LoginModel();
	}

	public void Login(RequestQueue queue) {
		mLoginModel.login(queue, mLoginView.getUsername(), mLoginView.getPassword(),
				new CallBack<LoginModel>() {

					@Override
					public void getModel(LoginModel model) {
						switch (model.state) {
						case ILoginModel.LOGIN_ING:
							mLoginView.showDialog();
							break;
						case ILoginModel.LOGIN_FAILURE:
						case ILoginModel.ACCOUNT_ERROR:
							mLoginView.hideDialog();
							mLoginView.showMsg(model.msg);
							break;
						case ILoginModel.LOGIN_SUCCESS:
							mLoginView.hideDialog();
							mLoginView.pushMainActivity();
							break;
						}
					}
				});
	}
	
	public void setUsername(Context context) {
		mLoginView.setUsername(mLoginModel.getUsername(context));
	}

	public void setPassword(Context context) {
		mLoginView.setPassword(mLoginModel.getPassword(context));
	}

	public void setIsSavePass(Context context) {
		mLoginView.setIsSavePass(mLoginModel.getIsSavePass(context));
	}

	public void saveIsSavePass(Context context) {
		mLoginModel.setIsSavePass(context, mLoginView.getIsSavePass());
	}
	public void setIsAutoLogin(Context context) {
		mLoginView.setIsAutoLogin(mLoginModel.getIsAutoLogin(context));
	}

	public void saveIsAutoLogin(Context context) {
		mLoginModel.setIsAutoLogin(context, mLoginView.getIsAutoLogin());
	}

	public void saveUsernameAndPassword(Context context) {
		mLoginModel.saveUsernameAndPassword(context, mLoginView.getUsername(),
				mLoginView.getPassword());
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/homedetail/presenter/HomeDetailPresenter.java
package com.tz.xiyoulibrary.activity.homedetail.presenter;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.activity.homedetail.model.HomeDetailModel;
import com.tz.xiyoulibrary.activity.homedetail.model.IHomeDetailModel;
import com.tz.xiyoulibrary.activity.homedetail.view.IHomeDetailView;

public class HomeDetailPresenter {
	IHomeDetailModel detailModel;
	IHomeDetailView detailView;
	
	public HomeDetailPresenter(IHomeDetailView view){
		detailModel = new HomeDetailModel();
		this.detailView = view;
	}
	
	
	
	public void getHomeDetailData(RequestQueue queue,String url){
		detailModel.getDetailData(queue, url, new CallBack<HomeDetailModel>() {
			
			@Override
			public void getModel(HomeDetailModel model) {
				// TODO Auto-generated method stub
				switch (model.status) {
				case IHomeDetailModel.LOADING:
					detailView.showLoadingView();
					break;
				case IHomeDetailModel.LOADING_FALUIRE:
					detailView.showLoadFailView();
					detailView.showMsg(model.message);
					break;
				case IHomeDetailModel.LOADING_SUCCESS:
					System.out.println("已经到presenter的加载成功");
					detailView.showDetailData(model.detailMap);
					break;
				case IHomeDetailModel.NO_DATA:
					detailView.showNoDataView();
					break;
				}
			}
		});
		
		
	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/callback/CallBack.java
package com.tz.xiyoulibrary.activity.callback;

public interface CallBack<T> {
	public void getModel(T model);
}
<file_sep>/src/com/tz/xiyoulibrary/activity/rank/view/IRankView.java
package com.tz.xiyoulibrary.activity.rank.view;

import java.util.List;
import java.util.Map;

public interface IRankView {
	void showLoadingView();

	void showRankView(List<Map<String, String>> rankData);

	void showLoadFaluireView();

	void showNoDataView();

	void showMsg(String msg);

	void showRefershFaluireView();

	void showUpRefershView(List<Map<String, String>> rankData);

	void showDownRefershView(List<Map<String, String>> rankData);
}
<file_sep>/src/com/tz/xiyoulibrary/activity/myfoot/view/MyFootAdapter.java
package com.tz.xiyoulibrary.activity.myfoot.view;

import java.util.List;

import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;

import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.bean.BookBean;
import com.tz.xiyoulibrary.utils.adapter.CommonAdapter;
import com.tz.xiyoulibrary.utils.adapter.ViewHolder;

public class MyFootAdapter extends CommonAdapter<BookBean> {

	private ImageLoader imageLoader;

	public MyFootAdapter(Context context, List<BookBean> mDatas,
			int itemLayoutId, ImageLoader imageLoader) {
		super(context, mDatas, itemLayoutId);
		this.imageLoader = imageLoader;
	}

	@Override
	public void convert(ViewHolder helper, BookBean b) {
		helper.setText(R.id.tv_book_title_item_myfoot, b.getTitle());
		helper.setText(R.id.tv_book_author_item_myborrow, b.getState());
		helper.setText(R.id.tv_book_pub_item_myfoot, b.getDate());
		helper.setText(R.id.tv_book_id_item_myfoot, b.getBarCode());
		ImageView bookImg = helper.getView(R.id.iv_book_img_item_myfoot);
		String imgUrl = b.getImgUrl();
		bookImg.setTag(imgUrl);
		if (TextUtils.equals(imgUrl, "")) {
			bookImg.setBackgroundResource(R.drawable.img_book_no);
		} else if (bookImg.getTag().toString().equals(imgUrl)) {
			ImageListener imageListener = ImageLoader.getImageListener(bookImg,
					R.drawable.img_book, R.drawable.img_book_no);
			imageLoader.get(imgUrl, imageListener, 240, 320);
		}
	}

}
<file_sep>/src/com/tz/xiyoulibrary/activity/login/model/LoginModel.java
package com.tz.xiyoulibrary.activity.login.model;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;

import com.android.volley.AuthFailureError;
import com.android.volley.Request.Method;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.tz.xiyoulibrary.activity.callback.CallBack;
import com.tz.xiyoulibrary.application.Application;
import com.tz.xiyoulibrary.bean.UserBean;
import com.tz.xiyoulibrary.utils.ConfigFile;
import com.tz.xiyoulibrary.utils.Constants;
import com.tz.xiyoulibrary.utils.LogUtils;

public class LoginModel implements ILoginModel {

	public int state;
	public String msg;

	@Override
	public void login(final RequestQueue queue, final String username,
			final String password, final CallBack<LoginModel> callBack) {
		if (checkInput(username, password)) {
			state = LOGIN_ING;
			callBack.getModel(this);
			StringRequest request = new StringRequest(Method.POST,
					Constants.GET_USER_LOGIN, new Listener<String>() {

						@Override
						public void onResponse(String response) {
							LogUtils.d("LoginResponse:", response);
							try {
								JSONObject o = new JSONObject(response);
								if (o.getBoolean("Result")) {
									state = LOGIN_SUCCESS;
									msg = o.getString("Detail");
									Application.SESSION = msg;
									Application.USERNAME = username;
									getUserInfo(queue, msg, callBack);
								} else {
									state = LOGIN_FAILURE;
									if (o.getString("Detail").equals(
											"ACCOUNT_ERROR")) {
										msg = "ÕËºÅ´íÎó£¬ÃÜÂë´íÎó»òÕË»§²»´æÔÚ";
									} else {
										msg = "µÇÂ¼Ê§°Ü";
									}
									callBack.getModel(LoginModel.this);
								}
							} catch (JSONException e) {
								e.printStackTrace();
								state = LOGIN_FAILURE;
								msg = "µÇÂ¼Ê§°Ü";
								callBack.getModel(LoginModel.this);
							}

						}
					}, new Response.ErrorListener() {

						@Override
						public void onErrorResponse(VolleyError error) {
							error.printStackTrace();
							state = LOGIN_FAILURE;
							msg = "ÍøÂçÇëÇóÊ§°Ü";
							callBack.getModel(LoginModel.this);
						}
					}) {
				@Override
				protected Map<String, String> getParams()
						throws AuthFailureError {
					Map<String, String> map = new HashMap<String, String>();
					map.put("username", username);
					map.put("password", <PASSWORD>);
					return map;
				}
			};
			request.setRetryPolicy(new DefaultRetryPolicy(Constants.TIMEOUT_MS,
					DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
					DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
			queue.add(request);
		} else {
			state = LOGIN_FAILURE;
			callBack.getModel(this);
		}
	}

	@Override
	public void getUserInfo(RequestQueue queue, final String session,
			final CallBack<LoginModel> callBack) {
		StringRequest request = new StringRequest(Method.POST,
				Constants.GET_USER_INFO, new Listener<String>() {

					@Override
					public void onResponse(String response) {
						LogUtils.d("LoginResponse:", response);
						try {
							JSONObject o = new JSONObject(response);
							if (o.getBoolean("Result")) {
								state = LOGIN_SUCCESS;
								JSONObject info = o.getJSONObject("Detail");
								UserBean user = new UserBean();
								user.setId(info.getString("ID"));
								user.setName(info.getString("Name"));
								user.setFromData(info.getString("From"));
								user.setToData(info.getString("To"));
								user.setReaderType(info.getString("ReaderType"));
								user.setDepartment(info.getString("Department"));
								user.setDebt(info.get("Debt") + "");
								Application.user = user;
								callBack.getModel(LoginModel.this);
							} else {
								state = LOGIN_FAILURE;
								msg = "µÇÂ¼Ê§°Ü";
								callBack.getModel(LoginModel.this);
							}
						} catch (JSONException e) {
							e.printStackTrace();
							state = LOGIN_FAILURE;
							msg = "µÇÂ¼Ê§°Ü";
							callBack.getModel(LoginModel.this);
						}

					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {
						error.printStackTrace();
						state = LOGIN_FAILURE;
						msg = "ÍøÂçÇëÇóÊ§°Ü";
						callBack.getModel(LoginModel.this);
					}
				}) {
			@Override
			protected Map<String, String> getParams() throws AuthFailureError {
				Map<String, String> map = new HashMap<String, String>();
				map.put("session", session);
				return map;
			}
		};
		queue.add(request);
	}

	@Override
	public String getUsername(Context context) {
		return ConfigFile.getUsername(context);
	}

	@Override
	public String getPassword(Context context) {
		return ConfigFile.getPassword(context);
	}

	@Override
	public void saveUsernameAndPassword(Context context, String username,
			String password) {
		ConfigFile.savePassword(context, password);
		ConfigFile.saveUsername(context, username);
	}

	@Override
	public boolean getIsSavePass(Context context) {
		return ConfigFile.getIsSavePass(context);
	}

	@Override
	public void setIsSavePass(Context context, boolean isSavePass) {
		ConfigFile.saveIsSavePass(context, isSavePass);
	}

	@Override
	public boolean getIsAutoLogin(Context context) {
		return ConfigFile.getIsAutoLogin(context);
	}

	@Override
	public void setIsAutoLogin(Context context, boolean isAutoLogin) {
		ConfigFile.saveIsAutoLogin(context, isAutoLogin);
	}

	@Override
	public boolean checkInput(String username, String password) {
		if (username.equals("")) {
			msg = "ÓÃ»§Ãû²»ÄÜÎª¿Õ";
			return false;
		}
		if (password.equals("")) {
			msg = "ÃÜÂë²»ÄÜÎª¿Õ";
			return false;
		}
		return true;
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/myfoot/view/MyFootActivity.java
package com.tz.xiyoulibrary.activity.myfoot.view;

import java.util.List;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.activity.baseactivity.BaseActivity;
import com.tz.xiyoulibrary.activity.bookdetial.view.BookDetialActivity_;
import com.tz.xiyoulibrary.activity.myfoot.presenter.MyFootPresenter;
import com.tz.xiyoulibrary.bean.BookBean;
import com.tz.xiyoulibrary.titanicview.Titanic;
import com.tz.xiyoulibrary.titanicview.TitanicTextView;
import com.tz.xiyoulibrary.titanicview.Typefaces;
import com.tz.xiyoulibrary.toastview.CustomToast;
import com.tz.xiyoulibrary.utils.BitmapCache;
import com.tz.xiyoulibrary.utils.Constants;

/**
 * 
 * @author Administrator 我的收藏
 */

@EActivity(R.layout.activity_myfoot)
public class MyFootActivity extends BaseActivity implements IMyFootView {

	@ViewById(R.id.rl_back_actionbar)
	RelativeLayout mRelativeLayoutBack;
	@ViewById(R.id.tv_title_actionbar)
	TextView mTextViewTitle;
	Titanic mTitanic;
	@ViewById(R.id.loading_text)
	TitanicTextView mTitanicTextView;
	@ViewById(R.id.rl_loading)
	RelativeLayout mRelativeLayoutLoading;
	@ViewById(R.id.rl_load_faluire)
	RelativeLayout mRelativeLayoutLoadFaluire;
	@ViewById(R.id.rl_load_no_data)
	RelativeLayout mRelativeLayoutLoadNoData;
	@ViewById(R.id.tv_load_no_data_tip)
	TextView mTextViewTip;
	private RequestQueue queue;
	private ImageLoader imageLoader;

	private List<BookBean> favoriteData;
	private MyFootPresenter mPresenter;
	@ViewById(R.id.lv_favorite_activity_myfoot)
	ListView mListViewMyFoot;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		queue = Volley.newRequestQueue(MyFootActivity.this);
		imageLoader = new ImageLoader(queue, new BitmapCache());
		mPresenter = new MyFootPresenter(this);
	}

	@AfterViews
	public void initWidgetAfter() {
		mTitanicTextView
				.setTypeface(Typefaces.get(this, "Satisfy-Regular.ttf"));
		mTitanic = new Titanic();
		mRelativeLayoutBack.setVisibility(View.VISIBLE);
		mTextViewTitle.setText("我的足迹");
		// 获取历史详情
		getFavoriteData();
	}

	/**
	 * 获取历史详情
	 */
	private void getFavoriteData() {
		mPresenter.getFavoriteData(queue);
	}

	@Override
	public void showLoadingView() {
		mRelativeLayoutLoading.setVisibility(View.VISIBLE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mTitanic.start(mTitanicTextView);
	}

	@Override
	public void showFavoriteView(List<BookBean> favoriteData) {
		// 关闭加载动画
		mTitanic.cancel();
		// 隐藏加载视图
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		this.favoriteData = favoriteData;

		MyFootAdapter adapter = new MyFootAdapter(MyFootActivity.this,
				this.favoriteData, R.layout.item_activity_myfoot,imageLoader);
		mListViewMyFoot.setAdapter(adapter);
		mListViewMyFoot.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				TextView tv = (TextView) view
						.findViewById(R.id.tv_book_id_item_myfoot);
				Intent intent = new Intent(MyFootActivity.this,
						BookDetialActivity_.class);
				intent.putExtra("url", Constants.GET_BOOK_DETAIL_BY_BARCODE
						+ tv.getText().toString());
				startActivity(intent);
			}
		});
	}

	@Override
	public void showLoadFaluireView() {
		mTitanic.cancel();
		mRelativeLayoutLoadFaluire.setVisibility(View.VISIBLE);
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
	}

	@Override
	public void showNoDataView() {
		mTitanic.cancel();
		mRelativeLayoutLoadNoData.setVisibility(View.VISIBLE);
		mTextViewTip.setText("亲！您还没有借过书呢~");
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mRelativeLayoutLoading.setVisibility(View.GONE);
	}
	@Click(R.id.rl_back_actionbar)
	public void back() {
		finish();
	}
	@Click(R.id.rl_load_faluire)
	public void resetData(){
		getFavoriteData();
	}
	@Override
	public void showMsg(String msg) {
		CustomToast.showToast(this, msg, 2000);
	}
}
<file_sep>/src/com/tz/xiyoulibrary/activity/myfoot/model/IMyFootModel.java
package com.tz.xiyoulibrary.activity.myfoot.model;

import com.android.volley.RequestQueue;
import com.tz.xiyoulibrary.activity.callback.CallBack;

public interface IMyFootModel {
	static final int LOADING_SUCCESS = 0;
	static final int LOADING_FALUIRE = 1;
	static final int NO_DATA = 2;
	static final int LOADING = 3;

	void getFavoriteData(RequestQueue queue, CallBack<MyFootModel> callBack);
}
<file_sep>/src/com/tz/xiyoulibrary/activity/bookdetial/view/BookDetialActivity.java
package com.tz.xiyoulibrary.activity.bookdetial.view;

import java.util.List;
import java.util.Map;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ImageView;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.onekeyshare.OnekeyShare;
import cn.sharesdk.onekeyshare.OnekeyShareTheme;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import com.android.volley.toolbox.Volley;
import com.tencent.tauth.Tencent;
import com.tz.xiyoulibrary.R;
import com.tz.xiyoulibrary.activity.baseactivity.BaseActivity;
import com.tz.xiyoulibrary.activity.bookdetial.presenter.BookDetialPresenter;
import com.tz.xiyoulibrary.pulltozoomview.PullToZoomListView;
import com.tz.xiyoulibrary.titanicview.Titanic;
import com.tz.xiyoulibrary.titanicview.TitanicTextView;
import com.tz.xiyoulibrary.titanicview.Typefaces;
import com.tz.xiyoulibrary.toastview.CustomToast;
import com.tz.xiyoulibrary.utils.BitmapCache;
import com.tz.xiyoulibrary.utils.Constants;

@EActivity(R.layout.activity_book_detial)
public class BookDetialActivity extends BaseActivity implements IBookDetialView {
	@ViewById(R.id.rl_back_actionbar)
	RelativeLayout mRelativeLayoutBack;
	@ViewById(R.id.tv_title_actionbar)
	TextView mTextViewTitle;
	Titanic mTitanic;
	@ViewById(R.id.loading_text)
	TitanicTextView mTitanicTextView;
	@ViewById(R.id.rl_loading)
	RelativeLayout mRelativeLayoutLoading;
	@ViewById(R.id.rl_load_faluire)
	RelativeLayout mRelativeLayoutLoadFaluire;
	@ViewById(R.id.rl_load_no_data)
	RelativeLayout mRelativeLayoutLoadNoData;
	@ViewById(R.id.tv_load_no_data_tip)
	TextView mTextViewNoDataTip;
	@ViewById(R.id.tv_load_faluire_tip)
	TextView mTextViewLoadFaluireTip;
	private RequestQueue queue;
	private ImageLoader imageLoader;

	@ViewById(R.id.ptzv_book_detial)
	PullToZoomListView mPullToZoomListView;
	private Map<String, Object> bookDetial;

	private String url;
	private BookDetialPresenter mPresenter;
	private ProgressDialog progressDialog;

	Tencent mTencent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		queue = Volley.newRequestQueue(BookDetialActivity.this);
		url = getIntent().getStringExtra("url");
		mPresenter = new BookDetialPresenter(this);
		imageLoader = new ImageLoader(queue, new BitmapCache());

		progressDialog = new ProgressDialog(BookDetialActivity.this);
		progressDialog.setTitle("提示");
		progressDialog.setMessage("收藏中,请稍候...");
		progressDialog.setCancelable(false);

		ShareSDK.initSDK(this);
	}

	@AfterViews
	public void initWidgetAfter() {
		mTitanicTextView
				.setTypeface(Typefaces.get(this, "Satisfy-Regular.ttf"));
		mTitanic = new Titanic();
		mRelativeLayoutBack.setVisibility(View.VISIBLE);
		mTextViewTitle.setText("图书详情");
		// 获取图书详情
		getBookDetial();
	}

	/**
	 * 获取图书详情
	 */
	private void getBookDetial() {
		mPresenter.getBookDetial(queue, url);
	}

	@Click(R.id.rl_back_actionbar)
	public void back() {
		finish();
	}

	@Click(R.id.rl_load_faluire)
	public void resetGetData() {
		getBookDetial();
	}
	

	@Override
	public void showLoadingView() {
		mRelativeLayoutLoading.setVisibility(View.VISIBLE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mTitanic.start(mTitanicTextView);
	}

	@Override
	public void showBookDetialView(Map<String, Object> bookDetial) {
		// 关闭加载动画
		mTitanic.cancel();
		// 隐藏加载视图
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		this.bookDetial = bookDetial;

		LayoutInflater inflater = LayoutInflater.from(BookDetialActivity.this);
		RelativeLayout foot = (RelativeLayout) inflater.inflate(
				R.layout.activity_book_detial_foot, null);
		// 初始化基本资料
		addOneView(foot);
		// 添加流通情况
		addTwoView(foot);
		// 添加图书摘要
		addThreeView(foot);
		// 添加相关推荐
		addFourView(foot);

		mPullToZoomListView.addFooterView(foot);
		String[] adapterData = new String[] {};
		mPullToZoomListView.setAdapter(new ArrayAdapter<String>(
				BookDetialActivity.this, android.R.layout.simple_list_item_1,
				adapterData));
		String imgUrl;
		try {
			imgUrl = bookDetial.get("medium").toString();
		} catch (Exception e) {
			imgUrl = "";
		}
		if (TextUtils.equals(imgUrl, "")) {
			mPullToZoomListView.getHeaderView().setImageResource(
					R.drawable.img_book_no);
		} else {
			ImageListener listener = ImageLoader.getImageListener(
					mPullToZoomListView.getHeaderView(),
					R.drawable.img_book_no, R.drawable.img_book_no);
			imageLoader.get(imgUrl, listener);
		}
		mPullToZoomListView.getHeaderView().setScaleType(
				ImageView.ScaleType.CENTER_CROP);
	}

	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		
	}
	
	/**
	 * 添加相关推荐
	 */
	private void addFourView(RelativeLayout root) {
		ListView lv = (ListView) root
				.findViewById(R.id.lv_refer_activity_book_detial);// 流通情况
		@SuppressWarnings("unchecked")
		ReferAdapter adapter = new ReferAdapter(BookDetialActivity.this,
				(List<Map<String, String>>) bookDetial.get("ReferBooks"),
				R.layout.item_refer_adapter);
		lv.setAdapter(adapter);
		lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				TextView tv = (TextView) view
						.findViewById(R.id.tv_id_item_refer);
				Intent intent = new Intent(BookDetialActivity.this,
						BookDetialActivity_.class);
				intent.putExtra("url", Constants.GET_BOOK_DETAIL_BY_ID
						+ tv.getText().toString());
				startActivity(intent);
			}
		});
	}

	/**
	 * 添加图书摘要
	 */
	private void addThreeView(RelativeLayout root) {
		TextView tv_no_data = (TextView) root
				.findViewById(R.id.tv_no_book_detial);
		LinearLayout ll = (LinearLayout) root.findViewById(R.id.ll_book_detial);
		if (!bookDetial.get("Author_Info").equals("")) {
			tv_no_data.setVisibility(View.GONE);
			ll.setVisibility(View.VISIBLE);
			TextView tv = (TextView) root
					.findViewById(R.id.tv_book_author_info_activity_book_detial);
			tv.setText(bookDetial.get("Author_Info") + "");
		} else {
			root.findViewById(R.id.ll_book_author_info_activity_book_detial)
					.setVisibility(View.GONE);
		}
		if (!bookDetial.get("Summary").equals("")) {
			tv_no_data.setVisibility(View.GONE);
			ll.setVisibility(View.VISIBLE);
			TextView tv = (TextView) root
					.findViewById(R.id.tv_book_Summary_activity_book_detial);
			tv.setText(bookDetial.get("Summary") + "");
		} else {
			root.findViewById(R.id.ll_book_Summary_activity_book_detial)
					.setVisibility(View.GONE);
		}
		if (bookDetial.containsKey("Author_Info")
				&& bookDetial.get("Summary").equals("")) {
			ll.setVisibility(View.GONE);
			tv_no_data.setVisibility(View.VISIBLE);
		}
	}

	/**
	 * 流通情况
	 */
	private void addTwoView(RelativeLayout root) {
		TextView tv;
		tv = (TextView) root
				.findViewById(R.id.tv_book_avaliable_activity_book_detial_two);// 可借数量
		tv.setText(bookDetial.get("Avaliable") + " 本");
		tv = (TextView) root
				.findViewById(R.id.tv_book_total_activity_book_detial_two);// 藏书数量
		tv.setText(bookDetial.get("Total") + " 本");
		ListView lv = (ListView) root
				.findViewById(R.id.lv_circlu_activity_book_detial);// 流通情况
		@SuppressWarnings("unchecked")
		CirculationAdapter adapter = new CirculationAdapter(
				BookDetialActivity.this,
				(List<Map<String, String>>) bookDetial.get("CirculationInfo"),
				R.layout.item_circulation_adapter);
		lv.setAdapter(adapter);
	}

	/**
	 * 基本资料
	 */
	private void addOneView(RelativeLayout root) {
		Button collection = (Button) root
				.findViewById(R.id.bt_collection_activity_book_detial);
		Button share = (Button) root
				.findViewById(R.id.bt_share_activity_book_detial);
		collection.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				mPresenter.collection(queue, bookDetial.get("ID") + "");
			}
		});
		share.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				showShare(BookDetialActivity.this, null, true);
			}
		});
		TextView tv;
		tv = (TextView) root.findViewById(R.id.tv_title_activity_book_detial);// 标题
		tv.setText(bookDetial.get("Title") + "");
		tv = (TextView) root.findViewById(R.id.tv_book_id_activity_book_detial);// 索书号
		tv.setText(bookDetial.get("Sort") + "");
		tv = (TextView) root
				.findViewById(R.id.tv_book_author_activity_book_detial);// 作者
		tv.setText(bookDetial.get("Author") + "");
		tv = (TextView) root
				.findViewById(R.id.tv_book_page_activity_book_detial);// 页数
		try {
			tv.setText(bookDetial.get("Pages") + "");
		} catch (Exception e) {
			tv.setText(bookDetial.get("Form") + "");
		}

		tv = (TextView) root
				.findViewById(R.id.tv_book_avaliable_activity_book_detial);// 可借数量
		tv.setText(bookDetial.get("Avaliable") + " 本");
		tv = (TextView) root
				.findViewById(R.id.tv_book_renttimes_activity_book_detial);// 借阅次数
		tv.setText(bookDetial.get("RentTimes") + " 次");
		tv = (TextView) root
				.findViewById(R.id.tv_book_favtimes_activity_book_detial);// 收藏次数
		tv.setText(bookDetial.get("FavTimes") + " 次");
		tv = (TextView) root
				.findViewById(R.id.tv_book_browsetimes_activity_book_detial);// 浏览次数
		tv.setText(bookDetial.get("BrowseTimes") + " 次");
		tv = (TextView) root
				.findViewById(R.id.tv_book_total_activity_book_detial);// 藏书数量
		tv.setText(bookDetial.get("Total") + " 本");

		tv = (TextView) root
				.findViewById(R.id.tv_book_subject_activity_book_detial);// 主题分类
		tv.setText(bookDetial.get("Subject") + "");
		tv = (TextView) root
				.findViewById(R.id.tv_book_pub_activity_book_detial);// 出版社
		tv.setText(bookDetial.get("Pub") + "");
	}

	@Override
	public void showLoadFaluireView() {
		mTitanic.cancel();
		mRelativeLayoutLoadFaluire.setVisibility(View.VISIBLE);
		mTextViewNoDataTip.setText("亲！查询失败了~");
		mRelativeLayoutLoading.setVisibility(View.GONE);
		mRelativeLayoutLoadNoData.setVisibility(View.GONE);
	}

	@Override
	public void showNoDataView() {
		mTitanic.cancel();
		mRelativeLayoutLoadNoData.setVisibility(View.VISIBLE);
		mTextViewNoDataTip.setText("亲！没有该书籍相关信息~");
		mRelativeLayoutLoadFaluire.setVisibility(View.GONE);
		mRelativeLayoutLoading.setVisibility(View.GONE);
	}

	@Override
	public void showMsg(String msg) {
		CustomToast.showToast(this, msg, 2000);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		queue.cancelAll(this);
	}

	@Override
	public void hidenDialog() {
		progressDialog.dismiss();
	}

	@Override
	public void showDialog() {
		progressDialog.show();
	}

	/**
	 * 演示调用ShareSDK执行分享
	 * 
	 * @param context
	 * @param platformToShare
	 *            指定直接分享平台名称（一旦设置了平台名称，则九宫格将不会显示）
	 * @param showContentEdit
	 *            是否显示编辑页
	 */
	private void showShare(Context context, String platformToShare,
			boolean showContentEdit) {
		OnekeyShare oks = new OnekeyShare();
		oks.setSilent(!showContentEdit);
		if (platformToShare != null) {
			oks.setPlatform(platformToShare);
		}
		// ShareSDK快捷分享提供两个界面第一个是九宫格 CLASSIC 第二个是SKYBLUE
		oks.setTheme(OnekeyShareTheme.CLASSIC);
		// 令编辑页面显示为Dialog模式
		oks.setDialogMode();
		// 在自动授权时可以禁用SSO方式
		oks.disableSSOWhenAuthorize();
		String imgUrl = bookDetial.get("medium").toString();
		oks.setTitle("西邮图书馆---" + "《" + bookDetial.get("Title") + "》");
		oks.setTitleUrl("http://lib.xiyoumobile.com/moreInfo.html?id="
				+ bookDetial.get("ID").toString());
		oks.setText(bookDetial.get("Summary") + "");
		// oks.setImagePath("/sdcard/test-pic.jpg"); //分享sdcard目录下的图片
		if (!TextUtils.equals(imgUrl, "")) {
			oks.setImageUrl(imgUrl);
		} else {
			// oks.setImageUrl("http://f1.sharesdk.cn/imgs/2014/02/26/owWpLZo_638x960.jpg");
		}
		oks.setComment("分享"); // 我对这条分享的评论，仅在人人网和QQ空间使用，否则可以不提供
		oks.setSite("西邮图书馆"); // QZone分享完之后返回应用时提示框上显示的名称
		oks.setSiteUrl("http://lib.xiyoumobile.com/moreInfo.html?id="
				+ bookDetial.get("ID").toString());// QZone分享参数
		oks.setSiteUrl(imgUrl);// QZone分享参数
		oks.setVenueName("西邮图书馆");
		oks.setVenueDescription("form xiyouLibrary");
		oks.setShareFromQQAuthSupport(false);
		// 将快捷分享的操作结果将通过OneKeyShareCallback回调
		// oks.setCallback(new OneKeyShareCallback());
		// 去自定义不同平台的字段内容
		// oks.setShareContentCustomizeCallback(new
		// ShareContentCustomizeDemo());
		// 在九宫格设置自定义的图标
		/*
		 * Bitmap enableLogo = BitmapFactory.decodeResource(
		 * context.getResources(), R.drawable.ssdk_oks_logo_qzone); Bitmap
		 * disableLogo = BitmapFactory.decodeResource( context.getResources(),
		 * R.drawable.ssdk_oks_logo_qzone); String label = "QQ空间";
		 * OnClickListener listener = new OnClickListener() { public void
		 * onClick(View v) { shareToQQzone(); } };
		 * oks.setCustomerLogo(enableLogo, disableLogo, label, listener);
		 */
		// 隐藏支付宝
		// 为EditPage设置一个背景的View
		// oks.setEditPageBackground(getPage());
		// 隐藏九宫格中的新浪微博
		// oks.addHiddenPlatform(SinaWeibo.NAME);

		// String[] AVATARS = {
		// "http://99touxiang.com/public/upload/nvsheng/125/27-011820_433.jpg",
		// "http://img1.2345.com/duoteimg/qqTxImg/2012/04/09/13339485237265.jpg",
		// "http://diy.qqjay.com/u/files/2012/0523/f466c38e1c6c99ee2d6cd7746207a97a.jpg",
		// "http://diy.qqjay.com/u2/2013/0422/fadc08459b1ef5fc1ea6b5b8d22e44b4.jpg",
		// "http://img1.2345.com/duoteimg/qqTxImg/2012/04/09/13339510584349.jpg",
		// "http://diy.qqjay.com/u2/2013/0401/4355c29b30d295b26da6f242a65bcaad.jpg"
		// };
		// oks.setImageArray(AVATARS); //腾讯微博和twitter用此方法分享多张图片，其他平台不可以

		// 启动分享
		oks.show(context);
	}
}
