Просмотр исходного кода

Merge branch 'feature' of https://gitlab.com/Arisono/SkWeiChat-Baidu into developer_fix

Arison 8 лет назад
Родитель
Сommit
c8bc990b76
20 измененных файлов с 958 добавлено и 441 удалено
  1. 0 28
      app_core/network/src/main/java/com/me/network/app/http/HttpResult.java
  2. 14 3
      app_core/network/src/main/java/com/me/network/app/http/impl/RetrofitImpl.java
  3. 0 174
      app_core/network/src/main/java/com/me/network/app/http/impl/RetrofitTagImpl.java
  4. 289 0
      app_core/network/src/main/java/com/me/network/app/http/interceptor/HttpLoggerInterceptor.java
  5. 3 5
      app_core/network/src/main/java/com/me/network/app/http/interceptor/NetInterceptor.java
  6. 20 0
      app_core/network/src/main/java/com/me/network/app/http/logger/HttpLogger.java
  7. 0 18
      app_core/network/src/main/java/com/me/network/app/http/rx/ResultSubscriber.java
  8. 0 14
      app_core/network/src/main/java/com/me/network/app/http/rx/ResultTagListener.java
  9. 0 29
      app_core/network/src/main/java/com/me/network/app/http/rx/ResultTagSubscriber.java
  10. 1 1
      app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java
  11. 5 5
      app_modular/apputils/src/main/java/com/modular/apputils/widget/SpaceItemDecoration.java
  12. 54 31
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java
  13. 132 92
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java
  14. 25 6
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/BusinessTravel.java
  15. 1 5
      app_modular/appworks/src/main/java/com/uas/appworks/activity/WorkModuleSortActivity.java
  16. 1 1
      app_modular/appworks/src/main/res/drawable/text_frame_radian_hint_bg.xml
  17. 1 1
      app_modular/appworks/src/main/res/drawable/text_frame_radian_red_bg.xml
  18. 363 0
      app_modular/appworks/src/main/res/layout/item_bus_travel_air.xml
  19. 48 28
      app_modular/appworks/src/main/res/layout/item_bus_travel_hotel.xml
  20. 1 0
      app_modular/appworks/src/main/res/layout/item_bus_travel_title.xml

+ 0 - 28
app_core/network/src/main/java/com/me/network/app/http/HttpResult.java

@@ -1,28 +0,0 @@
-package com.me.network.app.http;
-
-/**
- * @author RaoMeng
- * @describe
- * @date 2017/11/14 10:34
- */
-
-public class HttpResult<T> {
-    private T t;
-    private int what;
-
-    public T getResponse() {
-        return t;
-    }
-
-    public void setResponse(T t) {
-        this.t = t;
-    }
-
-    public int getWhat() {
-        return what;
-    }
-
-    public void setWhat(int what) {
-        this.what = what;
-    }
-}

+ 14 - 3
app_core/network/src/main/java/com/me/network/app/http/impl/RetrofitImpl.java

@@ -5,7 +5,9 @@ import com.google.gson.Gson;
 import com.me.network.app.http.HttpBase;
 import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.interceptor.CacheInterceptor;
-import com.me.network.app.http.interceptor.LogInterceptor;
+import com.me.network.app.http.interceptor.HttpLoggerInterceptor;
+import com.me.network.app.http.interceptor.NetInterceptor;
+import com.me.network.app.http.logger.HttpLogger;
 import com.me.network.app.http.retrofit.StringConverterFactory;
 import com.me.network.app.http.rx.RxJavaUtils;
 import com.me.network.app.http.service.ParamService;
@@ -89,8 +91,17 @@ public class RetrofitImpl extends HttpBase {
                     }
                 });
 
