// Path: app/src/main/java/com/andfast/app/constant/GeneralID.java
// public class GeneralID {
// 
//     /**接口根地址*/
//     public static final String BASE_SERVER_URL = "http://is.snssdk.com/";
// 
//     /**
//      * 页面间参数传递KEY值
//      */
//     public class Extra {
//         public static final String TAB = "tab";
//     }
// 
//     public final static int TYPE_PULL_REFRESH = 1;
//     public final static int TYPE_LOAD_MORE = TYPE_PULL_REFRESH + 1;
// 
//     /**网络请求异常code*/
//     public final static int TYPE_NET_UNAVAILABLE_CODE = 1004;
//     public final static int TYPE_NET_ERROR_CODE = TYPE_NET_UNAVAILABLE_CODE+1;
// 
//     // EventBus Code
//     public static final class EventCode {
//         public static final int TEST = 0x8858111;
//     }
// }
// 
// Path: app/src/main/java/com/andfast/app/net/ResultResponse.java
// public class ResultResponse <T> {
// 
//     public String has_more;
//     public String message;
//     public boolean success;
//     public int error_code;
//     public T data;
// 
//     public ResultResponse(String more, int code,boolean success,String _message, T result) {
//         error_code = code;
//         has_more = more;
//         message = _message;
//         data = result;
//         this.success = success;
//     }
// }
// 
// Path: app/src/main/java/com/andfast/app/presenter/base/BaseCallBack.java
// public abstract class BaseCallBack<T> extends Subscriber<T> {
// 
//     @Override
//     public void onCompleted() {
// 
//     }
// 
//     @Override
//     public void onError(Throwable e) {
// 
//     }
// }


import com.andfast.app.constant.GeneralID;
import com.andfast.app.net.ResultResponse;
import com.andfast.app.presenter.base.BaseCallBack;
package com.andfast.app.presenter;


/**
 * Created by mby on 17-8-6.
 */

public abstract class SubscriberCallBack<T> extends BaseCallBack<ResultResponse<T>> {
    private static final String TAG = "SubscriberCallBack";
    @Override
    public void onNext(ResultResponse<T> resultResponse) {
        if (resultResponse.success){
            onSuccess(resultResponse.data);
        }else {
            onFailure(resultResponse);
        }
    }

    @Override
    public void onError(Throwable e) {
        super.onError(e);
// Path: app/src/main/java/com/andfast/app/constant/GeneralID.java
// public class GeneralID {
// 
//     /**接口根地址*/
//     public static final String BASE_SERVER_URL = "http://is.snssdk.com/";
// 
//     /**
//      * 页面间参数传递KEY值
//      */
//     public class Extra {
//         public static final String TAB = "tab";
//     }
// 
//     public final static int TYPE_PULL_REFRESH = 1;
//     public final static int TYPE_LOAD_MORE = TYPE_PULL_REFRESH + 1;
// 
//     /**网络请求异常code*/
//     public final static int TYPE_NET_UNAVAILABLE_CODE = 1004;
//     public final static int TYPE_NET_ERROR_CODE = TYPE_NET_UNAVAILABLE_CODE+1;
// 
//     // EventBus Code
//     public static final class EventCode {
//         public static final int TEST = 0x8858111;
//     }
// }
// 
// Path: app/src/main/java/com/andfast/app/net/ResultResponse.java
// public class ResultResponse <T> {
// 
//     public String has_more;
//     public String message;
//     public boolean success;
//     public int error_code;
//     public T data;
// 
//     public ResultResponse(String more, int code,boolean success,String _message, T result) {
//         error_code = code;
//         has_more = more;
//         message = _message;
//         data = result;
//         this.success = success;
//     }
// }
// 
// Path: app/src/main/java/com/andfast/app/presenter/base/BaseCallBack.java
// public abstract class BaseCallBack<T> extends Subscriber<T> {
// 
//     @Override
//     public void onCompleted() {
// 
//     }
// 
//     @Override
//     public void onError(Throwable e) {
// 
//     }
// }


// Path: app/src/main/java/com/andfast/app/presenter/SubscriberCallBack.java
import com.andfast.app.constant.GeneralID;
import com.andfast.app.net.ResultResponse;
import com.andfast.app.presenter.base.BaseCallBack;

package com.andfast.app.presenter;


/**
 * Created by mby on 17-8-6.
 */

public abstract class SubscriberCallBack<T> extends BaseCallBack<ResultResponse<T>> {
    private static final String TAG = "SubscriberCallBack";
    @Override
    public void onNext(ResultResponse<T> resultResponse) {
        if (resultResponse.success){
            onSuccess(resultResponse.data);
        }else {
            onFailure(resultResponse);
        }
    }

    @Override
    public void onError(Throwable e) {
        super.onError(e);
        onFailure(new ResultResponse("", GeneralID.TYPE_NET_ERROR_CODE,false,"",e));