// Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java
// public class LoginInfo {
//     /**
//      * error : false
//      * result : [{"userName":"1","password":"1","sex":0,"code":1051}]
//      */
//     /**
//      * userName : 1
//      * password : 1
//      * sex : 0
//      * code : 1051
//      */
//     private String userName;
//     private String password;
//     private int sex;
//     private int code;
// 
//     public String getUserName() {
//         return userName;
//     }
// 
//     public void setUserName(String userName) {
//         this.userName = userName;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public int getSex() {
//         return sex;
//     }
// 
//     public void setSex(int sex) {
//         this.sex = sex;
//     }
// 
//     public int getCode() {
//         return code;
//     }
// 
//     public void setCode(int code) {
//         this.code = code;
//     }
// }
// 
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/net/LoginException.java
// public class LoginException extends RuntimeException {
//     public static final int LOGIN_PASSWORD_ERROR_CODE = 1025;
//     public static final int LOGIN_USER_ERROR_CODE = 1026;
//     public static final int REGISTER_USER_REPEAT_ERROR_CODE = 1027;
//     public static final String LOGIN_PASSWORD_ERROR_MESSAGE = "密码错误，请重试";
//     public static final String LOGIN_USER_ERROR_MESSAGE = "用户名不存在";
//     public static final String REGISTER_USER_REPEAT_ERROR_MESSAGE = "用户已注册";
// 
// 
//     public LoginException(int code) {
//         this(getLoginExceptionMessage(code));
//     }
// 
//     public LoginException(String message) {
//         super(message);
//     }
// 
//     private static String getLoginExceptionMessage(int code) {
//         String message = "";
//         switch (code) {
//             case LOGIN_PASSWORD_ERROR_CODE:
//                 message = LOGIN_PASSWORD_ERROR_MESSAGE;
//                 break;
//             case LOGIN_USER_ERROR_CODE:
//                 message = LOGIN_USER_ERROR_MESSAGE;
//                 break;
//             case REGISTER_USER_REPEAT_ERROR_CODE:
//                 message = REGISTER_USER_REPEAT_ERROR_MESSAGE;
//                 break;
//             default:
//                 message = "未知错误";
//                 break;
//         }
// 
//         return message;
//     }
// }


import com.joker.fourfun.model.LoginInfo;
import com.joker.fourfun.net.LoginException;
import com.orhanobut.logger.Logger;
import org.reactivestreams.Publisher;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable;
import io.reactivex.FlowableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
package com.joker.fourfun.utils;





/**
 * Created by joker on 2016/11/28.
 */

public class RxUtil {
    /**
     * rxjava 线程封装
     *
     * @param <T>
     * @return
     */
    public static <T> FlowableTransformer<T, T> rxSchedulerTransformer() {
        return new FlowableTransformer<T, T>() {
            @Override
            public Publisher<T> apply(Flowable<T> upstream) {
                return upstream
                        .subscribeOn(Schedulers.io())
                        .observeOn(AndroidSchedulers.mainThread());
            }
        };
    }

    /**
     * rxjava 超时抛出异常
     *
     * @param <T>
     * @return
     */
    public static <T> FlowableTransformer<T, T> rxTimeoutTransformer() {
        return new FlowableTransformer<T, T>() {
            @Override
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java
// public class LoginInfo {
//     /**
//      * error : false
//      * result : [{"userName":"1","password":"1","sex":0,"code":1051}]
//      */
//     /**
//      * userName : 1
//      * password : 1
//      * sex : 0
//      * code : 1051
//      */
//     private String userName;
//     private String password;
//     private int sex;
//     private int code;
// 
//     public String getUserName() {
//         return userName;
//     }
// 
//     public void setUserName(String userName) {
//         this.userName = userName;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public int getSex() {
//         return sex;
//     }
// 
//     public void setSex(int sex) {
//         this.sex = sex;
//     }
// 
//     public int getCode() {
//         return code;
//     }
// 
//     public void setCode(int code) {
//         this.code = code;
//     }
// }
// 
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/net/LoginException.java
// public class LoginException extends RuntimeException {
//     public static final int LOGIN_PASSWORD_ERROR_CODE = 1025;
//     public static final int LOGIN_USER_ERROR_CODE = 1026;
//     public static final int REGISTER_USER_REPEAT_ERROR_CODE = 1027;
//     public static final String LOGIN_PASSWORD_ERROR_MESSAGE = "密码错误，请重试";
//     public static final String LOGIN_USER_ERROR_MESSAGE = "用户名不存在";
//     public static final String REGISTER_USER_REPEAT_ERROR_MESSAGE = "用户已注册";
// 
// 
//     public LoginException(int code) {
//         this(getLoginExceptionMessage(code));
//     }
// 
//     public LoginException(String message) {
//         super(message);
//     }
// 
//     private static String getLoginExceptionMessage(int code) {
//         String message = "";
//         switch (code) {
//             case LOGIN_PASSWORD_ERROR_CODE:
//                 message = LOGIN_PASSWORD_ERROR_MESSAGE;
//                 break;
//             case LOGIN_USER_ERROR_CODE:
//                 message = LOGIN_USER_ERROR_MESSAGE;
//                 break;
//             case REGISTER_USER_REPEAT_ERROR_CODE:
//                 message = REGISTER_USER_REPEAT_ERROR_MESSAGE;
//                 break;
//             default:
//                 message = "未知错误";
//                 break;
//         }
// 
//         return message;
//     }
// }


// Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/RxUtil.java
import com.joker.fourfun.model.LoginInfo;
import com.joker.fourfun.net.LoginException;
import com.orhanobut.logger.Logger;
import org.reactivestreams.Publisher;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable;
import io.reactivex.FlowableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;

package com.joker.fourfun.utils;





/**
 * Created by joker on 2016/11/28.
 */

public class RxUtil {
    /**
     * rxjava 线程封装
     *
     * @param <T>
     * @return
     */
    public static <T> FlowableTransformer<T, T> rxSchedulerTransformer() {
        return new FlowableTransformer<T, T>() {
            @Override
            public Publisher<T> apply(Flowable<T> upstream) {
                return upstream
                        .subscribeOn(Schedulers.io())
                        .observeOn(AndroidSchedulers.mainThread());
            }
        };
    }

    /**
     * rxjava 超时抛出异常
     *
     * @param <T>
     * @return
     */
    public static <T> FlowableTransformer<T, T> rxTimeoutTransformer() {
        return new FlowableTransformer<T, T>() {
            @Override
            public Publisher<T> apply(Flowable<T> upstream) {