// Path: app/src/main/java/com/ittianyu/pocenter/common/base/BaseApplication.java
// public class BaseApplication extends Application {
//     private static Context context;
//     private static Repertories repertories;
// 
//     // tinker patch config
//     private ApplicationLike tinkerApplicationLike;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         // tinker patch config
//         tinkerPatchConfig();
// 
//         context = getApplicationContext();
// 
//         initLogger();
// 
//         initLeakCanary();
// 
//         repertories = new Repertories(context.getCacheDir());
//     }
// 
//     private void tinkerPatchConfig() {
//         // 我们可以从这里获得Tinker加载过程的信息
//         if (BuildConfig.TINKER_ENABLE) {
//             tinkerApplicationLike = TinkerPatchApplicationLike.getTinkerPatchApplicationLike();
// 
//             // 初始化TinkerPatch SDK
//             TinkerPatch.init(tinkerApplicationLike)
//                     .reflectPatchLibrary()
//                     .setPatchRollbackOnScreenOff(true)
//                     .setPatchRestartOnSrceenOff(true);
// 
//             // 每隔3个小时去访问后台时候有更新,通过handler实现轮训的效果
//             new FetchPatchHandler().fetchPatchWithInterval(3);
//         }
//     }
// 
//     /**
//      * use LeakCanary to check mey leak
//      */
//     private void initLeakCanary() {
//         if (LeakCanary.isInAnalyzerProcess(this)) {
//             // This process is dedicated to LeakCanary for heap analysis.
//             // You should not init your app in this process.
//             return;
//         }
//         LeakCanary.install(this);
//     }
// 
//     /**
//      * init logger
//      */
//     private void initLogger() {
//         if ((0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)))
//             Logger.init(); // for debug, print all log
//         else
//             Logger.init().logLevel(LogLevel.NONE); // for release, remove all log
// //            Logger.init(); // for release, remove all log
//     }
// 
//     public static Context getContext() {
//         return context;
//     }
// 
//     public static Repertories getRepertories() {
//         return repertories;
//     }
// 
// 
//     /**
//      * tinker
//      * @param base
//      */
//     @Override
//     public void attachBaseContext(Context base) {
//         super.attachBaseContext(base);
//         //you must install multiDex whatever tinker is installed!
//         MultiDex.install(base);
//     }
// }
// 
// Path: app/src/main/java/com/ittianyu/pocenter/common/bean/ProjectBean.java
// public class ProjectBean {
//     public int id;
//     public String projectId;
//     public String title;
//     public String description;
//     public String price;
//     public int type;
//     public String cycle;
//     public int people;
//     public int status;
//     public Timestamp time;
//     public String reference;
//     public String url;
// 
// 
//     @Override
//     public String toString() {
//         return "ProjectBean{" +
//                 "projectId='" + projectId + '\'' +
//                 ", title='" + title + '\'' +
//                 ", description='" + description + '\'' +
//                 ", price='" + price + '\'' +
//                 ", type=" + type +
//                 ", cycle='" + cycle + '\'' +
//                 ", people=" + people +
//                 ", status=" + status +
//                 ", time=" + time +
//                 ", reference='" + reference + '\'' +
//                 ", url='" + url + '\'' +
//                 '}';
//     }
// }


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ittianyu.pocenter.R;
import com.ittianyu.pocenter.common.base.BaseApplication;
import com.ittianyu.pocenter.common.bean.ProjectBean;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Locale;
package com.ittianyu.pocenter.features.find;



/**
 * Created by yu on 2017/1/17.
 */