-        LogInterceptor logInterceptor = new LogInterceptor(mbuilder);
-        mOkBuilder.addNetworkInterceptor(logInterceptor);
+        HttpLoggerInterceptor loggerInterceptor = new HttpLoggerInterceptor(new HttpLogger());
+        if (mbuilder.isDebug()) {
+            loggerInterceptor.setLevel(HttpLoggerInterceptor.Level.BODY);
+        } else {
+            loggerInterceptor.setLevel(HttpLoggerInterceptor.Level.NONE);
+        }
+
+        NetInterceptor netInterceptor = new NetInterceptor(mbuilder);
+        mOkBuilder
+                .addNetworkInterceptor(netInterceptor)
+                .addInterceptor(loggerInterceptor);
         if (mbuilder.getCacheFileSize() != 0) {
             mOkBuilder.cache(new Cache(mbuilder.getCacheFile(), mbuilder.getCacheFileSize()));
             mOkBuilder.addInterceptor(

+ 0 - 174
app_core/network/src/main/java/com/me/network/app/http/impl/RetrofitTagImpl.java

@@ -1,174 +0,0 @@
-package com.me.network.app.http.impl;
-
-import com.google.gson.Gson;
-import com.me.network.app.http.HttpBase;
-import com.me.network.app.http.HttpClient;
-import com.me.network.app.http.HttpResult;
-import com.me.network.app.http.interceptor.CacheInterceptor;
-import com.me.network.app.http.interceptor.LogInterceptor;
-import com.me.network.app.http.retrofit.StringConverterFactory;
-import com.me.network.app.http.rx.RxJavaUtils;
-import com.me.network.app.http.service.ParamService;
-import com.me.network.app.http.ssl.TrustAllCerts;
-import com.me.network.app.http.ssl.TrustAllHostnameVerifier;
-
-import java.io.File;
-import java.security.SecureRandom;
-import java.util.concurrent.TimeUnit;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-
-import okhttp3.Cache;
-import okhttp3.MultipartBody;
-import okhttp3.OkHttpClient;
-import okhttp3.RequestBody;
-import retrofit2.Retrofit;
-import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
-import retrofit2.converter.gson.GsonConverterFactory;
-import rx.Observable;
-import rx.Subscriber;
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Func1;
-
-/**
- * @author RaoMeng
- * @describe
- * @date 2017/11/14 11:21
- */
-
-public class RetrofitTagImpl extends HttpBase {
-    public Retrofit retrofit;
-    public ParamService paramService;
-    private static RetrofitImpl instance;
-
-
-    public static RetrofitImpl getInstance() {
-        if (instance == null) {
-            synchronized (RetrofitImpl.class) {
-                if (instance == null) {
-                    instance = new RetrofitImpl();
-                }
-            }
-        }
-
-        return instance;
-    }
-
-    @Override
-    public void initClient() {
-
-        OkHttpClient.Builder okBuilder = new OkHttpClient.Builder()
-                .connectTimeout(mbuilder.getConnectTimeout(), TimeUnit.SECONDS)
-                .readTimeout(mbuilder.getReadTimeout(), TimeUnit.SECONDS)
-                .writeTimeout(mbuilder.getWriteTimeout(), TimeUnit.SECONDS)
-                .sslSocketFactory(createSSLSocketFactory(), new TrustAllCerts())// 信任所有证书
-                .hostnameVerifier(new TrustAllHostnameVerifier());
-
-        LogInterceptor logInterceptor = new LogInterceptor();
-        logInterceptor.setBuilder(mbuilder);
-        okBuilder.addInterceptor(logInterceptor);
-        if (mbuilder.getCacheFileSize() != 0) {
-            okBuilder.cache(new Cache(mbuilder.getCacheFile(), mbuilder.getCacheFileSize()));
-            okBuilder.addInterceptor(
-                    new CacheInterceptor(String.valueOf(mbuilder.getCacheTime()), mbuilder.getCacheType()));
-        }
-
-
-        OkHttpClient client = okBuilder.build();
-        retrofit = new Retrofit.Builder().client(client)
-                .baseUrl(mbuilder.getBaseUrl())
-                .addConverterFactory(StringConverterFactory.create())
-                .addConverterFactory(GsonConverterFactory.create(new Gson()))
-                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
-                .build();
-
-        paramService = initApi(ParamService.class);
-    }
-
-    public <T> T initApi(Class<T> service) {
-        return retrofit.create(service);
-    }
-
-    @Override
-    public void get(HttpClient builder, Subscriber<Object> s) {
-        Observable<Object> o = paramService.getParam(builder.getBaseUrl(), builder.getParams(), builder.getHeaders());
-        toSubscribe(o, builder.getWhat(), s);
-
-    }
-
-    @Override
-    public void post(HttpClient builder, Subscriber<Object> s) {
-        Observable<Object> o = paramService.postParam(builder.getBaseUrl(), builder.getParams(), builder.getHeaders());
-        toSubscribe(o, builder.getWhat(), s);
-    }
-
-    @Override
-    public void uploads(HttpClient mBuilder, Subscriber<Object> s) {
-        MultipartBody.Builder builder = new MultipartBody.Builder();
-        builder.setType(MultipartBody.FORM);
-        //追加参数
-        for (String key : mBuilder.getParams().keySet()) {
-            Object object = mBuilder.getParams().get(key);
-            if (!(object instanceof File)) {
-                builder.addFormDataPart(key, object.toString());
-            } else {
-                File file = (File) object;
-                //其中参数“file”和服务器接收的参数 一一对应,保证多文件上传唯一key不变
-                builder.addFormDataPart("businessImage", file.getName(), RequestBody.create(null, file));
-            }
-        }
-        //创建RequestBody
-        RequestBody body = builder.build();
-        Observable<Object> o = paramService.uploads(mBuilder.getBaseUrl(), body);
-        toSubscribe(o, mBuilder.getWhat(), s);
-    }
-
-    private <T> void toSubscribe(Observable<T> o, final int what, Subscriber<Object> s) {
-        o.retryWhen(new Func1<Observable<? extends Throwable>, Observable<?>>() {
-
-            @Override
-            public Observable<?> call(Observable<? extends Throwable> t) {
-
-                return t.flatMap(new Func1<Throwable, Observable<?>>() {
-                    private int count = 0;
-
-                    @Override
-                    public Observable<?> call(Throwable t) {
-                        if (++count <= mbuilder.getMaxRetryCount()) {
-//							Logger.d("请求重试"+count+":"+t.getMessage());
-                            Observable<?> ob = Observable.timer(mbuilder.getRetryTimeout(), TimeUnit.MILLISECONDS);
-                            return ob;
-                        }
-
-                        return Observable.error(t);
-                    }
-                });
-            }
-        }).map(new Func1<T, T>() {
-            @Override
-            public T call(T t) {
-                HttpResult<T> httpResult = new HttpResult<>();
-                httpResult.setResponse(t);
-                httpResult.setWhat(what);
-                return t;
-            }
-        }).subscribeOn(RxJavaUtils.getScheduler("newThread"))
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(s);
-    }
-
-
-    public SSLSocketFactory createSSLSocketFactory() {
-        SSLSocketFactory ssfFactory = null;
-        try {
-            SSLContext sc = SSLContext.getInstance("TLS");
-            sc.init(null, new TrustManager[]{new TrustAllCerts()}, new SecureRandom());
-            ssfFactory = sc.getSocketFactory();
-        } catch (Exception e) {
-        }
-        return ssfFactory;
-    }
-
-}

+ 289 - 0
app_core/network/src/main/java/com/me/network/app/http/interceptor/HttpLoggerInterceptor.java

@@ -0,0 +1,289 @@
+package com.me.network.app.http.interceptor;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.concurrent.TimeUnit;
+
+import okhttp3.Connection;
+import okhttp3.Headers;
+import okhttp3.Interceptor;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import okhttp3.internal.http.HttpHeaders;
+import okhttp3.internal.platform.Platform;
+import okio.Buffer;
+import okio.BufferedSource;
+
+import static okhttp3.internal.platform.Platform.INFO;
+
+/**
+ * An OkHttp interceptor which logs request and response information. Can be applied as an
+ * {@linkplain OkHttpClient#interceptors() application interceptor} or as a {@linkplain
+ * OkHttpClient#networkInterceptors() network interceptor}. <p> The format of the logs created by
+ * this class should not be considered stable and may change slightly between releases. If you need
+ * a stable logging format, use your own interceptor.
+ */
+public final class HttpLoggerInterceptor implements Interceptor {
+    private static final Charset UTF8 = Charset.forName("UTF-8");
+
+    public enum Level {
+        /**
+         * No logs.
+         */
+        NONE,
+        /**
+         * Logs request and response lines.
+         * <p>
+         * <p>Example:
+         * <pre>{@code
+         * --> POST /greeting http/1.1 (3-byte body)
+         *
+         * <-- 200 OK (22ms, 6-byte body)
+         * }</pre>
+         */
+        BASIC,
+        /**
+         * Logs request and response lines and their respective headers.
+         * <p>
+         * <p>Example:
+         * <pre>{@code
+         * --> POST /greeting http/1.1
+         * Host: example.com
+         * Content-Type: plain/text
+         * Content-Length: 3
+         * --> END POST
+         *
+         * <-- 200 OK (22ms)
+         * Content-Type: plain/text
+         * Content-Length: 6
+         * <-- END HTTP
+         * }</pre>
+         */
+        HEADERS,
+        /**
+         * Logs request and response lines and their respective headers and bodies (if present).
+         * <p>
+         * <p>Example:
+         * <pre>{@code
+         * --> POST /greeting http/1.1
+         * Host: example.com
+         * Content-Type: plain/text
+         * Content-Length: 3
+         *
+         * Hi?
+         * --> END POST
+         *
+         * <-- 200 OK (22ms)
+         * Content-Type: plain/text
+         * Content-Length: 6
+         *
+         * Hello!
+         * <-- END HTTP
+         * }</pre>
+         */
+        BODY
+    }
+
+    public interface Logger {
+        void log(String message);
+
+        /**
+         * A {@link Logger} defaults output appropriate for the current platform.
+         */
+        Logger DEFAULT = new Logger() {
+            @Override
+            public void log(String message) {
+                Platform.get().log(INFO, message, null);
+            }
+        };
+    }
+
+    public HttpLoggerInterceptor() {
+        this(Logger.DEFAULT);
+    }
+
+    public HttpLoggerInterceptor(Logger logger) {
+        this.logger = logger;
+    }
+
+    private final Logger logger;
+
+    private volatile Level level = Level.NONE;
+
+    /**
+     * Change the level at which this interceptor logs.
+     */
+    public HttpLoggerInterceptor setLevel(Level level) {
+        if (level == null) throw new NullPointerException("level == null. Use Level.NONE instead.");
+        this.level = level;
+        return this;
+    }
+
+    public Level getLevel() {
+        return level;
+    }
+
+    @Override
+    public Response intercept(Chain chain) throws IOException {
+        Level level = this.level;
+
+        Request request = chain.request();
+        if (level == Level.NONE) {
+            return chain.proceed(request);
+        }
+
+        boolean logBody = level == Level.BODY;
+        boolean logHeaders = logBody || level == Level.HEADERS;
+
+        RequestBody requestBody = request.body();
+        boolean hasRequestBody = requestBody != null;
+
+        Connection connection = chain.connection();
+        String requestStartMessage = "--> request:"
+                + request.method()
+                + ' ' + request.url()
+                + (connection != null ? " " + connection.protocol() : "");
+        if (!logHeaders && hasRequestBody) {
+            requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
+        }
+        logger.log(requestStartMessage);
+
+        if (logHeaders) {
+            if (hasRequestBody) {
+                // Request body headers are only present when installed as a network interceptor. Force
+                // them to be included (when available) so there values are known.
+                if (requestBody.contentType() != null) {
+                    logger.log("Content-Type: " + requestBody.contentType());
+                }
+                if (requestBody.contentLength() != -1) {
+                    logger.log("Content-Length: " + requestBody.contentLength());
+                }
+            }
+
+            Headers headers = request.headers();
+            for (int i = 0, count = headers.size(); i < count; i++) {
+                String name = headers.name(i);
+                // Skip headers from the request body as they are explicitly logged above.
+                if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Length".equalsIgnoreCase(name)) {
+                    logger.log(name + ": " + headers.value(i));
+                }
+            }
+
+            if (!logBody || !hasRequestBody) {
+                logger.log("--> END " + request.method());
+            } else if (bodyEncoded(request.headers())) {
+                logger.log("--> END " + request.method() + " (encoded body omitted)");
+            } else {
+                Buffer buffer = new Buffer();
+                requestBody.writeTo(buffer);
+
+                Charset charset = UTF8;
+                MediaType contentType = requestBody.contentType();
+                if (contentType != null) {
+                    charset = contentType.charset(UTF8);
+                }
+
+                logger.log("");
+                if (isPlaintext(buffer)) {
+                    logger.log(buffer.readString(charset));
+                    logger.log("--> END " + request.method()
+                            + " (" + requestBody.contentLength() + "-byte body)");
+                } else {
+                    logger.log("--> END " + request.method() + " (binary "
+                            + requestBody.contentLength() + "-byte body omitted)");
+                }
+            }
+        }
+
+        long startNs = System.nanoTime();
+        Response response;
+        try {
+            response = chain.proceed(request);
+        } catch (Exception e) {
+            logger.log("<-- HTTP FAILED: " + e);
+            throw e;
+        }
+        long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);
+
+        ResponseBody responseBody = response.body();
+        long contentLength = responseBody.contentLength();
+        String bodySize = contentLength != -1 ? contentLength + "-byte" : "unknown-length";
+        logger.log("<-- response:"
+                + response.code()
+                + (response.message().isEmpty() ? "" : ' ' + response.message())
+                + ' ' + response.request().url()
+                + " (" + tookMs + "ms" + (!logHeaders ? ", " + bodySize + " body" : "") + ')');
+
+        if (logHeaders) {
+            Headers headers = response.headers();
+            for (int i = 0, count = headers.size(); i < count; i++) {
+                logger.log(headers.name(i) + ": " + headers.value(i));
+            }
+
+            if (!logBody || !HttpHeaders.hasBody(response)) {
+                logger.log("<-- END HTTP");
+            } else if (bodyEncoded(response.headers())) {
+                logger.log("<-- END HTTP (encoded body omitted)");
+            } else {
+                BufferedSource source = responseBody.source();
+                source.request(Long.MAX_VALUE); // Buffer the entire body.
+                Buffer buffer = source.buffer();
+
+                Charset charset = UTF8;
+                MediaType contentType = responseBody.contentType();
+                if (contentType != null) {
+                    charset = contentType.charset(UTF8);
+                }
+
+                if (!isPlaintext(buffer)) {
+                    logger.log("");
+                    logger.log("<-- END HTTP (binary " + buffer.size() + "-byte body omitted)");
+                    return response;
+                }
+
+                if (contentLength != 0) {
+                    logger.log("");
+                    logger.log(buffer.clone().readString(charset));
+                }
+
+                logger.log("<-- END HTTP (" + buffer.size() + "-byte body)");
+            }
+        }
+
+        return response;
+    }
+
+    /**
+     * Returns true if the body in question probably contains human readable text. Uses a small sample
+     * of code points to detect unicode control characters commonly used in binary file signatures.
+     */
+    static boolean isPlaintext(Buffer buffer) {
+        try {
+            Buffer prefix = new Buffer();
+            long byteCount = buffer.size() < 64 ? buffer.size() : 64;
+            buffer.copyTo(prefix, 0, byteCount);
+            for (int i = 0; i < 16; i++) {
+                if (prefix.exhausted()) {
+                    break;
+                }
+                int codePoint = prefix.readUtf8CodePoint();
+                if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
+                    return false;
+                }
+            }
+            return true;
+        } catch (EOFException e) {
+            return false; // Truncated UTF-8 sequence.
+        }
+    }
+
+    private boolean bodyEncoded(Headers headers) {
+        String contentEncoding = headers.get("Content-Encoding");
+        return contentEncoding != null && !contentEncoding.equalsIgnoreCase("identity");
+    }
+}

