// Path: retrofitclient/src/main/java/com/jady/retrofitclient/callback/HttpCallback.java
// public abstract class HttpCallback<T> {
// 
//     public static final String TAG = "HttpCallback";
// 
//     protected Type genericityType;
// 
//     public HttpCallback() {
//         Type genericSuperclass = getClass().getGenericSuperclass();
//         if (genericSuperclass instanceof ParameterizedType) {
//             this.genericityType = ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
//         } else {
//             this.genericityType = Object.class;
//         }
//     }
// 
//     public abstract void onResolve(T t);
// 
//     public abstract void onFailed(String err_code, String message);
// 
//     public Type getGenericityType() {
//         return genericityType;
//     }
// 
// }
// 
// Path: retrofitclient/src/main/java/com/jady/retrofitclient/callback/LoadingCallback.java
// public interface LoadingCallback {
//     /**
//      * 开始显示加载框
//      * @param msg
//      */
//     void onStartLoading(String msg);
// 
//     /**
//      * 隐藏加载框
//      */
//     void onFinishLoading();
// }


import android.content.Context;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.jady.retrofitclient.callback.HttpCallback;
import com.jady.retrofitclient.callback.LoadingCallback;
import java.io.IOException;
import java.lang.reflect.Type;
import okhttp3.ResponseBody;
import rx.Subscriber;
package com.jady.retrofitclient.subscriber;





/**
 * Created by jady on 2016/12/8.
 */
public class CommonResultSubscriber<T extends ResponseBody> extends Subscriber<T> {

    public static final String TAG = "CommonResultSubscriber";

    private Context mContext;
    private boolean showLoadingDailog = false;
    private String loadingMsg;

    private LoadingCallback loadingCallback;
    private HttpCallback httpCallback;

    /**
     * 不带加载框回调
     *
     * @param mContext
     * @param callback
     */
    public CommonResultSubscriber(Context mContext, HttpCallback callback) {
        this.mContext = mContext;
        this.httpCallback = callback;
    }

    /**
     * 带加载框回调
     *
     * @param mContext
     * @param callback
     * @param loadingMsg
     */
    public CommonResultSubscriber(Context mContext, HttpCallback callback, String loadingMsg) {
        this.mContext = mContext;
        this.httpCallback = callback;
        this.loadingMsg = loadingMsg;

        if (!TextUtils.isEmpty(loadingMsg)) {
            try {
// Path: retrofitclient/src/main/java/com/jady/retrofitclient/callback/HttpCallback.java
// public abstract class HttpCallback<T> {
// 
//     public static final String TAG = "HttpCallback";
// 
//     protected Type genericityType;
// 
//     public HttpCallback() {
//         Type genericSuperclass = getClass().getGenericSuperclass();
//         if (genericSuperclass instanceof ParameterizedType) {
//             this.genericityType = ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
//         } else {
//             this.genericityType = Object.class;
//         }
//     }
// 
//     public abstract void onResolve(T t);
// 
//     public abstract void onFailed(String err_code, String message);
// 
//     public Type getGenericityType() {
//         return genericityType;
//     }
// 
// }
// 
// Path: retrofitclient/src/main/java/com/jady/retrofitclient/callback/LoadingCallback.java
// public interface LoadingCallback {
//     /**
//      * 开始显示加载框
//      * @param msg
//      */
//     void onStartLoading(String msg);
// 
//     /**
//      * 隐藏加载框
//      */
//     void onFinishLoading();
// }


// Path: retrofitclient/src/main/java/com/jady/retrofitclient/subscriber/CommonResultSubscriber.java
import android.content.Context;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.jady.retrofitclient.callback.HttpCallback;
import com.jady.retrofitclient.callback.LoadingCallback;
import java.io.IOException;
import java.lang.reflect.Type;
import okhttp3.ResponseBody;
import rx.Subscriber;

package com.jady.retrofitclient.subscriber;





/**
 * Created by jady on 2016/12/8.
 */
public class CommonResultSubscriber<T extends ResponseBody> extends Subscriber<T> {

    public static final String TAG = "CommonResultSubscriber";

    private Context mContext;
    private boolean showLoadingDailog = false;
    private String loadingMsg;

    private LoadingCallback loadingCallback;
    private HttpCallback httpCallback;

    /**
     * 不带加载框回调
     *
     * @param mContext
     * @param callback
     */
    public CommonResultSubscriber(Context mContext, HttpCallback callback) {
        this.mContext = mContext;
        this.httpCallback = callback;
    }

    /**
     * 带加载框回调
     *
     * @param mContext
     * @param callback
     * @param loadingMsg
     */
    public CommonResultSubscriber(Context mContext, HttpCallback callback, String loadingMsg) {
        this.mContext = mContext;
        this.httpCallback = callback;
        this.loadingMsg = loadingMsg;

        if (!TextUtils.isEmpty(loadingMsg)) {
            try {
                loadingCallback = (LoadingCallback) mContext;