public class FindAdapter extends BaseQuickAdapter<ProjectBean, BaseViewHolder> {
    public FindAdapter(List<ProjectBean> data) {
        super(R.layout.item_find, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ProjectBean projectBean) {
        baseViewHolder.setText(R.id.tv_title, projectBean.title);
        baseViewHolder.setText(R.id.tv_price, projectBean.price);
//        baseViewHolder.setText(R.id.tv_reference, projectBean.reference);
        baseViewHolder.setText(R.id.tv_type, transferType(projectBean.type));
        baseViewHolder.setText(R.id.tv_description, projectBean.description);
        baseViewHolder.setText(R.id.tv_date, new SimpleDateFormat("yyyy-MM-dd", Locale.CHINESE).format(projectBean.time));
        baseViewHolder.setText(R.id.tv_people_count, projectBean.people + mContext.getString(R.string.unit_people));
        baseViewHolder.setText(R.id.tv_cycle, projectBean.cycle + mContext.getString(R.string.unit_day));
    }

    /**
     * transfer type from code to string
     * @param type
     * @return
     */
    private String transferType(int type) {
// Path: app/src/main/java/com/ittianyu/pocenter/common/base/BaseApplication.java
// public class BaseApplication extends Application {
//     private static Context context;
//     private static Repertories repertories;
// 
//     // tinker patch config
//     private ApplicationLike tinkerApplicationLike;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         // tinker patch config
//         tinkerPatchConfig();
// 
//         context = getApplicationContext();
// 
//         initLogger();
// 
//         initLeakCanary();
// 
//         repertories = new Repertories(context.getCacheDir());
//     }
// 
//     private void tinkerPatchConfig() {
//         // 我们可以从这里获得Tinker加载过程的信息
//         if (BuildConfig.TINKER_ENABLE) {
//             tinkerApplicationLike = TinkerPatchApplicationLike.getTinkerPatchApplicationLike();
// 
//             // 初始化TinkerPatch SDK
//             TinkerPatch.init(tinkerApplicationLike)
//                     .reflectPatchLibrary()
//                     .setPatchRollbackOnScreenOff(true)
//                     .setPatchRestartOnSrceenOff(true);
// 
//             // 每隔3个小时去访问后台时候有更新,通过handler实现轮训的效果
//             new FetchPatchHandler().fetchPatchWithInterval(3);
//         }
//     }
// 
//     /**
//      * use LeakCanary to check mey leak
//      */
//     private void initLeakCanary() {
//         if (LeakCanary.isInAnalyzerProcess(this)) {
//             // This process is dedicated to LeakCanary for heap analysis.
//             // You should not init your app in this process.
//             return;
//         }
//         LeakCanary.install(this);
//     }
// 
//     /**
//      * init logger
//      */
//     private void initLogger() {
//         if ((0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)))
//             Logger.init(); // for debug, print all log
//         else
//             Logger.init().logLevel(LogLevel.NONE); // for release, remove all log
// //            Logger.init(); // for release, remove all log
//     }
// 
//     public static Context getContext() {
//         return context;
//     }
// 
//     public static Repertories getRepertories() {
//         return repertories;
//     }
// 
// 
//     /**
//      * tinker
//      * @param base
//      */
//     @Override
//     public void attachBaseContext(Context base) {
//         super.attachBaseContext(base);
//         //you must install multiDex whatever tinker is installed!
//         MultiDex.install(base);
//     }
// }
// 
// Path: app/src/main/java/com/ittianyu/pocenter/common/bean/ProjectBean.java
// public class ProjectBean {
//     public int id;
//     public String projectId;
//     public String title;
//     public String description;
//     public String price;
//     public int type;
//     public String cycle;
//     public int people;
//     public int status;
//     public Timestamp time;
//     public String reference;
//     public String url;
// 
// 
//     @Override
//     public String toString() {
//         return "ProjectBean{" +
//                 "projectId='" + projectId + '\'' +
//                 ", title='" + title + '\'' +
//                 ", description='" + description + '\'' +
//                 ", price='" + price + '\'' +
//                 ", type=" + type +
//                 ", cycle='" + cycle + '\'' +
//                 ", people=" + people +
//                 ", status=" + status +
//                 ", time=" + time +
//                 ", reference='" + reference + '\'' +
//                 ", url='" + url + '\'' +
//                 '}';
//     }
// }


// Path: app/src/main/java/com/ittianyu/pocenter/features/find/FindAdapter.java
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ittianyu.pocenter.R;
import com.ittianyu.pocenter.common.base.BaseApplication;
import com.ittianyu.pocenter.common.bean.ProjectBean;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Locale;

package com.ittianyu.pocenter.features.find;



/**
 * Created by yu on 2017/1/17.
 */

public class FindAdapter extends BaseQuickAdapter<ProjectBean, BaseViewHolder> {
    public FindAdapter(List<ProjectBean> data) {
        super(R.layout.item_find, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ProjectBean projectBean) {
        baseViewHolder.setText(R.id.tv_title, projectBean.title);
        baseViewHolder.setText(R.id.tv_price, projectBean.price);
//        baseViewHolder.setText(R.id.tv_reference, projectBean.reference);
        baseViewHolder.setText(R.id.tv_type, transferType(projectBean.type));
        baseViewHolder.setText(R.id.tv_description, projectBean.description);
        baseViewHolder.setText(R.id.tv_date, new SimpleDateFormat("yyyy-MM-dd", Locale.CHINESE).format(projectBean.time));
        baseViewHolder.setText(R.id.tv_people_count, projectBean.people + mContext.getString(R.string.unit_people));
        baseViewHolder.setText(R.id.tv_cycle, projectBean.cycle + mContext.getString(R.string.unit_day));
    }

    /**
     * transfer type from code to string
     * @param type
     * @return
     */
    private String transferType(int type) {
        List<String> types = BaseApplication.getRepertories().getAllTypes();