+ 3 - 5
app_core/network/src/main/java/com/me/network/app/http/interceptor/LogInterceptor.java → app_core/network/src/main/java/com/me/network/app/http/interceptor/NetInterceptor.java

@@ -14,15 +14,15 @@ import okhttp3.Request;
 import okhttp3.Response;
 import okhttp3.ResponseBody;
 
-public class LogInterceptor implements Interceptor {
+public class NetInterceptor implements Interceptor {
 
     private HttpClient builder;
 
-    public LogInterceptor() {
+    public NetInterceptor() {
         super();
     }
 
-    public LogInterceptor(HttpClient builder) {
+    public NetInterceptor(HttpClient builder) {
         this.builder = builder;
     }
 
@@ -30,9 +30,7 @@ public class LogInterceptor implements Interceptor {
     public Response intercept(Chain chain) throws IOException {
         Request request = chain.request();
         Map<String, Object> headers = new HashMap<>();
-        ;
         Map<String, Object> params = new HashMap<>();
-        ;
         Map<String, Object> postParam = new HashMap<>();
         //添加公共Header,公共参数
         if (builder != null) {

+ 20 - 0
app_core/network/src/main/java/com/me/network/app/http/logger/HttpLogger.java

@@ -0,0 +1,20 @@
+package com.me.network.app.http.logger;
+
+import android.util.Log;
+
+import com.me.network.app.http.interceptor.HttpLoggerInterceptor;
+
+/**
+ * @author RaoMeng
+ * @describe 请求信息打印类
+ * @date 2017/12/13 14:53
+ */
+
+public class HttpLogger implements HttpLoggerInterceptor.Logger {
+    @Override
+    public void log(String message) {
+        if (message != null) {
+            Log.d("HttpLogger", message);
+        }
+    }
+}

+ 0 - 18
app_core/network/src/main/java/com/me/network/app/http/rx/ResultSubscriber.java

@@ -16,14 +16,11 @@ public class ResultSubscriber<T> extends Subscriber<T> {
 
     private ResultListener<T> resultListener;
     private Result2Listener<T> result2Listener;
-    private ResultTagListener<T> mResultTagListener;
 
     public ResultSubscriber(ResultListener<T> listener) {
         if (listener != null) {
             if (listener instanceof Result2Listener) {
                 this.result2Listener = (Result2Listener<T>) listener;
-            } else if (listener instanceof ResultTagListener) {
-                this.mResultTagListener = (ResultTagListener<T>) listener;
             } else {
                 this.resultListener = listener;
             }
@@ -55,17 +52,6 @@ public class ResultSubscriber<T> extends Subscriber<T> {
             } else {
                 result2Listener.onFailure((T) e);
             }
-        } else if (mResultTagListener != null) {
-            if (e instanceof HttpException) {
-                HttpException he = (HttpException) e;
-                try {
-                    mResultTagListener.onError(he.response().errorBody().string());
-                } catch (IOException e1) {
-                    e1.printStackTrace();
-                }
-            } else {
-                mResultTagListener.onError((T) e);
-            }
         } else {
             if (e instanceof HttpException) {
                 try {
@@ -87,10 +73,6 @@ public class ResultSubscriber<T> extends Subscriber<T> {
         if (result2Listener != null) {
             result2Listener.onResponse(t);
         }
-        if (mResultTagListener != null) {
-            // TODO: 2017/11/13 实现带tag的回调方法
-            mResultTagListener.onSuccess(0, t);
-        }
     }
 
 }

+ 0 - 14
app_core/network/src/main/java/com/me/network/app/http/rx/ResultTagListener.java

@@ -1,14 +0,0 @@
-package com.me.network.app.http.rx;
-
-/**
- * @author RaoMeng
- * @describe
- * @date 2017/11/13 15:38
- */
-
-public interface ResultTagListener<T> extends ResultListener {
-
-    void onSuccess(int what, T t);
-
-    void onError(Object error);
-}

+ 0 - 29
app_core/network/src/main/java/com/me/network/app/http/rx/ResultTagSubscriber.java

@@ -1,29 +0,0 @@
-package com.me.network.app.http.rx;
-
-import com.me.network.app.http.HttpResult;
-
-import rx.Subscriber;
-
-/**
- * @author RaoMeng
- * @describe
- * @date 2017/11/14 10:45
- */
-
-public class ResultTagSubscriber<T extends HttpResult> extends Subscriber<T> {
-
-    @Override
-    public void onCompleted() {
-
-    }
-
-    @Override
-    public void onError(Throwable throwable) {
-
-    }
-
-    @Override
-    public void onNext(T t) {
-
-    }
-}

+ 1 - 1
app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java

@@ -9,7 +9,7 @@ import com.common.config.BaseConfig;
 public class SwitchUtil {
 
     public static boolean showYiyuanjuan() {
-        return BaseConfig.isDebug();
+        return BaseConfig.isDebug()&&false;
     }
 
     public static boolean showShebeiguanli() {

+ 5 - 5
app_modular/apputils/src/main/java/com/modular/apputils/widget/SpaceItemDecoration.java

@@ -31,12 +31,12 @@ public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
     @Override
     public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
         super.getItemOffsets(outRect, view, parent, state);
-        outRect.left = mSpace;
-        outRect.right = mSpace;
+//        outRect.left = mSpace;
+//        outRect.right = mSpace;
         outRect.bottom = mSpace;
-        if (parent.getChildAdapterPosition(view) == 0) {
-            outRect.top = mSpace;
-        }
+//        if (parent.getChildAdapterPosition(view) == 0) {
+//            outRect.top = mSpace;
+//        }
  
     }
  

+ 54 - 31
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java

@@ -38,54 +38,73 @@ public class BusinessTravelActivity extends BaseActivity {
     private RecyclerView mRecyclerView;
     private BusinessTravelAdapter mAdapter;
 
+    private int page = 1;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_business_travel);
         initView();
-//        loadData();
-        try {
-            handlerData(null);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+        loadData(page = 1);
     }
 
     private void initView() {
         mRefreshLayout = findViewById(R.id.mRefreshLayout);
         mRecyclerView = findViewById(R.id.mRecyclerView);
+        mRefreshLayout.setOnRefreshListener(new BaseRefreshLayout.onRefreshListener() {
+            @Override
+            public void onRefresh() {
+                loadData(page = 1);
+            }
+
+            @Override
+            public void onLoadMore() {
+                loadData(++page);
+            }
+        });
     }
 
 
-    public void loadData() {
-        progressDialog.show();
-        httpClient.Api().send(new HttpClient.Builder()
-                .url("mobile/getFeePlease.action")
-                .add("emcode", CommonUtil.getEmcode())
-                .header("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(BaseConfig.getContext(), "sessionId"))
-                .method(Method.GET)
-                .build(), new ResultSubscriber<>(new ResultListener<Object>() {
-            @Override
-            public void onResponse(Object o) {
-                try {
-                    if (o != null) {
-                        handlerData(o.toString());
-                    }
-                } catch (Exception e) {
-                    if (e != null) {
-                        LogUtil.i("e=" + e.getMessage());
-                        ToastUtil.showToast(ct, e.getMessage());
-                    }
-                }
+    public void loadData(int page) {
+        if (1 == 1) {
+            try {
+                handlerData(TestStr.FEEPLEASE);
                 mRefreshLayout.stopRefresh();
-                progressDialog.dismiss();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            if (!mRefreshLayout.isRefreshing()) {
+                progressDialog.show();
             }
-        }));
+            httpClient.Api().send(new HttpClient.Builder()
+                    .url("mobile/getFeePlease.action")
+                    .add("emcode", CommonUtil.getEmcode())
+                    .add("page", page)
+                    .header("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(BaseConfig.getContext(), "sessionId"))
+                    .method(Method.GET)
+                    .build(), new ResultSubscriber<>(new ResultListener<Object>() {
+                @Override
+                public void onResponse(Object o) {
+                    try {
+                        if (o != null) {
+                            handlerData(o.toString());
+                        }
+                    } catch (Exception e) {
+                        if (e != null) {
+                            LogUtil.i("e=" + e.getMessage());
+                            ToastUtil.showToast(ct, e.getMessage());
+                        }
+                    }
+                    mRefreshLayout.stopRefresh();
+                    progressDialog.dismiss();
+                }
+            }));
+        }
+
     }
 
     private void handlerData(String message) throws Exception {
-        LogUtil.i("message=" + message);
-        message = TestStr.FEEPLEASE;
         JSONArray listdata = JSONUtil.getJSONArray(message, "listdata");
         List<BusinessTravel> models = new ArrayList<>();
         BusinessTravel model = null;
@@ -115,7 +134,11 @@ public class BusinessTravelActivity extends BaseActivity {
             mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
             mRecyclerView.setAdapter(mAdapter);
         } else {
-            mAdapter.setModels(models);
+            if (page == 1) {
+                mAdapter.setModels(models);
+            } else {
+                mAdapter.addModels(models);
+            }
         }
     }
 }

+ 132 - 92
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java

@@ -8,9 +8,10 @@ import android.view.ViewGroup;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.baidu.cyberplayer.utils.G;
+
 import com.common.data.DateFormatUtil;
 import com.common.data.ListUtils;
+import com.modular.apputils.widget.TravelDirectionView;
 import com.uas.appworks.OA.platform.model.BusinessTravel;
 import com.uas.appworks.R;
 
@@ -72,10 +73,13 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
             BusinessTravel model = models.get(position);
             if (holder instanceof TitleViewHolder) {
                 bindTitleView((TitleViewHolder) holder, model);
-            } else if (holder instanceof AirViewHolder) {
-                bindAirView((AirViewHolder) holder, model, position);
-            } else if (holder instanceof HotelViewHolder) {
-                bindHotelView((HotelViewHolder) holder, model,position);
+            } else if (holder instanceof BaseViewHlder) {
+                bindBaseView((BaseViewHlder) holder, model, position);
+                if (holder instanceof AirViewHolder) {
+                    bindAirView((AirViewHolder) holder, model, position);
+                } else if (holder instanceof HotelViewHolder) {
+                    bindHotelView((HotelViewHolder) holder, model);
+                }
             }
 
         }
@@ -85,58 +89,60 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         holder.codeTv.setText(model.getCode());
     }
 
-    private void bindAirView(AirViewHolder holder, BusinessTravel model, int position) {
-        holder.codeTv.setText("住宿:"+model.getCode());
+
+    private void bindBaseView(BaseViewHlder holder, BusinessTravel model, int position) {
+        holder.codeTv.setText(model.getTitle());
         holder.statusTv.setText(model.getStatus());
-        holder.levelTv.setText(model.getLevel());
-        holder.businessNameTv.setText(model.getBusinessName());
-        String whenLongTv="入住"+DateFormatUtil.long2Str(model.getStartTime(),"MM:dd")+"      离店"+DateFormatUtil.long2Str(model.getStartTime(),"MM:dd")+"    共2晚";
-        holder.whenLongTv.setText(whenLongTv);
-        holder.numberTv.setText(model.getNumber()+"人");
         holder.nameTv.setText("龚鹏明");
-        holder.idTypeTv.setText("二代身份证");
-        holder.idCardTv.setText("450122xxxxxxxxxx");
-        holder.roomsTv.setText("1间");
+        holder.idCardTv.setText("450122xxxxxxx");
         holder.seatTv.setText(model.getSeat());
         holder.realFeeTv.setText(model.getRealFee());
         holder.payTypeTv.setText(model.getPayType());
-        holder.addressTv.setText(model.getAddress());
-        holder.dateTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD));
-        holder.numberSubTv.setText(model.getNumber() + "人");
+        holder.levelTv.setText(model.getLevel());
         holder.expecteFeeTv.setText(model.getExpecteFee());
-        holder.subRl.setVisibility(model.isExpand() ? View.VISIBLE : View.GONE);
+        holder.idTypeTv.setText("二代身份证");
+        holder.dateTv.setText(model.getDate());
         holder.doneTv.setTag(R.id.tag_key, model);
+        holder.doneTv.setTag(R.id.tag_key2, position);
         holder.doneTv.setOnClickListener(this);
         holder.expandTv.setTag(R.id.tag_key, model);
         holder.expandTv.setTag(R.id.tag_key2, position);
         holder.expandTv.setOnClickListener(this);
+        holder.subRl.setVisibility(model.isExpand() ? View.VISIBLE : View.GONE);
     }
 
-    private void bindHotelView(HotelViewHolder holder, BusinessTravel model, int position) {
-        holder.codeTv.setText(model.getCode());
-        holder.statusTv.setText(model.getStatus());
-        holder.levelTv.setText(model.getLevel());
-        holder.businessNameTv.setText(model.getBusinessName());
-        String whenLongTv="入住"+DateFormatUtil.long2Str(model.getStartTime(),"MM:dd")+"      离店"+DateFormatUtil.long2Str(model.getStartTime(),"MM:dd")+"    共2晚";
+    private void bindAirView(AirViewHolder holder, BusinessTravel model, int position) {
+        String fromCity = model.getStarting();
+        String toCity = model.getDestination();
+        //出发点
+        holder.fromCityTv.setText(fromCity);
+        holder.startDateTv.setText(DateFormatUtil.long2Str(model.getStartTime(), "yyyy-MM-dd"));
+        holder.startTimeTv.setText(DateFormatUtil.long2Str(model.getStartTime(), "HH:mm"));
+        holder.orderTypeTv.setText(model.getOrderType());
+        //目的地
+        holder.toCityTv.setText(toCity);
+        holder.toDateTv.setText(DateFormatUtil.long2Str(model.getEndTime(), "yyyy-MM-dd"));
+        holder.toTimeTv.setText(DateFormatUtil.long2Str(model.getEndTime(), "HH:mm"));
+        //行程
+        holder.tripTv.setText(fromCity + "-" + toCity);
+        holder.mTravelDirectionView.setData(model.getSeat(), longTime2Time(model.getAllTime()));
+        //改签
+        if (model.canChange()) {
+            holder.changeTv.setTag(R.id.tag_key, model);
+            holder.changeTv.setTag(R.id.tag_key2,position );
+            holder.changeTv.setOnClickListener(this);
+        }
+    }
+
+    private void bindHotelView(HotelViewHolder holder, BusinessTravel model) {
+        String whenLongTv = "入住: " + DateFormatUtil.long2Str(model.getStartTime(), "MM-dd") + "      离店: " + DateFormatUtil.long2Str(model.getStartTime(), "MM-dd") + "     共" + longTime2Time(model.getAllTime());
         holder.whenLongTv.setText(whenLongTv);
-        holder.numberTv.setText("1人");
-        holder.nameTv.setText("龚鹏明");
-        holder.idTypeTv.setText("二代身份证");
-        holder.idCardTv.setText("450122xxxxxxxxxx");
+        holder.businessNameTv.setText(model.getBusinessName());
+        holder.numberTv.setText(model.getNumber() + "人");
         holder.roomsTv.setText("1间");
-        holder.seatTv.setText(model.getSeat());
-        holder.realFeeTv.setText(model.getRealFee());
-        holder.payTypeTv.setText(model.getPayType());
         holder.addressTv.setText(model.getAddress());
         holder.dateTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD));
         holder.numberSubTv.setText(model.getNumber() + "人");
-        holder.expecteFeeTv.setText(model.getExpecteFee());
-        holder.subRl.setVisibility(model.isExpand() ? View.VISIBLE : View.GONE);
-        holder.doneTv.setTag(R.id.tag_key, model);
-        holder.doneTv.setOnClickListener(this);
-        holder.expandTv.setTag(R.id.tag_key, model);
-        holder.expandTv.setTag(R.id.tag_key2, position);
-        holder.expandTv.setOnClickListener(this);
     }
 
 
@@ -155,75 +161,101 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
 
         public TitleViewHolder(View itemView) {
             super(itemView);
-            codeTv = (TextView) itemView.findViewById(R.id.codeTv);
+            codeTv = itemView.findViewById(R.id.codeTv);
         }
     }
 
-    private class AirViewHolder extends RecyclerView.ViewHolder {
-        TextView codeTv, statusTv, levelTv, businessNameTv, whenLongTv, numberTv,
-                nameTv, idTypeTv, idCardTv, roomsTv, seatTv, realFeeTv, payTypeTv, doneTv, expandTv, addressTv, dateTv, numberSubTv, expecteFeeTv;
-        RelativeLayout subRl;
+    private class HotelViewHolder extends BaseViewHlder {
+        TextView
+                businessNameTv,
+                whenLongTv,
+                numberSubTv,//人数
+                numberTv,
+                dateTv,
+                addressTv,  //地址
+                roomsTv;//房间人数
 
-        public AirViewHolder(ViewGroup viewGroup) {
+        public HotelViewHolder(ViewGroup viewGroup) {
             this(getInflater().inflate(R.layout.item_bus_travel_hotel, viewGroup, false));
         }
 
-        public AirViewHolder(View itemView) {
+        public HotelViewHolder(View itemView) {
             super(itemView);
-            subRl = itemView.findViewById(R.id.subRl);
-            codeTv = itemView.findViewById(R.id.codeTv);
-            statusTv = itemView.findViewById(R.id.statusTv);
-            levelTv = itemView.findViewById(R.id.levelTv);
-            businessNameTv = itemView.findViewById(R.id.businessNameTv);
-            whenLongTv = itemView.findViewById(R.id.whenLongTv);
-            numberTv = itemView.findViewById(R.id.numberTv);
-            nameTv = itemView.findViewById(R.id.nameTv);
-            idTypeTv = itemView.findViewById(R.id.idTypeTv);
-            idCardTv = itemView.findViewById(R.id.idCardTv);
-            roomsTv = itemView.findViewById(R.id.roomsTv);
-            seatTv = itemView.findViewById(R.id.seatTv);
-            realFeeTv = itemView.findViewById(R.id.realFeeTv);
-            payTypeTv = itemView.findViewById(R.id.payTypeTv);
-            doneTv = itemView.findViewById(R.id.doneTv);
-            expandTv = itemView.findViewById(R.id.expandTv);
-            addressTv = itemView.findViewById(R.id.addressTv);
-            dateTv = itemView.findViewById(R.id.dateTv);
-            numberSubTv = itemView.findViewById(R.id.numberSubTv);
-            expecteFeeTv = itemView.findViewById(R.id.expecteFeeTv);
+            businessNameTv = (TextView) itemView.findViewById(R.id.businessNameTv);
+            whenLongTv = (TextView) itemView.findViewById(R.id.whenLongTv);
+            numberTv = (TextView) itemView.findViewById(R.id.numberTv);
+            dateTv = (TextView) itemView.findViewById(R.id.dateTv);
+            roomsTv = (TextView) itemView.findViewById(R.id.roomsTv);
+            addressTv = (TextView) itemView.findViewById(R.id.addressTv);
+            numberSubTv = (TextView) itemView.findViewById(R.id.numberSubTv);
         }
     }
 
-    private class HotelViewHolder extends RecyclerView.ViewHolder {
-        TextView codeTv, statusTv, levelTv, businessNameTv, whenLongTv, numberTv,
-                nameTv, idTypeTv, idCardTv, roomsTv, seatTv, realFeeTv, payTypeTv, doneTv, expandTv, addressTv, dateTv, numberSubTv, expecteFeeTv;
+    public class BaseViewHlder extends RecyclerView.ViewHolder {
+        TextView codeTv,//订单编号
+                statusTv,//订单状态
+                nameTv,//当前人名字
+                idCardTv,//身份证号
+                seatTv,//座位号|房间号
+                realFeeTv,//实际付款
+                payTypeTv,//付款类型(前台自付)
+                doneTv,     //操作
+                expandTv,   //拓展
+                levelTv,    //级别
+                expecteFeeTv,//预计费用
+                idTypeTv, //身份类型
+                dateTv;//入住时间|返程时间
         RelativeLayout subRl;
 
-        public HotelViewHolder(ViewGroup viewGroup) {
-            this(getInflater().inflate(R.layout.item_bus_travel_hotel, viewGroup, false));
+        public BaseViewHlder(View itemView) {
+            super(itemView);
+            subRl = (RelativeLayout) itemView.findViewById(R.id.subRl);
+            codeTv = (TextView) itemView.findViewById(R.id.codeTv);
+            statusTv = (TextView) itemView.findViewById(R.id.statusTv);
+            nameTv = (TextView) itemView.findViewById(R.id.nameTv);
+            idCardTv = (TextView) itemView.findViewById(R.id.idCardTv);
+            seatTv = (TextView) itemView.findViewById(R.id.seatTv);
+            realFeeTv = (TextView) itemView.findViewById(R.id.realFeeTv);
+            payTypeTv = (TextView) itemView.findViewById(R.id.payTypeTv);
+            doneTv = (TextView) itemView.findViewById(R.id.doneTv);
+            expandTv = (TextView) itemView.findViewById(R.id.expandTv);
+            levelTv = (TextView) itemView.findViewById(R.id.levelTv);
+            expecteFeeTv = (TextView) itemView.findViewById(R.id.expecteFeeTv);
+            idTypeTv = (TextView) itemView.findViewById(R.id.idTypeTv);
+            dateTv = (TextView) itemView.findViewById(R.id.dateTv);
         }
+    }
 
-        public HotelViewHolder(View itemView) {
+
+    private class AirViewHolder extends BaseViewHlder {
+        TextView fromCityTv,
+                startDateTv,
+                startTimeTv,
+                orderTypeTv,//票据类型
+                toCityTv,
+                toDateTv,
+                toTimeTv,
+                tripTv,
+                changeTv;
+        TravelDirectionView mTravelDirectionView;
+
+        public AirViewHolder(ViewGroup viewGroup) {
+            this(getInflater().inflate(R.layout.item_bus_travel_air, viewGroup, false));
+        }
+
+        public AirViewHolder(View itemView) {
             super(itemView);
-            subRl = itemView.findViewById(R.id.subRl);
-            codeTv = itemView.findViewById(R.id.codeTv);
-            statusTv = itemView.findViewById(R.id.statusTv);
-            levelTv = itemView.findViewById(R.id.levelTv);
-            businessNameTv = itemView.findViewById(R.id.businessNameTv);
-            whenLongTv = itemView.findViewById(R.id.whenLongTv);
-            numberTv = itemView.findViewById(R.id.numberTv);
-            nameTv = itemView.findViewById(R.id.nameTv);
-            idTypeTv = itemView.findViewById(R.id.idTypeTv);
-            idCardTv = itemView.findViewById(R.id.idCardTv);
-            roomsTv = itemView.findViewById(R.id.roomsTv);
-            seatTv = itemView.findViewById(R.id.seatTv);
-            realFeeTv = itemView.findViewById(R.id.realFeeTv);
-            payTypeTv = itemView.findViewById(R.id.payTypeTv);
-            doneTv = itemView.findViewById(R.id.doneTv);
-            expandTv = itemView.findViewById(R.id.expandTv);
-            addressTv = itemView.findViewById(R.id.addressTv);
-            dateTv = itemView.findViewById(R.id.dateTv);
-            numberSubTv = itemView.findViewById(R.id.numberSubTv);
-            expecteFeeTv = itemView.findViewById(R.id.expecteFeeTv);
+            changeTv = itemView.findViewById(R.id.changeTv);
+            mTravelDirectionView = itemView.findViewById(R.id.mTravelDirectionView);
+            fromCityTv = (TextView) itemView.findViewById(R.id.fromCityTv);
+            startDateTv = (TextView) itemView.findViewById(R.id.startDateTv);
+            startTimeTv = (TextView) itemView.findViewById(R.id.startTimeTv);
+            toCityTv = (TextView) itemView.findViewById(R.id.toCityTv);
+            toDateTv = (TextView) itemView.findViewById(R.id.toDateTv);
+            toTimeTv = (TextView) itemView.findViewById(R.id.toTimeTv);
+            orderTypeTv = (TextView) itemView.findViewById(R.id.orderTypeTv);
+            tripTv = (TextView) itemView.findViewById(R.id.tripTv);
+
         }
     }
 
@@ -242,4 +274,12 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         void click(int position, BusinessTravel model);
     }
 
+
+    private String longTime2Time(long time) {
+        long second = time / 1000;
+        long hh = second / 3600;
+        long mm = (second % 3600) / 60;
+        return hh + "小时" + mm + "分钟";
+    }
+
 }

+ 25 - 6
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/BusinessTravel.java

@@ -1,7 +1,7 @@
 package com.uas.appworks.OA.platform.model;
 
 import com.alibaba.fastjson.JSONObject;
-import com.common.LogUtil;
+import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 
 
@@ -34,6 +34,7 @@ public class BusinessTravel {
     private String payType;
     private String businessName;
     private String remark;
+    private String title;
 
     public BusinessTravel() {
     }
@@ -60,15 +61,20 @@ public class BusinessTravel {
             payType = JSONUtil.getText(reimbursement, "fpd_pay_type");
             businessName = JSONUtil.getText(reimbursement, "fpd_business_name");
             remark = JSONUtil.getText(reimbursement, "fpd_remark");
-            if (type.equals("train") || type.equals("air")) {
+            if (type.equals("train")) {
+                title = "火车票";
+                this.type = AIR;
+            } else if (type.equals("air")) {
+                title = "飞机票";
                 this.type = AIR;
             } else if (type.equals("hotel")) {
+                title = "住宿";
                 this.type = HOTEL;
             } else {
+                title = "出差单号";
                 this.type = TITLE;
             }
         } catch (Exception e) {
-            LogUtil.i("e="+e.getMessage());
         }
     }
 
@@ -121,7 +127,7 @@ public class BusinessTravel {
     }
 
     public String getCode() {
-        return code==null?"":code;
+        return code == null ? "" : code;
     }
 
     public void setCode(String code) {
@@ -201,7 +207,7 @@ public class BusinessTravel {
     }
 
     public String getAddress() {
-        return address==null?"":address;
+        return address == null ? "" : address;
     }
 
     public void setAddress(String address) {
@@ -217,7 +223,7 @@ public class BusinessTravel {
     }
 
     public String getBusinessName() {
-        return businessName==null?"":businessName;
+        return businessName == null ? "" : businessName;
     }
 
     public void setBusinessName(String businessName) {
@@ -239,4 +245,17 @@ public class BusinessTravel {
     public void setRemark(String remark) {
         this.remark = remark;
     }
+
+    public boolean canChange() {
+        //TODO 判断时候可以改签
+        return true;
+    }
+
+    public String getTitle() {
+        return title + "   " + code;
+    }
+
+    public String getDate() {
+        return type==AIR?(DateFormatUtil.long2Str(endTime,"yyyy-MM-dd")):(DateFormatUtil.long2Str(startTime,"yyyy-MM-dd")+"-"+DateFormatUtil.long2Str(endTime,"yyyy-MM-dd"));
+    }
 }

+ 1 - 5
app_modular/appworks/src/main/java/com/uas/appworks/activity/WorkModuleSortActivity.java

@@ -113,10 +113,8 @@ public class WorkModuleSortActivity extends BaseMVPActivity<WorkPlatPresenter> i
             @Override
             public void onDeleteItemClick(View view, int position) {
                 if (mAddWorkMenuBeans != null && mDeleteWorkMenuBeans != null && mAddWorkMenuBeans.size() > 0) {
-                    mDeleteWorkMenuBeans.add(mAddWorkMenuBeans.get(position));
-//                    mWorkModuleSortDeleteAdapter.notifyItemInserted(mDeleteWorkMenuBeans.size() - 1);
+                    mDeleteWorkMenuBeans.add(0, mAddWorkMenuBeans.get(position));
                     mAddWorkMenuBeans.remove(position);
-//                    mWorkModuleSortAddAdapter.notifyItemRemoved(position);
                     mWorkModuleSortAddAdapter.notifyDataSetChanged();
                     mWorkModuleSortDeleteAdapter.notifyDataSetChanged();
                     visiableOrGone();
@@ -129,9 +127,7 @@ public class WorkModuleSortActivity extends BaseMVPActivity<WorkPlatPresenter> i
             public void onAddItemClick(View view, int position) {
                 if (mDeleteWorkMenuBeans != null && mAddWorkMenuBeans != null && mDeleteWorkMenuBeans.size() > 0) {
                     mAddWorkMenuBeans.add(mDeleteWorkMenuBeans.get(position));
-//                    mWorkModuleSortAddAdapter.notifyItemInserted(mAddWorkMenuBeans.size() - 1);
                     mDeleteWorkMenuBeans.remove(position);
-//                    mWorkModuleSortDeleteAdapter.notifyItemRemoved(position);
                     mWorkModuleSortAddAdapter.notifyDataSetChanged();
                     mWorkModuleSortDeleteAdapter.notifyDataSetChanged();
                     visiableOrGone();

+ 1 - 1
app_modular/appworks/src/main/res/drawable/text_frame_radian_hint_bg.xml

@@ -3,7 +3,7 @@
     <item>
         <shape>
             <solid android:color="@color/white" />
-            <corners android:radius="10dp" />
+            <corners android:radius="3dp" />
             <stroke android:width="@dimen/line" android:color="@color/text_hine" />
             <padding android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp" />
         </shape>

+ 1 - 1
app_modular/appworks/src/main/res/drawable/text_frame_radian_red_bg.xml

@@ -3,7 +3,7 @@
     <item>
         <shape>
             <solid android:color="@color/white" />
-            <corners android:radius="10dp" />
+            <corners android:radius="3dp" />
             <stroke android:width="@dimen/line" android:color="@color/indianred" />
             <padding android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp" />
         </shape>

+ 363 - 0
app_modular/appworks/src/main/res/layout/item_bus_travel_air.xml

@@ -0,0 +1,363 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginLeft="@dimen/padding"
+    android:layout_marginRight="@dimen/padding"
+    android:background="@color/base_bg"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@drawable/radian_top_cui_bg"
+        android:paddingBottom="@dimen/padding">
+
+        <TextView
+            android:id="@+id/codeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:gravity="center_horizontal"
+            android:paddingBottom="5dp"
+            android:paddingTop="5dp"
+            android:text="单程机票:671283"
+            android:textColor="@color/white"
+            android:textSize="@dimen/text_hine" />
+
+        <TextView
+            android:id="@+id/statusTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_alignTop="@id/codeTv"
+            android:layout_marginRight="@dimen/padding"
+            android:text="已提交"
+            android:textColor="@color/cui_yellow"
+            android:textSize="@dimen/text_hine" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/line"
+            android:layout_below="@id/codeTv"
+            android:background="@color/white" />
+
+        <LinearLayout
+            android:id="@+id/fromLL"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/codeTv"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:gravity="center_horizontal"
+            android:orientation="vertical">
+
+            <TextView
+                android:id="@+id/fromCityTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="上海"
+                android:textColor="@color/white"
+                android:textSize="@dimen/textXXL" />
+
+            <TextView
+                android:id="@+id/startDateTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/fromCityTv"
+                android:lines="1"
+                android:text="2017-12-12"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_main" />
+
+            <TextView
+                android:id="@+id/startTimeTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="07:20"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_main" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/toLL"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_alignTop="@id/fromLL"
+            android:layout_marginLeft="@dimen/padding"
+            android:layout_marginRight="20dp"
+            android:gravity="center_horizontal"
+            android:orientation="vertical">
+
+            <TextView
+                android:id="@+id/toCityTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_below="@id/codeTv"
+                android:text="深圳"
+                android:textColor="@color/white"
+                android:textSize="@dimen/textXXL" />
+
+            <TextView
+                android:id="@+id/toDateTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_below="@id/fromCityTv"
+                android:gravity="center"
+                android:lines="1"
+                android:text="2017-12-12"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_main" />
+
+            <TextView
+                android:id="@+id/toTimeTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_horizontal"
+                android:text="07:20"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_main" />
+        </LinearLayout>
+
+
+        <com.modular.apputils.widget.TravelDirectionView
+            android:id="@+id/mTravelDirectionView"
+            android:layout_width="match_parent"
+            android:layout_height="60dp"
+            android:layout_alignTop="@id/fromLL"
+            android:layout_toLeftOf="@id/toLL"
+            android:layout_toRightOf="@id/fromLL"
+            app:time="2小时20分"
+            app:timeSize="@dimen/text_hine"
+            app:title="D7890"
+            app:titleSize="@dimen/text_main" />
+
+
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:padding="@dimen/padding">
+
+        <TextView
+            android:id="@+id/nameTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/padding"
+            android:text="周炳"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main" />
+
+        <TextView
+            android:id="@+id/idTypeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_alignTop="@id/nameTv"
+            android:layout_marginLeft="@dimen/padding"
+            android:text="二代身份证"
+            android:textColor="@color/text_hine"
+            android:textSize="@dimen/text_hine" />
+
+        <TextView
+            android:id="@+id/idCardTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/padding"
+            android:layout_toLeftOf="@id/idTypeTv"
+            android:layout_toRightOf="@id/nameTv"
+            android:text="4501221994312319827"
+            android:textColor="@color/text_hine"
+            android:textSize="@dimen/text_hine" />
+
+        <TextView
+            android:id="@+id/orderTypeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/nameTv"
+            android:layout_marginBottom="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:text="1间"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main" />
+
+        <TextView
+            android:id="@+id/seatTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignLeft="@id/idCardTv"
+            android:layout_alignTop="@id/orderTypeTv"
+            android:layout_marginRight="@dimen/padding"
+            android:text="A30H"
+            android:textColor="@color/indianred"
+            android:textSize="@dimen/text_main" />
+
+        <TextView
+            android:id="@+id/realFeeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignTop="@id/orderTypeTv"
+            android:layout_marginLeft="30dp"
+            android:layout_toRightOf="@id/seatTv"
+            android:text="54元"
+            android:textColor="@color/indianred"
+            android:textSize="@dimen/text_main" />
+
+        <TextView
+            android:id="@+id/payTypeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_alignTop="@id/orderTypeTv"
+            android:text="前台自付"
+            android:textColor="@color/indianred"
+            android:textSize="@dimen/text_main" />
+
+        <TextView
+            android:id="@+id/doneTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_below="@id/orderTypeTv"
+            android:background="@drawable/text_frame_radian_red_bg"
+            android:padding="4dp"
+            android:text="取消预约"
+            android:textColor="@color/indianred" />
+
+        <TextView
+            android:id="@+id/changeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/orderTypeTv"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_toLeftOf="@id/doneTv"
+            android:background="@drawable/text_frame_radian_hint_bg"
+            android:padding="4dp"
+            android:text="改签"
+            android:textColor="@color/text_hine" />
+
+        <TextView
+            android:id="@+id/expandTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignBottom="@id/doneTv"
+            android:drawableRight="@drawable/icon_more_down"
+            android:text="申请记录" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/line"
+            android:layout_below="@id/doneTv" />
+
+    </RelativeLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:background="@color/item_line" />
+
+    <RelativeLayout
+        android:id="@+id/subRl"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@drawable/radian_bottom_white_bg"
+        android:padding="6dp">
+
+        <TextView
+            android:id="@+id/addressTag"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:text="行程"
+            android:textColor="@color/text_hine" />
+
+        <TextView
+            android:id="@+id/tripTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignTop="@id/addressTag"
+            android:layout_marginLeft="40dp"
+            android:layout_toRightOf="@id/addressTag"
+            android:ellipsize="end"
+            android:lines="1"
+            android:text="城市地址"
+            android:textColor="@color/text_main" />
+
+        <TextView
+            android:id="@+id/dateTag"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/addressTag"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:text="返程时间:"
+            android:textColor="@color/text_hine" />
+
+        <TextView
+            android:id="@+id/dateTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignLeft="@id/tripTv"
+            android:layout_alignTop="@id/dateTag"
+            android:layout_toRightOf="@id/dateTag"
+            android:ellipsize="end"
+            android:lines="1"
+            android:text="城市地址"
+            android:textColor="@color/text_main" />
+
+        <TextView
+            android:id="@+id/numberTag"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/dateTag"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:text="席别:"
+            android:textColor="@color/text_hine" />
+
+        <TextView
+            android:id="@+id/levelTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignLeft="@id/tripTv"
+            android:layout_alignTop="@id/numberTag"
+            android:layout_toRightOf="@id/numberTag"
+            android:ellipsize="end"
+            android:lines="1"
+            android:text="城市地址"
+            android:textColor="@color/text_main" />
+
+
+        <TextView
+            android:id="@+id/expecteFeeTag"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/numberTag"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:text="预计费用:"
+            android:textColor="@color/text_hine" />
+
+        <TextView
+            android:id="@+id/expecteFeeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignLeft="@id/tripTv"
+            android:layout_alignTop="@id/expecteFeeTag"
+            android:layout_toRightOf="@id/expecteFeeTag"
+            android:ellipsize="end"
+            android:lines="1"
+            android:text="预计费用"
+            android:textColor="@color/text_main" />
+    </RelativeLayout>
+</LinearLayout>

+ 48 - 28
app_modular/appworks/src/main/res/layout/item_bus_travel_hotel.xml

@@ -11,12 +11,14 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/radian_top_cui_bg"
-        android:padding="6dp">
+        android:paddingBottom="@dimen/padding">
 
         <TextView
             android:id="@+id/codeTv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
             android:gravity="center_horizontal"
             android:paddingBottom="5dp"
             android:paddingTop="5dp"
@@ -30,11 +32,8 @@
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_alignTop="@id/codeTv"
-            android:paddingBottom="5dp"
-            android:paddingLeft="10dp"
-            android:paddingRight="10dp"
-            android:paddingTop="5dp"
-            android:text="住宿"
+            android:layout_marginRight="@dimen/padding"
+            android:text="状态"
             android:textColor="@color/cui_yellow"
             android:textSize="@dimen/text_hine" />
 
@@ -51,6 +50,7 @@
             android:layout_alignLeft="@id/codeTv"
             android:layout_below="@id/codeTv"
             android:layout_marginTop="@dimen/padding"
+            android:text="标准单人间"
             android:textColor="@color/white"
             android:textSize="@dimen/textXXL" />
 
@@ -59,7 +59,9 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignBottom="@id/levelTv"
+            android:layout_marginLeft="@dimen/padding"
             android:layout_toRightOf="@id/levelTv"
+            android:text="香格里拉酒店"
             android:textColor="@color/white"
             android:textSize="@dimen/textXL" />
 
@@ -69,6 +71,8 @@
             android:layout_height="wrap_content"
             android:layout_alignLeft="@id/levelTv"
             android:layout_below="@id/levelTv"
+            android:layout_marginTop="@dimen/padding"
+            android:text="入住:12-10     离店:12-12    共两晚"
             android:textColor="@color/white"
             android:textSize="@dimen/text_hine" />
 
@@ -78,6 +82,8 @@
             android:layout_height="wrap_content"
             android:layout_alignLeft="@id/whenLongTv"
             android:layout_below="@id/whenLongTv"
+            android:layout_marginTop="@dimen/padding"
+            android:text="1人"
             android:textColor="@color/white"
             android:textSize="@dimen/text_hine" />
 
@@ -88,13 +94,14 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/white"
-        android:padding="6dp">
+        android:padding="@dimen/padding">
 
         <TextView
             android:id="@+id/nameTv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginRight="@dimen/padding"
+            android:text="周炳"
             android:textColor="@color/text_main"
             android:textSize="@dimen/text_main" />
 
@@ -116,6 +123,7 @@
             android:layout_marginLeft="@dimen/padding"
             android:layout_toLeftOf="@id/idTypeTv"
             android:layout_toRightOf="@id/nameTv"
+            android:text="4501221994312319827"
             android:textColor="@color/text_hine"
             android:textSize="@dimen/text_hine" />
 
@@ -137,8 +145,8 @@
             android:layout_alignLeft="@id/idCardTv"
             android:layout_alignTop="@id/roomsTv"
             android:layout_marginRight="@dimen/padding"
-            android:text="1间"
-            android:textColor="@color/text_main"
+            android:text="A30H"
+            android:textColor="@color/indianred"
             android:textSize="@dimen/text_main" />
 
         <TextView
@@ -146,10 +154,10 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignTop="@id/roomsTv"
-            android:layout_marginLeft="@dimen/padding"
+            android:layout_marginLeft="30dp"
             android:layout_toRightOf="@id/seatTv"
-            android:text="1间"
-            android:textColor="@color/text_main"
+            android:text="54元"
+            android:textColor="@color/indianred"
             android:textSize="@dimen/text_main" />
 
         <TextView
@@ -158,8 +166,8 @@
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_alignTop="@id/roomsTv"
-            android:text="1间"
-            android:textColor="@color/text_main"
+            android:text="前台自付"
+            android:textColor="@color/indianred"
             android:textSize="@dimen/text_main" />
 
         <TextView
@@ -168,14 +176,16 @@
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_below="@id/roomsTv"
-            android:text="取消预约" />
+            android:background="@drawable/text_frame_radian_red_bg"
+            android:padding="4dp"
+            android:text="取消预约"
+            android:textColor="@color/indianred" />
 
         <TextView
             android:id="@+id/expandTv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignBottom="@id/doneTv"
-            android:layout_below="@id/roomsTv"
             android:drawableRight="@drawable/icon_more_down"
             android:text="申请记录" />
 
@@ -204,16 +214,20 @@
             android:layout_height="wrap_content"
             android:layout_marginRight="@dimen/padding"
             android:layout_marginTop="@dimen/padding"
-            android:text="城市地址" />
+            android:text="城市地址"
+            android:textColor="@color/text_hine" />
 
         <TextView
             android:id="@+id/addressTv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/padding"
+            android:layout_alignTop="@id/addressTag"
+            android:layout_marginLeft="40dp"
             android:layout_toRightOf="@id/addressTag"
             android:ellipsize="end"
-            android:lines="1" />
+            android:lines="1"
+            android:text="城市地址"
+            android:textColor="@color/text_main" />
 
         <TextView
             android:id="@+id/dateTag"
@@ -222,7 +236,8 @@
             android:layout_below="@id/addressTag"
             android:layout_marginRight="@dimen/padding"
             android:layout_marginTop="@dimen/padding"
-            android:text="入住日期:" />
+            android:text="入住日期:"
+            android:textColor="@color/text_hine" />
 
         <TextView
             android:id="@+id/dateTv"
@@ -230,10 +245,11 @@
             android:layout_height="wrap_content"
             android:layout_alignLeft="@id/addressTv"
             android:layout_alignTop="@id/dateTag"
-            android:layout_marginLeft="@dimen/padding"
             android:layout_toRightOf="@id/dateTag"
             android:ellipsize="end"
-            android:lines="1" />
+            android:lines="1"
+            android:text="城市地址"
+            android:textColor="@color/text_main" />
 
         <TextView
             android:id="@+id/numberTag"
@@ -242,7 +258,8 @@
             android:layout_below="@id/dateTag"
             android:layout_marginRight="@dimen/padding"
             android:layout_marginTop="@dimen/padding"
-            android:text="人数:" />
+            android:text="人数:"
+            android:textColor="@color/text_hine" />
 
         <TextView
             android:id="@+id/numberSubTv"
@@ -250,10 +267,11 @@
             android:layout_height="wrap_content"
             android:layout_alignLeft="@id/addressTv"
             android:layout_alignTop="@id/numberTag"
-            android:layout_marginLeft="@dimen/padding"
             android:layout_toRightOf="@id/numberTag"
             android:ellipsize="end"
-            android:lines="1" />
+            android:lines="1"
+            android:text="城市地址"
+            android:textColor="@color/text_main" />
 
 
         <TextView
@@ -263,7 +281,8 @@
             android:layout_below="@id/numberTag"
             android:layout_marginRight="@dimen/padding"
             android:layout_marginTop="@dimen/padding"
-            android:text="预计费用:" />
+            android:text="预计费用:"
+            android:textColor="@color/text_hine" />
 
         <TextView
             android:id="@+id/expecteFeeTv"
@@ -271,9 +290,10 @@
             android:layout_height="wrap_content"
             android:layout_alignLeft="@id/addressTv"
             android:layout_alignTop="@id/expecteFeeTag"
-            android:layout_marginLeft="@dimen/padding"
             android:layout_toRightOf="@id/expecteFeeTag"
             android:ellipsize="end"
-            android:lines="1" />
+            android:lines="1"
+            android:text="预计费用"
+            android:textColor="@color/text_main" />
     </RelativeLayout>
 </LinearLayout>

+ 1 - 0
app_modular/appworks/src/main/res/layout/item_bus_travel_title.xml

@@ -2,6 +2,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:background="@color/white"
     android:gravity="center_vertical"
     android:orientation="horizontal">