// Path: app/src/main/java/com/monsterlin/pigeon/base/BaseApplication.java
// public abstract class BaseApplication extends Application {
// 
//     public abstract void initConfigs();
// 
//     //TODO  Context会产生内存泄漏
//     public static Context context = null;
// 
//     public static Handler handler = null;
// 
//     public static Thread mainThread = null;
// 
//     public static int mainThreadId = 0;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         context = getApplicationContext();
// 
//         handler = new Handler();
// 
//         mainThread = Thread.currentThread();
// 
//         //自定义异常捕获
//         CrashHandler.getInstance().init(this);
// 
//         initConfigs();
//     }
// 
//     public static Context getContext() {
//         return context;
//     }
// 
// }
// 
// Path: app/src/main/java/com/monsterlin/pigeon/constant/BmobConfig.java
// public class BmobConfig {
//     /**
//      * Bmob APPID
//      */
//     public static final String APPID = "fe1d94a8f037d610f8d693f41d81e41e";
// 
//     /**
//      * 短信验证码模板
//      */
//     public static final String SMSTEMPLATE = "STemplate";
// }
// 
// Path: app/src/main/java/com/monsterlin/pigeon/utils/ToastUtils.java
// public class ToastUtils {
// 
//     private static View toastRoot;
//     private static TextView tv;
//     private static Toast mToast;
//     private static int DURATION = Toast.LENGTH_SHORT;
// 
//     public static void showToast(Context context, CharSequence text) {
//         toastRoot = LayoutInflater.from(context).inflate(R.layout.custom_toast, null);
//         mToast = new Toast(context);
//         tv = (TextView) toastRoot.findViewById(R.id.tv_toast_tips);
//         mToast.setView(toastRoot);
//         tv.setText(text);
//         mToast.setDuration(DURATION);
//         mToast.show();
//     }
// 
// }


import com.monsterlin.pigeon.base.BaseApplication;
import com.monsterlin.pigeon.constant.BmobConfig;
import com.monsterlin.pigeon.utils.ToastUtils;
import com.orhanobut.logger.Logger;
import com.taobao.sophix.PatchStatus;
import com.taobao.sophix.SophixManager;
import com.taobao.sophix.listener.PatchLoadStatusListener;
import cn.bmob.v3.Bmob;
package com.monsterlin.pigeon.application;



/**
 * @author : monsterLin
 * @version : 1.0
 * @email : monster941025@gmail.com
 * @github : https://github.com/monsterLin
 * @time : 2017/7/10
 * @desc : 程序的application
 */
public class PigeonApplication extends BaseApplication {

    @Override
    public void initConfigs() {
        initSophix();
        Bmob.initialize(this, BmobConfig.APPID);
    }

    private void initSophix() {
        String appVersion;
        try {
            appVersion = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
        } catch (Exception e) {
            appVersion = "1.0.0";
        }

        SophixManager.getInstance().setContext(this)
                .setAppVersion(appVersion)
                .setAesKey(null)
                .setEnableDebug(false)
                .setPatchLoadStatusStub(new PatchLoadStatusListener() {
                    @Override
                    public void onLoad(final int mode, final int code, final String info, final int handlePatchVersion) {
                        // 补丁加载回调通知
                        if (code == PatchStatus.CODE_LOAD_SUCCESS) {
                            // 表明补丁加载成功
                            ToastUtils.showToast(getApplicationContext(),"补丁加载成功");
// Path: app/src/main/java/com/monsterlin/pigeon/base/BaseApplication.java
// public abstract class BaseApplication extends Application {
// 
//     public abstract void initConfigs();
// 
//     //TODO  Context会产生内存泄漏
//     public static Context context = null;
// 
//     public static Handler handler = null;
// 
//     public static Thread mainThread = null;
// 
//     public static int mainThreadId = 0;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         context = getApplicationContext();
// 
//         handler = new Handler();
// 
//         mainThread = Thread.currentThread();
// 
//         //自定义异常捕获
//         CrashHandler.getInstance().init(this);
// 
//         initConfigs();
//     }
// 
//     public static Context getContext() {
//         return context;
//     }
// 
// }
// 
// Path: app/src/main/java/com/monsterlin/pigeon/constant/BmobConfig.java
// public class BmobConfig {
//     /**
//      * Bmob APPID
//      */
//     public static final String APPID = "fe1d94a8f037d610f8d693f41d81e41e";
// 
//     /**
//      * 短信验证码模板
//      */
//     public static final String SMSTEMPLATE = "STemplate";
// }
// 
// Path: app/src/main/java/com/monsterlin/pigeon/utils/ToastUtils.java
// public class ToastUtils {
// 
//     private static View toastRoot;
//     private static TextView tv;
//     private static Toast mToast;
//     private static int DURATION = Toast.LENGTH_SHORT;
// 
//     public static void showToast(Context context, CharSequence text) {
//         toastRoot = LayoutInflater.from(context).inflate(R.layout.custom_toast, null);
//         mToast = new Toast(context);
//         tv = (TextView) toastRoot.findViewById(R.id.tv_toast_tips);
//         mToast.setView(toastRoot);
//         tv.setText(text);
//         mToast.setDuration(DURATION);
//         mToast.show();
//     }
// 
// }


// Path: app/src/main/java/com/monsterlin/pigeon/application/PigeonApplication.java
import com.monsterlin.pigeon.base.BaseApplication;
import com.monsterlin.pigeon.constant.BmobConfig;
import com.monsterlin.pigeon.utils.ToastUtils;
import com.orhanobut.logger.Logger;
import com.taobao.sophix.PatchStatus;
import com.taobao.sophix.SophixManager;
import com.taobao.sophix.listener.PatchLoadStatusListener;
import cn.bmob.v3.Bmob;

package com.monsterlin.pigeon.application;



/**
 * @author : monsterLin
 * @version : 1.0
 * @email : monster941025@gmail.com
 * @github : https://github.com/monsterLin
 * @time : 2017/7/10
 * @desc : 程序的application
 */
public class PigeonApplication extends BaseApplication {

    @Override
    public void initConfigs() {
        initSophix();
        Bmob.initialize(this, BmobConfig.APPID);
    }

    private void initSophix() {
        String appVersion;
        try {
            appVersion = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
        } catch (Exception e) {
            appVersion = "1.0.0";
        }

        SophixManager.getInstance().setContext(this)
                .setAppVersion(appVersion)
                .setAesKey(null)
                .setEnableDebug(false)
                .setPatchLoadStatusStub(new PatchLoadStatusListener() {
                    @Override
                    public void onLoad(final int mode, final int code, final String info, final int handlePatchVersion) {
                        // 补丁加载回调通知
                        if (code == PatchStatus.CODE_LOAD_SUCCESS) {
                            // 表明补丁加载成功
                            ToastUtils.showToast(getApplicationContext(),"补丁加载成功");
                        } else if (code == PatchStatus.CODE_LOAD_RELAUNCH) {