From e3864138492d1d3280710a1ba7162d9dd7542404 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 28 八月 2020 18:22:16 +0800
Subject: [PATCH] 1. 新增问题和删除修改功能(调试中) 2. 轨迹记录功能开放为所有类型的场景都记录

---
 app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressInterceptor.kt       |   23 +
 app/src/main/java/cn/flightfeather/thirdapp/common/net/ProgressRequestBody.kt              |   38 +
 app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt             |   23 
 app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt                            |   12 
 app/src/main/res/values/styles.xml                                                         |   11 
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt |  254 +++++++++++
 app/src/main/java/cn/flightfeather/thirdapp/repository/dao/MediaFileDao.kt                 |   22 +
 app/src/main/java/cn/flightfeather/thirdapp/view/PopupWindowWithMask.kt                    |   65 ++
 app/src/main/res/drawable-xxhdpi/shape_black_spinner.xml                                   |   21 
 app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt                    |    8 
 app/src/main/java/cn/flightfeather/thirdapp/model/bean/BaseResponse.kt                     |   12 
 app/src/main/java/cn/flightfeather/thirdapp/util/updateApp/UpdateAppUtil.java              |    2 
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt      |  116 +++--
 app/src/main/res/layout/dialog_take_evidence.xml                                           |  108 ++--
 app/src/main/res/layout/item_spinner_drop_down.xml                                         |    3 
 app/src/main/java/cn/flightfeather/thirdapp/common/net/ResponseBodyCallBack2.kt            |   26 +
 app/src/main/java/cn/flightfeather/thirdapp/httpservice/MediaFileService.kt                |   20 
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListViewModel.kt  |   26 +
 app/src/main/res/values/strings.xml                                                        |    1 
 app/src/main/java/cn/flightfeather/thirdapp/common/net/ResultCallBack2.kt                  |   24 +
 app/src/main/AndroidManifest.xml                                                           |    2 
 app/src/main/java/cn/flightfeather/thirdapp/repository/ProblemRepository.kt                |  151 ++++++
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt  |   32 
 app/src/main/res/drawable/ic_unfold_more_black_20dp.xml                                    |    4 
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemListActivity.kt   |   30 +
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt        |    2 
 app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressListener.kt          |   10 
 app/src/main/java/cn/flightfeather/thirdapp/common/net/RetrofitFactory.kt                  |   45 ++
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListActivity.kt   |   30 +
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt        |    3 
 app/src/main/java/cn/flightfeather/thirdapp/module/common/CameraActivity.kt                |    2 
 app/src/main/java/cn/flightfeather/thirdapp/bean/vo/ProblemDetailVo.kt                     |   10 
 app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt                   |   21 
 app/src/main/java/cn/flightfeather/thirdapp/httpservice/ProblemListService.java            |   15 
 app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt                 |    6 
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt     |  106 ++++
 app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuRecheckActivity.kt       |    4 
 37 files changed, 1,137 insertions(+), 151 deletions(-)

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fc63e4e..3791057 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -192,6 +192,8 @@
             android:theme="@style/AppTheme.NoActionBar" />
         <activity android:name=".module.inspection.MenuEvidenceActivity"
             android:theme="@style/TransparentTheme" />
+        <activity android:name=".module.inspection.MenuProblemUpdateActivity"
+            android:theme="@style/TransparentTheme" />
         <activity android:name=".module.inspection.MenuRecheckActivity"
             android:theme="@style/TransparentTheme" />
         <activity android:name=".module.inspection.MenuProblemListActivity"
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/bean/vo/ProblemDetailVo.kt b/app/src/main/java/cn/flightfeather/thirdapp/bean/vo/ProblemDetailVo.kt
new file mode 100644
index 0000000..c1c8cc0
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/bean/vo/ProblemDetailVo.kt
@@ -0,0 +1,10 @@
+package cn.flightfeather.thirdapp.bean.vo
+
+/**
+ * @author riku
+ * Date: 2020/7/30
+ */
+data class ProblemDetailVo(
+        var problemTypeName: String,
+        var problems: List<String>
+)
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt
index d46e875..ce71fa6 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt
@@ -8,24 +8,32 @@
  * @author riku
  * Date: 2019/5/16
  */
-class DbFactory private constructor(application: CommonApplication){
+class DbFactory private constructor(private val application: CommonApplication){
+
+    private var daoSession: DaoSession? = null
+
+    init {
+        daoSession = application.daoSession
+    }
 
     companion object {
 
         @Volatile
-        private lateinit var daoSession: DaoSession
+        private var mDbFactory: DbFactory? = null
 
         //鏁版嵁搴撳垵濮嬪寲
         @JvmStatic
         @Synchronized
         fun init(application: CommonApplication) {
-            daoSession = application.daoSession
+            if (mDbFactory == null) {
+                mDbFactory = DbFactory(application)
+            }
         }
 
         //鑾峰彇鏁版嵁搴撴搷浣滃璞aoSession
         fun getGreenDaoObservable(): Observable<DaoSession> {
             return Observable.create { emitter ->
-                daoSession.let {
+                mDbFactory?.daoSession?.let {
                     emitter.onNext(it)
                     emitter.onComplete()
                 }
@@ -33,7 +41,10 @@
         }
 
         fun getInstance(): DaoSession {
-            return daoSession
+            if (mDbFactory == null) {
+                mDbFactory = DbFactory(CommonApplication.getInstance())
+            }
+            return mDbFactory!!.daoSession!!
         }
     }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressInterceptor.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressInterceptor.kt
new file mode 100644
index 0000000..5e4fac8
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressInterceptor.kt
@@ -0,0 +1,23 @@
+package cn.flightfeather.thirdapp.common.net
+
+import okhttp3.Interceptor
+import okhttp3.Response
+
+/**
+ * @author riku
+ * Date: 2020/4/24
+ */
+class NetWorkProgressInterceptor(private val netWorkProgressListener: NetWorkProgressListener) : Interceptor {
+    override fun intercept(chain: Interceptor.Chain): Response {
+        val request = chain.request()
+        if (request.body() == null) {
+            return chain.proceed(request)
+        }
+        val b = request.newBuilder()
+            .method(
+                request.method(),
+                ProgressRequestBody(request.body(), netWorkProgressListener))
+            .build()
+        return chain.proceed(b)
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressListener.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressListener.kt
new file mode 100644
index 0000000..74c6ce1
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/net/NetWorkProgressListener.kt
@@ -0,0 +1,10 @@
+package cn.flightfeather.thirdapp.common.net
+
+/**
+ * @author riku
+ * Date: 2020/4/24
+ * 涓婁紶銆佷笅杞借繘搴︾洃鍚帴鍙�
+ */
+interface NetWorkProgressListener {
+    fun onProgress(progress: Long, total: Long)
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/net/ProgressRequestBody.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/net/ProgressRequestBody.kt
new file mode 100644
index 0000000..8faaae6
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/net/ProgressRequestBody.kt
@@ -0,0 +1,38 @@
+package cn.flightfeather.thirdapp.common.net
+
+import cn.flightfeather.thirdapp.common.net.NetWorkProgressListener
+import okhttp3.MediaType
+import okhttp3.RequestBody
+import okio.*
+
+/**
+ * @author riku
+ * Date: 2020/4/24
+ * 甯﹁繘搴﹀洖璋冪殑RequestBody
+ */
+class ProgressRequestBody(
+    private val mRequestBody: RequestBody?,
+    private val netWorkProgressListener: NetWorkProgressListener
+) : RequestBody() {
+
+    override fun contentType(): MediaType? = mRequestBody?.contentType()
+
+    override fun contentLength(): Long = mRequestBody?.contentLength() ?: super.contentLength()
+
+    override fun writeTo(sink: BufferedSink) {
+        val progressSink = ProgressSink(sink)
+        val newSink = Okio.buffer(progressSink)
+        mRequestBody?.writeTo(newSink)
+        newSink.flush()
+    }
+
+    inner class ProgressSink(delegate: Sink) : ForwardingSink(delegate) {
+        private var bytesWritten = 0L
+
+        override fun write(source: Buffer, byteCount: Long) {
+            super.write(source, byteCount)
+            bytesWritten += byteCount
+            netWorkProgressListener.onProgress(bytesWritten, contentLength())
+        }
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/net/ResponseBodyCallBack2.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/net/ResponseBodyCallBack2.kt
new file mode 100644
index 0000000..2ad7221
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/net/ResponseBodyCallBack2.kt
@@ -0,0 +1,26 @@
+package cn.flightfeather.thirdapp.common.net
+
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
+import cn.flightfeather.thirdapp.model.bean.BaseResponse
+
+/**
+ * @author riku
+ * Date: 2020/8/4
+ * 鐩告瘮浜嶽ResponseBodyCallBack], 灏嗚繑鍥炵粨鏋滅敤[BaseResponse]杩涜缁熶竴鍖呰
+ */
+class ResponseBodyCallBack2<T>(private val resultCallBack: ResultCallBack2<T>?) : Callback<BaseResponse<T>> {
+    override fun onFailure(p0: Call<BaseResponse<T>>, p1: Throwable) {
+        resultCallBack?.onFailure("缃戠粶杩炴帴閿欒锛岃妫�鏌ョ綉缁�")
+    }
+
+    override fun onResponse(p0: Call<BaseResponse<T>>, p1: Response<BaseResponse<T>>) {
+        if (p1.isSuccessful && p1.body()?.success == true) {
+            resultCallBack?.onSuccess(p1.body()?.data, p1.body()?.message ?: "")
+        } else {
+            resultCallBack?.onFailure(p1.body()?.message ?: "")
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/net/ResultCallBack2.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/net/ResultCallBack2.kt
new file mode 100644
index 0000000..b85d188
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/net/ResultCallBack2.kt
@@ -0,0 +1,24 @@
+package cn.flightfeather.thirdapp.common.net
+
+/**
+ * @author riku
+ * Date: 2019/4/24
+ * 鏁版嵁鑾峰彇缁撴灉鍥炶皟
+ * MVVM妯″紡涓紝鏁版嵁浠撳簱锛坮epository锛夌鐞嗘墍鏈夌殑鏁版嵁鑾峰彇鍏蜂綋瀹炵幇锛屾彁渚涙鎺ュ彛鏉ュ疄鐜版暟鎹幏鍙栧悇姝ラ涓殑鏂规硶鍥炶皟
+ */
+interface ResultCallBack2<T> {
+
+    /**
+     * 鍒嗛〉淇℃伅鑾峰彇
+     * @param current 褰撳墠椤电爜锛堟渶灏忎负1锛�
+     * @param total 鎬婚〉鏁�
+     */
+    fun onPage(current: Int, total: Int) = Unit
+
+    fun onSuccess(result: T?, message: String)
+
+    fun onCacheSuccess(result: T?) = Unit
+
+    fun onFailure(message:String)
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/net/RetrofitFactory.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/net/RetrofitFactory.kt
index a9169a0..0fa1d28 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/common/net/RetrofitFactory.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/net/RetrofitFactory.kt
@@ -1,20 +1,54 @@
 package cn.flightfeather.thirdapp.common.net
 
+import cn.flightfeather.thirdapp.BuildConfig
 import cn.flightfeather.thirdapp.CommonApplication
+import com.google.gson.GsonBuilder
 import io.reactivex.Observable
 import io.reactivex.android.schedulers.AndroidSchedulers
 import io.reactivex.schedulers.Schedulers
+import okhttp3.Interceptor
+import okhttp3.OkHttpClient
 import retrofit2.Response
 import retrofit2.Retrofit
+import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
+import retrofit2.converter.gson.GsonConverterFactory
+import java.util.concurrent.TimeUnit
 
 /**
  * @author riku
  * Date: 2019/7/22
  * 缃戠粶璇锋眰
  */
-class RetrofitFactory constructor(application: CommonApplication){
+class RetrofitFactory constructor(val application: CommonApplication){
 
     val retrofit: Retrofit = application.retrofit
+    val retrofitImage: Retrofit = application.retrofitImage
+
+    private fun newOkHttpClient(list: List<Interceptor>): OkHttpClient =
+            OkHttpClient.Builder()
+                    .connectTimeout(20 * 1000L, TimeUnit.MILLISECONDS)
+                    .apply {
+                        list.forEach {
+                            addInterceptor(it)
+                        }
+                    }
+                    .build()
+
+    private fun newRetrofit(mOkHttpClient: OkHttpClient): Retrofit =
+            Retrofit.Builder()
+                    .apply {
+                        baseUrl(application.ROOT_URL_RELEASE)
+                    }
+                    .addConverterFactory(
+                            GsonConverterFactory.create(
+                                    GsonBuilder()
+                                            .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
+                                            .create()
+                            )
+                    )
+                    .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
+                    .client(mOkHttpClient)
+                    .build()
 
     companion object {
 
@@ -35,5 +69,14 @@
                     .observeOn(AndroidSchedulers.mainThread())
                     .subscribe(subscriber)
         }
+
+        fun withProgressListeningRetrofit(listener: NetWorkProgressListener?): Retrofit {
+            return if (listener == null) {
+                instance.retrofit
+            } else {
+                val c = instance.newOkHttpClient(listOf(NetWorkProgressInterceptor(listener)))
+                instance.newRetrofit(c)
+            }
+        }
     }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/httpservice/MediaFileService.kt b/app/src/main/java/cn/flightfeather/thirdapp/httpservice/MediaFileService.kt
new file mode 100644
index 0000000..8b2b98b
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/httpservice/MediaFileService.kt
@@ -0,0 +1,20 @@
+package cn.flightfeather.thirdapp.httpservice
+
+import okhttp3.ResponseBody
+import retrofit2.Call
+import retrofit2.http.DELETE
+import retrofit2.http.GET
+import retrofit2.http.Path
+import retrofit2.http.Url
+
+/**
+ * @author riku
+ * Date: 2020/8/6
+ */
+interface MediaFileService {
+    @GET
+    fun downloadImage(@Url fileUrl: String): Call<ResponseBody>
+
+    @DELETE("mediafile/{MediaFileGUID}/ ")
+    fun deleteMediaFile(@Path("MediaFileGUID") mediaFileGuid: String): Call<ResponseBody>
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/httpservice/ProblemListService.java b/app/src/main/java/cn/flightfeather/thirdapp/httpservice/ProblemListService.java
index f91e634..d23aa4b 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/httpservice/ProblemListService.java
+++ b/app/src/main/java/cn/flightfeather/thirdapp/httpservice/ProblemListService.java
@@ -1,18 +1,24 @@
 package cn.flightfeather.thirdapp.httpservice;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import cn.flightfeather.thirdapp.bean.vo.AreaVo;
 import cn.flightfeather.thirdapp.bean.vo.ChargeInfoVo;
+import cn.flightfeather.thirdapp.bean.vo.ProblemDetailVo;
 import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo;
 import cn.flightfeather.thirdapp.bean.vo.StatisticsVo;
+import cn.flightfeather.thirdapp.model.bean.BaseResponse;
+import io.reactivex.Observable;
 import okhttp3.ResponseBody;
 import retrofit2.Call;
+import retrofit2.Response;
 import retrofit2.http.Body;
 import retrofit2.http.Field;
 import retrofit2.http.FormUrlEncoded;
 import retrofit2.http.GET;
 import retrofit2.http.POST;
+import retrofit2.http.Path;
 import retrofit2.http.Query;
 
 /**
@@ -41,4 +47,13 @@
     //鏇存柊闂
     @POST("problemlist/")
     Call<ResponseBody> updateProblemList(@Body ProblemlistVo problemlistVo);
+
+    @GET("problemtype/byScene")
+    Observable<Response<ArrayList<ProblemDetailVo>>> getBySceneType(@Query("sceneTypeId") int sceneTypeId);
+
+    /**
+     * 璁剧疆闂涓哄垹闄ょ姸鎬�
+     */
+    @POST("problemlist/{id}")
+    Call<BaseResponse<Integer>> deleteProblem(@Path("id") String problemId);
 }
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/model/bean/BaseResponse.kt b/app/src/main/java/cn/flightfeather/thirdapp/model/bean/BaseResponse.kt
new file mode 100644
index 0000000..6d5cf6c
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/model/bean/BaseResponse.kt
@@ -0,0 +1,12 @@
+package cn.flightfeather.thirdapp.model.bean
+
+/**
+ * @author riku
+ * Date: 2020/8/4
+ * 缃戠粶璇锋眰杩斿洖鏁版嵁鍩虹被
+ */
+data class BaseResponse<T>(
+        val success: Boolean,
+        val message: String,
+        val data: T?
+)
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
index 17463b1..bcd8e5d 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
@@ -1,7 +1,9 @@
 package cn.flightfeather.thirdapp.module.base
 
+import android.annotation.SuppressLint
 import android.content.Context
 import android.content.Intent
+import android.content.pm.ActivityInfo
 import android.os.Bundle
 import android.support.v4.app.Fragment
 import android.support.v4.app.FragmentManager
@@ -25,8 +27,14 @@
 
     protected val disposableList = mutableListOf<Disposable>()
 
+    @SuppressLint("SourceLockedOrientationActivity")
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+        try {
+            requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
         setContentView(getLayoutId())
         rootView = findViewById<ViewGroup>(android.R.id.content).getChildAt(0) as ViewGroup
     }
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
index 989accf..9e0f1a3 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
@@ -31,8 +31,8 @@
         const val EXTRA_SELECT_IMAGES = ImagePicker.EXTRA_SELECT_IMAGES
     }
 
-    //鎷嶆憚鐨勫緟涓婁紶鐨勫浘鐗囨枃浠跺垪琛�
-    val pathTempList = mutableListOf<File>()
+    //鎷嶆憚鐨勫緟涓婁紶鐨勫浘鐗囨枃浠跺垪琛�, true: 浠h〃闇�瑕佷笂浼狅紱false: 浠h〃涓嶉渶瑕佷笂浼�
+    val pathTempList = mutableListOf<Pair<File, Boolean>>()
 
     // fixme: 2019/8/2  鐢变簬鍘熶唬鐮佷腑澶ч儴鍒嗗浘鐗囨媿鎽勫浐瀹氭浜嗘渶澶�3寮狅紝鎵�浠ユ病鏈変娇鐢ㄥ垪琛ㄧ粨鏋勶紝鑰屾槸鎵嬪姩璁剧疆浜�3涓狪mageView锛屾澶勬殏鏃跺欢鐢紝涓嶅仛淇敼
     var imageViewList = mutableListOf<ImageView>()
@@ -56,8 +56,8 @@
                 //鏌ョ湅涓存椂鎷嶆憚鍥剧墖鍙互鍒犻櫎
                 data?.getIntExtra("position", -1)?.let {
                     if (it > -1) {
-                        if (pathTempList[it].exists()) {
-                            pathTempList[it].delete()
+                        if (pathTempList[it].first.exists()) {
+                            pathTempList[it].first.delete()
                         }
                         pathTempList.removeAt(it)
                         refreshImageView()
@@ -74,7 +74,7 @@
                     }
                     try {
                         FileUtil.copyFile(oldFile, newFile)
-                        pathTempList.add(newFile)
+                        pathTempList.add(Pair(newFile, true))
                     } catch (e: IOException) {
                         e.printStackTrace()
                         application.toast("澶嶅埗鏂囦欢澶辫触")
@@ -92,14 +92,17 @@
                 i < picSize -> {
                     imageViewList[i].setOnClickListener(viewPhotoClickListener(i))
                     // fixme: 2019/8/2 姝ゅ缁檌mageVIew璁剧疆鍥剧墖鍦ㄥ師浠g爜涓槸鑷畾涔変簡涓�涓狝syncTask锛屼箣鍚庡彲浠ョ敤Glide绛夌涓夋柟妗嗘灦鏇夸唬
-                    SetImageTask(pathTempList[i], imageViewList[i]).execute()
+                    imageViewList[i].scaleType = ImageView.ScaleType.CENTER_CROP
+                    SetImageTask(pathTempList[i].first, imageViewList[i]).execute()
                 }
                 i == picSize -> imageViewList[i].run {
                     setOnClickListener(takePhotoClickListener(i))
+                    scaleType = ImageView.ScaleType.FIT_CENTER
                     setImageResource(R.drawable.icon_add_photo)
                 }
                 else -> imageViewList[i].run {
                     setOnClickListener(null)
+                    scaleType = ImageView.ScaleType.FIT_CENTER
                     setImageResource(R.drawable.icon_add_photo_blank)
                 }
             }
@@ -109,11 +112,15 @@
     //鏈夊浘鐗囨椂锛屾煡鐪嬪浘鐗囩殑鐐瑰嚮浜嬩欢(temp)
     fun viewPhotoClickListener(position: Int): View.OnClickListener {
         return View.OnClickListener {
+            val fileList = mutableListOf<File>()
+            pathTempList.forEach {
+                fileList.add(it.first)
+            }
             val intent = Intent(this, PhotoViewerActivity::class.java)
             intent.putExtra("position", position)
             intent.putExtra("type", PhotoViewerActivity.EVIDENCE_PHOTO_TEMP)
             intent.putExtra("deletable", picDeletable)
-            intent.putExtra(PhotoViewerActivity.PARA_FILES, pathTempList as Serializable)
+            intent.putExtra(PhotoViewerActivity.PARA_FILES, fileList as Serializable)
             startActivityForResult(intent, VIEW_PHOTO)
         }
     }
@@ -123,7 +130,7 @@
         return View.OnClickListener {
             val t = imageViewList.size - pathTempList.size
             val picNum = if (t >= 0) t else 0
-            PhotoUtil.pickPhoto2(this, TAKE_PHOTO, picNum)
+            PhotoUtil.pickPhoto(this, TAKE_PHOTO, picNum)
         }
     }
 
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/common/CameraActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/common/CameraActivity.kt
index b9f5f87..ffb3715 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/common/CameraActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/common/CameraActivity.kt
@@ -98,7 +98,7 @@
     private fun initLocation() {
         locationUtil = LocationUtil(this)
         locationUtil.startLocation {
-            val date = Date(it.time)
+            val date = Date()
             val time = DateFormatter.dateTimeFormat3.format(date)
             val locationInfo = "缁忓害: ${it.longitude}" +
                     "\n绾害: ${it.latitude}" +
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListActivity.kt
index 4400f98..47a2a08 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListActivity.kt
@@ -10,9 +10,13 @@
 import cn.flightfeather.thirdapp.adapter.ProblemListAdapter
 import cn.flightfeather.thirdapp.adapter.RecyclerItemClickListener
 import cn.flightfeather.thirdapp.bean.Inspection
+import cn.flightfeather.thirdapp.bean.Scense
 import cn.flightfeather.thirdapp.bean.Subtask
+import cn.flightfeather.thirdapp.model.event.ProblemEvent
 import cn.flightfeather.thirdapp.module.base.BaseActivity
 import kotlinx.android.synthetic.main.dialog_problem_list.*
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
 
 /**
  * @author riku
@@ -33,17 +37,21 @@
      */
     abstract var type: Int
 
-    var subTaskSelected: Subtask? = null
-    var inspection: Inspection? = null
-    var lat: Double = 0.0
-    var lng: Double = 0.0
+    protected var subTaskSelected: Subtask? = null
+    protected var inspection: Inspection? = null
+    protected var scene: Scense? = null
+    protected var lat: Double = 0.0
+    protected var lng: Double = 0.0
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+        EventBus.getDefault().register(this)
+
         viewModel = ViewModelProviders.of(this).get(BaseProblemListViewModel::class.java)
 
         subTaskSelected = intent.getSerializableExtra("subTask") as Subtask?
         inspection = intent.getSerializableExtra("inspection") as Inspection?
+        scene = intent.getSerializableExtra("scene") as Scense?
         lat = intent.getDoubleExtra("lat", 0.0)
         lng = intent.getDoubleExtra("lng", 0.0)
 
@@ -67,6 +75,7 @@
                 }
 
                 override fun onItemLongClick(view: View?, position: Int) {
+                    onItemViewLongClick(view, position)
                 }
 
             }))
@@ -74,10 +83,10 @@
 
         tv_title.text = when (type) {
             InspectionDetailActivity.PROBLEM_LIST -> "闂娓呭崟"
-            InspectionDetailActivity.PROBLEM_CHECK -> "闂瀹℃牳"
-            InspectionDetailActivity.CHANGE_CHECK -> "鏁存敼瀹℃牳"
             InspectionDetailActivity.PROBLEM_CHANGE -> "鐜板満鏁存敼"
             InspectionDetailActivity.PROBLEM_RECHECK -> "闂澶嶆牳"
+            InspectionDetailActivity.PROBLEM_CHECK -> "闂瀹℃牳"
+            InspectionDetailActivity.CHANGE_CHECK -> "鏁存敼瀹℃牳"
             else -> ""
         }
 
@@ -85,4 +94,13 @@
             finish()
         }
     }
+
+    open fun onItemViewLongClick(view: View?, position: Int) {
+
+    }
+
+    @Subscribe
+    fun onPutProblem(problemEvent: ProblemEvent) {
+        viewModel.getProblems(inspection?.guid)
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListViewModel.kt
index 0deceaa..a1f72a9 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListViewModel.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/BaseProblemListViewModel.kt
@@ -5,9 +5,14 @@
 import cn.flightfeather.thirdapp.bean.Subtask
 import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo
 import cn.flightfeather.thirdapp.common.net.ResultCallBack
+import cn.flightfeather.thirdapp.common.net.ResultCallBack2
+import cn.flightfeather.thirdapp.model.event.ProblemEvent
 import cn.flightfeather.thirdapp.module.base.BaseViewModel
 import cn.flightfeather.thirdapp.repository.InspectionRepository
+import cn.flightfeather.thirdapp.repository.ProblemRepository
 import cn.flightfeather.thirdapp.util.DateFormatter
+import org.greenrobot.eventbus.EventBus
+import org.jetbrains.anko.toast
 
 /**
  * @author riku
@@ -16,6 +21,7 @@
 class BaseProblemListViewModel : BaseViewModel() {
 
     private val inspectionRepository = InspectionRepository()
+    private val problemRepository = ProblemRepository()
 
     var problemList = MutableLiveData<ArrayList<ProblemlistVo>>().apply { value = ArrayList() }
 
@@ -67,4 +73,24 @@
             })
         }
     }
+
+    /**
+     * 鍒犻櫎闂
+     */
+    fun deleteProblem(position: Int, s: () -> Unit) {
+        problemList.value?.get(position)?.let {
+            problemRepository.deleteProblem(it.guid ?: "", object : ResultCallBack2<Int> {
+                override fun onSuccess(result: Int?, message: String) {
+                    if (result != null) {
+                        EventBus.getDefault().post(ProblemEvent(it.voToEntity(), InspectionDetailActivity.PROBLEM_DELETE))
+                        s()
+                    }
+                }
+
+                override fun onFailure(message: String) {
+                    application.toast(message)
+                }
+            })
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
index 252856b..a089439 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
@@ -58,7 +58,10 @@
         const val PROBLEM_RECHECK = 102//闂澶嶆牳
         const val PROBLEM_CHECK = 103//闂瀹℃牳
         const val CHANGE_CHECK = 104//鏁存敼瀹℃牳
+        const val PROBLEM_DELETE = 105
     }
+
+    private var taskStatus: String = Domain.TASK_STATUS_FINISHED
 
     /**
      * 鍔犺浇瀹屾垚鐘舵�侊紝
@@ -133,9 +136,10 @@
         iv_patrol_back.setOnClickListener(this)
         ll_patrol_task_detail.visibility = View.GONE
 
+        hideMenu()
+
         viewModel.inspection.observe(this, Observer {
             it?.apply {
-                showMenu()
                 if (extension1 != null) {
                     val list = extension1.split(";").map{str ->
                         str.split(",").map {str2 ->
@@ -162,7 +166,7 @@
         viewModel.subTask.observe(this, Observer {
             it?.let {
                 updateUIBySubTask(it)
-                refreshMenuStatus(it.status)
+                taskStatus = it.status
                 onDataLoaded(1)
             }
         })
@@ -325,9 +329,8 @@
             result = result.and(it)
         }
         if (result) {
-            menuList.forEach {
-                it.setOnClickListener(this)
-            }
+            showMenu()
+            refreshMenuStatus(taskStatus)
         } else {
             toast("璇风瓑寰呮暟鎹姞杞藉畬鎴�")
         }
@@ -385,7 +388,7 @@
         val address = s.cityname + s.districtname + " " + s.location
         tv_scense_address.text = address
 
-        val contact1 = s.contacts + " " + s.contactst
+        val contact1 = s.contacts ?: "" + " " + s.contactst ?: ""
         tv_scense_contact1.text = contact1
         tv_call_contact1.setOnClickListener {
             //鎵撶數璇�
@@ -569,8 +572,10 @@
     }
 
     private fun startTracking() {
-        if (viewModel.scene.value?.typeid?.toString() != Constant.SCENE_TYPE9
-                || viewModel.subTask.value?.status != Domain.TASK_STATUS_RUNNING) return
+        if (
+//                viewModel.scene.value?.typeid?.toString() != Constant.SCENE_TYPE9 ||
+                viewModel.subTask.value?.status != Domain.TASK_STATUS_RUNNING
+        ) return
 
         //褰撶户缁墽琛屾鍦ㄨ繘琛屼腑鐨勪换鍔℃椂锛屾牴鎹槸鍚︽湁鍘嗗彶杞ㄨ抗璁板綍鏉ュ垽鏂槸鍚﹀紑鍚�
         if (viewModel.inspection.value?.extension1 != null) {
@@ -716,8 +721,9 @@
                 val intent = Intent(this, MenuProblemListActivity::class.java).apply {
                     putExtra("subTask", viewModel.subTask.value)
                     putExtra("inspection", viewModel.inspection.value)
-                    putExtra("scenseLat", viewModel.scene.value?.latitude)
-                    putExtra("scenseLng", viewModel.scene.value?.longitude)
+                    putExtra("scene", viewModel.scene.value)
+                    putExtra("lat", viewModel.scene.value?.latitude)
+                    putExtra("lng", viewModel.scene.value?.longitude)
                 }
                 startActivity(intent)
             }
@@ -726,8 +732,8 @@
                 val intent = Intent(this, MenuChangeActivity::class.java).apply {
                     putExtra("subTask", viewModel.subTask.value)
                     putExtra("inspection", viewModel.inspection.value)
-                    putExtra("scenseLat", viewModel.scene.value?.latitude)
-                    putExtra("scenseLng", viewModel.scene.value?.longitude)
+                    putExtra("lat", viewModel.scene.value?.latitude)
+                    putExtra("lng", viewModel.scene.value?.longitude)
                 }
                 startActivity(intent)
             }
@@ -835,7 +841,7 @@
                 }
                 startActivity(intent)
             }
-            //闂瀹℃牳
+            //鏁存敼瀹℃牳
             R.id.ln_patrol_change_check -> {
                 val intent = Intent(this, MenuChangeCheckActivity::class.java).apply {
                     putExtra("subTask", viewModel.subTask.value)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt
index 5375367..0cfc11d 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt
@@ -46,7 +46,7 @@
 
     @Subscribe(threadMode = ThreadMode.BACKGROUND)
     fun onUpdateChange(problemEvent: ProblemEvent) {
-        if (problemEvent.type == InspectionFragment.PROBLEM_CHANGE) {
+        if (problemEvent.type == InspectionDetailActivity.PROBLEM_CHANGE) {
             inspection?.apply {
                 changednum = changednum?.plus(1) ?: 1
 
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
index d1fbf75..147f1b7 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
@@ -27,12 +27,11 @@
 import java.io.IOException
 import java.util.*
 
-class MenuEvidenceActivity : BaseTakePicActivity() {
+open class MenuEvidenceActivity : BaseTakePicActivity() {
 
     override fun getLayoutId(): Int = R.layout.dialog_take_evidence
 
-    override fun getImageViews(): MutableList<ImageView>
-            = mutableListOf(iv_take_evidence_add_photo1, iv_take_evidence_add_photo2, iv_take_evidence_add_photo3)
+    override fun getImageViews(): MutableList<ImageView> = mutableListOf(iv_take_evidence_add_photo1, iv_take_evidence_add_photo2, iv_take_evidence_add_photo3)
 
     override val picDeletable: Boolean = true
 
@@ -44,6 +43,7 @@
     var lat = 0.0
     var lng = 0.0
 
+    protected var submitTime = 0L//鎻愪氦鏃堕棿锛岄槻姝㈣繛缁彁浜わ紝澶氭璁板綍
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -53,46 +53,25 @@
 
         viewModel = ViewModelProviders.of(this).get(MenuEvidenceViewModel::class.java)
 
+        getExtra()
+        initUI()
+        initObserver()
+
+        viewModel.getLocationList()
+        subTask?.let { t ->
+            scene?.let { s ->
+                viewModel.getProblemType(t.typeno, t.citycode, t.districtcode, s.typeid)
+            }
+        }
+
+    }
+
+    open fun getExtra() {
         subTask = intent.getSerializableExtra("subTask") as Subtask?
         inspection = intent.getSerializableExtra("inspection") as Inspection?
         scene = intent.getSerializableExtra("scene") as Scense?
         lat = intent.getDoubleExtra("lat", 0.0)
         lng = intent.getDoubleExtra("lng", 0.0)
-
-
-        initUI()
-
-        viewModel.locationList.observe(this, Observer {
-            it?.let {
-                sp_take_evidence_select_location.adapter = DomainItemListAdapter(it, this)
-            }
-        })
-
-        viewModel.problemFatherType.observe(this, Observer {
-            it?.let {
-                sp_take_evidence_select_problem_type.adapter = ArrayAdapter(this, R.layout.item_spinner_drop_down, it)
-            }
-        })
-
-        viewModel.problemType.observe(this, Observer {
-            it?.let {
-                sp_take_evidence_select_problem.adapter = ProblemTypeListAdapter(it, this)
-            }
-        })
-
-        viewModel.suggestionList.observe(this, Observer {
-            it.let {
-                sp_take_evidence_select_suggestion.adapter = ArrayAdapter(this, R.layout.item_spinner_drop_down, it)
-            }
-        })
-
-        viewModel.getLocationList()
-        subTask?.let {t ->
-            scene?.let {s ->
-                viewModel.getProblemType(t.typeno, t.citycode, t.districtcode, s.typeid)
-            }
-        }
-
     }
 
     private fun initUI() {
@@ -122,8 +101,11 @@
         }
 
         fab_take_evidence_ok.setOnClickListener {
-            it.isClickable = false
-            putProblem()
+            val now = Date()
+            if (now.time - submitTime >= 1000) {
+                submitTime = now.time
+                putProblem()
+            }
         }
 
         fab_take_evidence_close.setOnClickListener {
@@ -131,7 +113,33 @@
         }
     }
 
-    private fun updateUIByProblemType(visible: Int) {
+    open fun initObserver() {
+        viewModel.locationList.observe(this, Observer {
+            it?.let {
+                sp_take_evidence_select_location.adapter = DomainItemListAdapter(it, this)
+            }
+        })
+
+        viewModel.problemFatherType.observe(this, Observer {
+            it?.let {
+                sp_take_evidence_select_problem_type.adapter = ArrayAdapter(this, R.layout.item_spinner_drop_down, it)
+            }
+        })
+
+        viewModel.problemType.observe(this, Observer {
+            it?.let {
+                sp_take_evidence_select_problem.adapter = ProblemTypeListAdapter(it, this)
+            }
+        })
+
+        viewModel.suggestionList.observe(this, Observer {
+            it.let {
+                sp_take_evidence_select_suggestion.adapter = ArrayAdapter(this, R.layout.item_spinner_drop_down, it)
+            }
+        })
+    }
+
+    protected fun updateUIByProblemType(visible: Int) {
         sp_take_evidence_select_location.visibility = visible
         et_take_evidence_location.visibility = visible
         iv_take_evidence_add_photo1.visibility = visible
@@ -141,6 +149,10 @@
     }
 
     private fun putProblem() {
+        if (inspection == null || subTask == null || scene == null) {
+            toast("褰撳墠宸℃煡鐘舵�侀敊璇紝鏃犳硶涓婁紶闂锛岃灏濊瘯閲嶆柊鍚姩")
+        }
+
         val problemType = sp_take_evidence_select_problem_type.selectedItem.toString()
 
         val pro = Problemlist().apply {
@@ -150,6 +162,7 @@
             sguid = scene?.guid
             sensename = scene?.name
             senseaddress = "${scene?.cityname ?: ""}${scene?.districtname ?: ""}${scene?.townname ?: ""}${scene?.location ?: ""}"
+
             val p = sp_take_evidence_select_problem.selectedItem
             if (p is Problemtype) {
                 ptguid = p.guid
@@ -191,7 +204,7 @@
         if (problemType != "鎬佸害" && pathTempList.isNotEmpty()) {
             viewModel.putProblem(pro)
             putMediaFile(pro)
-        }else if (problemType == "鎬佸害") {
+        } else if (problemType == "鎬佸害") {
             viewModel.putProblem(pro)
         } else {
             application.toast("鑷冲皯鎷嶄竴寮犵収鐗�")
@@ -199,7 +212,7 @@
         }
     }
 
-    private fun putMediaFile(problem: Problemlist) {
+    protected fun putMediaFile(problem: Problemlist) {
         //淇濆瓨鐓х墖鍒板搴旀枃浠跺す
         val savePathList = ArrayList<File>()
         val calendar = java.util.Calendar.getInstance()
@@ -223,7 +236,11 @@
         fileNameList.add(fileName3)
 
         for (i in pathTempList.indices) {
-            val oldFile = pathTempList[i]
+            //杩囨护涓嶉渶瑕佷笂浼犵殑鍥剧墖
+            if (!pathTempList[i].second) {
+                continue
+            }
+            val oldFile = pathTempList[i].first
             val newFile = savePathList[i]
             //淇濆瓨鍒癿ediaFile鏁版嵁搴�
             val mediaFile = Mediafile()
@@ -261,11 +278,14 @@
     }
 
     //娓呴櫎鎷嶇収鍙栬瘉鐨勭紦瀛�
-    fun clearTemp() {
+    private fun clearTemp() {
         for (i in pathTempList.indices) {
-            val file = pathTempList[i]
-            if (file.exists()) {
-                file.delete()
+            //闇�瑕佷笂浼犵殑鍥剧墖鎵嶆槸鍦ㄦ湰鍦版媿鎽勭殑锛屽甫鏈夌紦瀛�
+            if (pathTempList[i].second) {
+                val file = pathTempList[i].first
+                if (file.exists()) {
+                    file.delete()
+                }
             }
         }
     }
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt
index 9959bdd..247146e 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt
@@ -2,6 +2,7 @@
 
 import android.arch.lifecycle.MutableLiveData
 import cn.flightfeather.thirdapp.bean.*
+import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo
 import cn.flightfeather.thirdapp.common.net.ResultCallBack
 import cn.flightfeather.thirdapp.model.event.ProblemEvent
 import cn.flightfeather.thirdapp.module.base.BaseViewModel
@@ -9,6 +10,7 @@
 import okhttp3.ResponseBody
 import org.greenrobot.eventbus.EventBus
 import org.jetbrains.anko.toast
+import java.io.File
 
 /**
  * @author riku
@@ -31,6 +33,13 @@
 
     val problemMap = HashMap<String, ArrayList<Problemtype>>()
 
+    val mediaFileList = MutableLiveData<List<Mediafile>>()
+
+    //鎵�鏈夋暟鎹姞杞藉畬鎴愰�氱煡
+    val loadingOver = MutableLiveData<Boolean>()
+    //璁板綍鍚勪釜鏁版嵁鍔犺浇鏄惁瀹屾垚鐨勭姸鎬�
+    private val loadingStatus = BooleanArray(3)
+
     /**
      * 鑾峰彇鍦烘櫙闂鍙�変綅缃紙鐩墠鍙湁宸ュ湴锛屼絾鎵�鏈夊満鏅兘浣跨敤锛�
      */
@@ -39,6 +48,7 @@
             override fun onSuccess(result: ArrayList<Domainitem>?) {
                 result?.let {
                     locationList.value = it
+                    onLoaded(0)
                 }
             }
 
@@ -59,8 +69,8 @@
                     if (it.isEmpty()) {
                         it.add(Problemtype().apply {
                             guid = "0"
-                            typename = "鏃�"
-                            name = "鏃�"
+                            typename = "鍏朵粬"
+                            name = "鍏朵粬"
                         })
                     }
 
@@ -76,6 +86,8 @@
                     }
 
                     problemFatherType.value = typeList
+
+                    onLoaded(1)
                 }
             }
 
@@ -98,6 +110,8 @@
                     }
                     advices.add("鏆傛棤寤鸿")
                     suggestionList.value = advices
+
+                    onLoaded(2)
                 }
             }
 
@@ -105,6 +119,57 @@
             }
 
         })
+    }
+
+    /**
+     * 鏍规嵁闂鎵惧埌鏈嶅姟鍣ㄥ拰鏈湴鐨勬墍鏈夊浘鐗�
+     */
+    fun getMediaFileList(p: ProblemlistVo) {
+        problemRepository.getMediaFileLocal(p.guid, object : ResultCallBack<List<Mediafile>> {
+            override fun onSuccess(result: List<Mediafile>?) {
+                result?.let {
+                    p.mediafileList.addAll(it)
+                    mediaFileList.value = p.mediafileList
+                }
+            }
+
+            override fun onFailure() {
+            }
+        })
+    }
+
+    /**
+     * 涓嬭浇闂鍥剧墖
+     *  fixme: 2020/8/6 鐩墠鐢变簬鍘熺▼搴忚缃浘鐗囩殑鏂瑰紡涓烘墜鍔ㄤ笅杞藉浘鐗囷紝鍥犳娌跨敤锛屼箣鍚庣粺涓�鐢℅lide绛夌涓夋柟搴撲唬鏇�
+     */
+    fun downLoadMediaFile(mediaFile: Mediafile, s: (file: File) -> Unit) {
+        problemRepository.downloadMediaFile(mediaFile, object : ResultCallBack<File> {
+            override fun onSuccess(result: File?) {
+                result?.let {
+                    s(it)
+                }
+            }
+
+            override fun onFailure() {
+
+            }
+        })
+    }
+
+    /**
+     * 鍒犻櫎闂鍥剧墖
+     */
+    fun deleteMediaFile(mediaFile: List<Mediafile>) {
+        mediaFile.forEach {
+            problemRepository.deleteMediaFile(it, object : ResultCallBack<Boolean> {
+                override fun onSuccess(result: Boolean?) {
+
+                }
+
+                override fun onFailure() {
+                }
+            })
+        }
     }
 
     /**
@@ -124,6 +189,24 @@
                 application.toast("鎻愪氦澶辫触")
             }
 
+        })
+    }
+
+    /**
+     * 鏇存柊涓�涓棶棰�
+     */
+    fun updateProblem(problem: ProblemlistVo) {
+        problemRepository.updateProblem(problem, object : ResultCallBack<ResponseBody> {
+            override fun onSuccess(result: ResponseBody?) {
+                result?.let {
+                    application.toast("淇敼鎴愬姛")
+                    EventBus.getDefault().post(ProblemEvent(problem.voToEntity()))
+                }
+            }
+
+            override fun onFailure() {
+                application.toast("淇敼澶辫触锛岃妫�鏌ョ綉缁�")
+            }
         })
     }
 
@@ -151,4 +234,23 @@
             problemType.value = it
         }
     }
+
+    /**
+     * 鍒ゆ柇鏄惁鎵�鏈夌殑鏁版嵁閮藉姞杞藉畬鎴�
+     */
+    fun onLoaded(i: Int) {
+        if (i < loadingStatus.size) {
+            loadingStatus[i] = true
+        }
+        var isLoadOver = true
+        loadingStatus.forEach {
+            isLoadOver = isLoadOver.and(it)
+        }
+        if (isLoadOver) {
+            loadingOver.value = isLoadOver
+            for (y in loadingStatus.indices) {
+                loadingStatus[y] = false
+            }
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt
index 09b094f..882a34c 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt
@@ -227,7 +227,8 @@
                     override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
                         if (response.body() != null) {
                             Toast.makeText(application, "鎻愪氦鎴愬姛", Toast.LENGTH_SHORT).show()
-                            for (oldfile in pathTempList) {
+                            for (l in pathTempList) {
+                                val oldfile = l.first
                                 val fileName = gitSelected.name + " " + UUIDGenerator.generateUUID(4) + ".jpg"
                                 val mediafile = Mediafile()
                                 mediafile.guid = UUIDGenerator.generate16ShortUUID()
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemListActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemListActivity.kt
index 61d83ee..66decbc 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemListActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemListActivity.kt
@@ -1,8 +1,12 @@
 package cn.flightfeather.thirdapp.module.inspection
 
+import android.app.Dialog
 import android.arch.lifecycle.Observer
+import android.content.Intent
 import android.os.Bundle
+import android.view.View
 import cn.flightfeather.thirdapp.adapter.ProblemListAdapter
+import cn.flightfeather.thirdapp.util.DialogUtil2
 import kotlinx.android.synthetic.main.dialog_problem_list.*
 
 class MenuProblemListActivity : BaseProblemListActivity() {
@@ -31,4 +35,30 @@
 
         viewModel.getProblems(inspection?.guid)
     }
+
+    override fun onItemViewLongClick(view: View?, position: Int) {
+        super.onItemViewLongClick(view, position)
+        DialogUtil2.showBottomDialog(this, rootView, listOf("淇敼", "鍒犻櫎"), listOf ({ p->
+            val intent = Intent(this, MenuProblemUpdateActivity::class.java).apply {
+                putExtra("problemlistVo", viewModel.problemList.value?.get(position))
+                putExtra("subTask", subTaskSelected)
+                putExtra("inspection", inspection)
+                putExtra("scene", scene)
+                putExtra("lat", lat)
+                putExtra("lng", lng)
+            }
+            startActivity(intent)
+            p.dismiss()
+        }, {p->
+            p.dismiss()
+            DialogUtil2.showAlertDialog(this, "纭鏄惁鍒犻櫎闂?", { dialog: Dialog ->
+                viewModel.deleteProblem(position) {
+                    viewModel.getProblems(inspection?.guid)
+                }
+                dialog.dismiss()
+            }) { dialog: Dialog ->
+                dialog.dismiss()
+            }
+        }))
+    }
 }
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt
new file mode 100644
index 0000000..b8e0011
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt
@@ -0,0 +1,254 @@
+package cn.flightfeather.thirdapp.module.inspection
+
+import android.arch.lifecycle.Observer
+import android.content.Intent
+import android.os.Bundle
+import android.os.Environment
+import android.view.View
+import android.widget.AdapterView
+import cn.flightfeather.thirdapp.bean.Domainitem
+import cn.flightfeather.thirdapp.bean.Mediafile
+import cn.flightfeather.thirdapp.bean.Problemtype
+import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo
+import cn.flightfeather.thirdapp.module.base.VIEW_PHOTO
+import kotlinx.android.synthetic.main.dialog_take_evidence.*
+import org.jetbrains.anko.toast
+import java.io.File
+import java.util.*
+
+/**
+ * @author riku
+ * Date: 2020/8/6
+ * 闂鍐呭淇敼
+ */
+class MenuProblemUpdateActivity : MenuEvidenceActivity() {
+
+    private var problemVo: ProblemlistVo? = null
+
+    private val deleteMediaFileList = mutableListOf<Mediafile>()
+
+    //淇敼鍓嶇殑闂鍚嶇О
+    private var originProblemName = ""
+
+    private var firstLoad = true
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+
+        tv_dialog_take_evidence_title.text = "闂淇敼"
+
+        fab_take_evidence_ok.setOnClickListener {
+            val now = Date()
+            if (now.time - submitTime >= 1000) {
+                submitTime = now.time
+                updateProblem()
+            }
+        }
+
+        problemVo?.let {
+            viewModel.getMediaFileList(it)
+        }
+    }
+
+    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+        super.onActivityResult(requestCode, resultCode, data)
+        when (requestCode) {
+            VIEW_PHOTO -> {
+                //鏌ョ湅涓存椂鎷嶆憚鍥剧墖鍙互鍒犻櫎
+                data?.getIntExtra("position", -1)?.let {
+                    if (it > -1) {
+                        viewModel.mediaFileList.value?.get(it)?.let {m ->
+                            deleteMediaFileList.add(m)
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    override fun getExtra() {
+        super.getExtra()
+        problemVo = intent.getSerializableExtra("problemlistVo") as ProblemlistVo
+    }
+
+    override fun initObserver() {
+        super.initObserver()
+        viewModel.loadingOver.observe(this, Observer {
+            if (it == true && problemVo != null) {
+                //闂绫诲瀷 鍜� 闂璇︽儏
+                var problemType = ""
+                val problemTypeId = problemVo!!.ptguid
+                with(viewModel.problemMap) breaking@{
+                    forEach { entry ->
+                        entry.value.forEach { pt ->
+                            if (pt.guid == problemTypeId) {
+                                problemType = entry.key
+                                originProblemName = pt.name
+                                setSelectListener()
+                                return@breaking
+                            }
+                        }
+                    }
+                }
+                for (i in viewModel.problemFatherType.value?.indices ?: 0..0) {
+                    if (viewModel.problemFatherType.value?.get(i) == problemType) {
+                        sp_take_evidence_select_problem_type.setSelection(i)
+                        break
+                    }
+                }
+                //闂鎻忚堪
+                var problemRemark = problemVo!!.problemname.replace(originProblemName, "")//鍒犻櫎鎻忚堪涓殑闂绫诲瀷
+                if (problemRemark.isNotBlank()) {
+                    problemRemark = problemRemark.removeRange(0, 1)//鍒犻櫎绗竴涓瓧绗︼紝鎷彿鈥滐紙鈥�
+                    problemRemark = problemRemark.dropLast(1)//鍒犻櫎鏈�鍚庝竴涓瓧绗︼紝鎷彿鈥滐級鈥�
+                }
+
+
+                et_take_evidence_problem_des.setText(problemRemark)
+
+                //浣嶇疆
+                var location = problemVo!!.location
+                for (i in viewModel.locationList.value?.indices ?: 0..0) {
+                    val d = viewModel.locationList.value?.get(i)?.text
+                    if (d != null && location.contains(d)) {
+                        location = location.replace(d, "")
+                        sp_take_evidence_select_location.setSelection(i)
+                        break
+                    }
+                }
+
+                //浣嶇疆澶囨敞
+                var locationRemark = location
+                if (locationRemark.isNotBlank()) {
+                    locationRemark = location.removeRange(0, 1)//鍒犻櫎绗竴涓瓧绗︼紝鎷彿鈥滐紙鈥�
+                    locationRemark = locationRemark.dropLast(1)//鍒犻櫎鏈�鍚庝竴涓瓧绗︼紝鎷彿鈥滐級鈥�
+                }
+                et_take_evidence_location.setText(locationRemark)
+
+                //鏁存敼寤鸿
+                var advice = problemVo!!.advise
+                var suggestion = ""
+                for (i in viewModel.suggestionList.value?.indices ?: 0..0) {
+                    val s = viewModel.suggestionList.value?.get(i)
+                    if (s != null && advice.contains(s)) {
+                        advice = advice.replace(s, "")
+                        sp_take_evidence_select_suggestion.setSelection(i)
+                        break
+                    }
+                }
+                //鏁存敼寤鸿澶囨敞
+                var suggestionRemark = advice.removeRange(0, 1)//鍒犻櫎绗竴涓瓧绗︼紝鎷彿鈥滐紙鈥�
+                suggestionRemark = suggestionRemark.dropLast(1)//鍒犻櫎鏈�鍚庝竴涓瓧绗︼紝鎷彿鈥滐級鈥�
+                et_take_evidence_suggestion.setText(suggestionRemark)
+            }
+        })
+
+        viewModel.mediaFileList.observe(this, Observer {
+            it?.let { loadImage(it) }
+        })
+    }
+
+    private fun loadImage(mediaFileList: List<Mediafile>) {
+        mediaFileList.forEach {
+            if (!it.ischanged) {
+                val file = getFileFromMediaFile(it)
+                if (file?.exists() == true) {
+                    pathTempList.add(Pair(file, false))
+                } else {
+                    viewModel.downLoadMediaFile(it) {f ->
+                        pathTempList.add(Pair(f, false))
+                        refreshImageView()
+                    }
+                }
+            }
+        }
+        refreshImageView()
+    }
+
+    private fun getFileFromMediaFile(mediafile: Mediafile): File? {
+        return File(Environment.getExternalStorageDirectory(), mediafile.path + mediafile.description)
+    }
+
+    private fun updateProblem() {
+        val problemType = sp_take_evidence_select_problem_type.selectedItem.toString()
+
+        problemVo?.apply {
+            val p = sp_take_evidence_select_problem.selectedItem
+            if (p is Problemtype) {
+                ptguid = p.guid
+                var problemDes = et_take_evidence_problem_des.text.toString()
+                if (problemDes.isNotEmpty()) {
+                    problemDes = "($problemDes)"
+                }
+                problemname = p.name + problemDes
+            }
+
+            var adviceDes = et_take_evidence_suggestion.text.toString()
+            if (adviceDes.isNotEmpty()) {
+                adviceDes = "($adviceDes)"
+            }
+            advise = sp_take_evidence_select_suggestion.selectedItem.toString() + adviceDes
+            latitude = lat
+            longitude = lng
+
+            val d = sp_take_evidence_select_location.selectedItem
+            if (d is Domainitem) {
+                var locationRemark = et_take_evidence_location.text.toString()
+                if (locationRemark.isNotEmpty()) {
+                    locationRemark = "($locationRemark)"
+                }
+                // fixme: 2020/6/9 姝ょ増鏈皢闂浣嶇疆淇敼涓鸿閬撲俊鎭紝鏆傛椂鍘婚櫎浣嶇疆id
+                locationid = d.index.toByte()
+                location = d.text + locationRemark
+            }
+
+            time = Date()
+
+
+
+            if (problemType != "鎬佸害" && pathTempList.isNotEmpty()) {
+                viewModel.updateProblem(this)
+                putMediaFile(this.voToEntity())
+                deleteMediaFile()
+            }else if (problemType == "鎬佸害") {
+                viewModel.updateProblem(this)
+                deleteMediaFile()
+            } else {
+                application.toast("鑷冲皯鎷嶄竴寮犵収鐗�")
+                fab_take_evidence_ok.isClickable = true
+            }
+        }
+    }
+
+    private fun deleteMediaFile() {
+        viewModel.deleteMediaFile(deleteMediaFileList)
+    }
+
+    private fun setSelectListener() {
+        sp_take_evidence_select_problem_type.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+            override fun onNothingSelected(parent: AdapterView<*>?) = Unit
+            override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+                val problemType = viewModel.problemFatherType.value?.get(position)
+                viewModel.refreshProblems(problemType)
+
+                viewModel.problemFatherType.value?.let {
+                    if (it[position] == "鎬佸害") {
+                        updateUIByProblemType(View.GONE)
+                    } else {
+                        updateUIByProblemType(View.VISIBLE)
+                    }
+                }
+
+                val problemNameList = viewModel.problemMap[problemType] ?: arrayListOf()
+                for (i in problemNameList.indices) {
+                    if (problemNameList[i].name == originProblemName) {
+                        sp_take_evidence_select_problem.setSelection(i)
+                        break
+                    }
+                }
+
+                viewModel.problemType.value?.get(0)?.guid?.let { viewModel.getSuggestionList(it) }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuRecheckActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuRecheckActivity.kt
index a3bac18..61c9f9a 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuRecheckActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuRecheckActivity.kt
@@ -28,8 +28,6 @@
     var totalProblemCount = 0
 
     override fun onCreate(savedInstanceState: Bundle?) {
-        EventBus.getDefault().register(this)
-
         super.onCreate(savedInstanceState)
 
         viewModel.subTaskPack.observe(this, Observer {
@@ -71,7 +69,7 @@
 
     @Subscribe(threadMode = ThreadMode.BACKGROUND)
     fun onUpdateRecheck(problemEvent: ProblemEvent) {
-        if (problemEvent.type == InspectionFragment.PROBLEM_RECHECK) {
+        if (problemEvent.type == InspectionDetailActivity.PROBLEM_RECHECK) {
             inspection?.apply {
                 recheckcount = recheckcount?.plus(1) ?: 1
 
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt b/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt
index b3d7970..86e494b 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt
@@ -28,6 +28,10 @@
             .upLoadCrashInfo(accountName, partList)
             .subscribeOn(Schedulers.io())
             .observeOn(Schedulers.trampoline())
-            .subscribe()
+            .subscribe({
+                resultCallBack.onSuccess(it.body())
+            }, {
+                resultCallBack.onFailure()
+            })
     }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/repository/ProblemRepository.kt b/app/src/main/java/cn/flightfeather/thirdapp/repository/ProblemRepository.kt
index 107a22c..6663754 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/repository/ProblemRepository.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/repository/ProblemRepository.kt
@@ -1,16 +1,26 @@
 package cn.flightfeather.thirdapp.repository
 
+import android.annotation.SuppressLint
+import android.os.Environment
 import cn.flightfeather.thirdapp.bean.*
-import cn.flightfeather.thirdapp.common.net.ResponseBodyCallBack
-import cn.flightfeather.thirdapp.common.net.ResultCallBack
-import cn.flightfeather.thirdapp.common.net.ResultObserver
-import cn.flightfeather.thirdapp.common.net.RetrofitFactory
+import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo
+import cn.flightfeather.thirdapp.common.net.*
 import cn.flightfeather.thirdapp.httpservice.InspectionService
+import cn.flightfeather.thirdapp.httpservice.MediaFileService
+import cn.flightfeather.thirdapp.httpservice.ProblemListService
 import cn.flightfeather.thirdapp.repository.dao.DomainDao
 import cn.flightfeather.thirdapp.repository.dao.MediaFileDao
 import cn.flightfeather.thirdapp.repository.dao.ProblemTypeDao
+import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.schedulers.Schedulers
 import okhttp3.ResponseBody
+import retrofit2.Call
+import retrofit2.Callback
 import retrofit2.Response
+import java.io.BufferedInputStream
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
 
 /**
  * @author riku
@@ -20,6 +30,7 @@
 class ProblemRepository {
 
     val retrofit = RetrofitFactory.instance.retrofit
+    val retrofitImage = RetrofitFactory.instance.retrofitImage
     private val domainDao = DomainDao()
     private val problemTypeDao = ProblemTypeDao()
     private val mediaFileDao = MediaFileDao()
@@ -93,6 +104,14 @@
     }
 
     /**
+     * 鏇存柊闂
+     */
+    fun updateProblem(problem: ProblemlistVo, resultCallBack: ResultCallBack<ResponseBody>) {
+        retrofit.create(ProblemListService::class.java).updateProblemList(problem)
+                .enqueue(ResponseBodyCallBack(resultCallBack))
+    }
+
+    /**
      * 鍥剧墖鏈湴缂撳瓨
      */
     fun putMediaFileLocal(mediaFile: Mediafile, resultCallBack: ResultCallBack<Int>) {
@@ -111,4 +130,128 @@
 
         })
     }
+
+    /**
+     * 鑾峰彇鏈湴缂撳瓨鐨勫浘鐗�
+     */
+    fun getMediaFileLocal(problemGuid: String, resultCallBack: ResultCallBack<List<Mediafile>>) {
+        val dbService = mediaFileDao.getMediaFileByProblemId(problemGuid).map {
+            Response.success(it)
+        }
+
+        RetrofitFactory.executeResult(dbService, object : ResultObserver<List<Mediafile>>() {
+            override fun onSuccess(result: List<Mediafile>?) {
+                resultCallBack.onSuccess(result)
+            }
+
+            override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
+                resultCallBack.onFailure()
+            }
+        })
+    }
+
+    /**
+     * 涓嬭浇闂鍥剧墖
+     */
+    fun downloadMediaFile(mediaFile:Mediafile, resultCallBack: ResultCallBack<File>) {
+        val url: String = mediaFile.extension1 + mediaFile.guid + ".jpg"
+        retrofitImage.create(MediaFileService::class.java).downloadImage(url)
+                .enqueue(object : Callback<ResponseBody> {
+                    override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
+                        resultCallBack.onFailure()
+                    }
+
+                    override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
+                        if (response.body() != null) {
+                            val file = writeResponseBodyToDisk(mediaFile, response.body())
+                            if (file?.exists() == true) {
+                                resultCallBack.onSuccess(file)
+                            } else {
+                                resultCallBack.onFailure()
+                            }
+                        } else {
+                            resultCallBack.onFailure()
+                        }
+                    }
+                })
+
+    }
+
+    /**
+     * 鍒犻櫎闂鍥剧墖
+     */
+    @SuppressLint("CheckResult")
+    fun deleteMediaFile(mediaFile: Mediafile, resultCallBack: ResultCallBack<Boolean>) {
+        if (mediaFile.remark == "鏈笂浼�") {
+            mediaFileDao.deleteMediaFile(mediaFile.guid)
+                    .subscribeOn(Schedulers.io())
+                    .observeOn(AndroidSchedulers.mainThread())
+                    .subscribe{
+                        if (it) {
+                            resultCallBack.onSuccess(it)
+                        }
+                    }
+        } else if (mediaFile.remark == "宸蹭笂浼�") {
+            retrofit.create(MediaFileService::class.java).deleteMediaFile(mediaFile.guid)
+                    .enqueue(object : Callback<ResponseBody?> {
+                        override fun onResponse(call: Call<ResponseBody?>, response: Response<ResponseBody?>) {
+                            if (response.body() != null) {
+                                mediaFileDao.deleteMediaFile(mediaFile.guid)
+                                        .subscribeOn(Schedulers.io())
+                                        .observeOn(AndroidSchedulers.mainThread())
+                                        .subscribe{
+                                            if (it) {
+                                                resultCallBack.onSuccess(it)
+                                            }
+                                        }
+                            } else if (response.errorBody() != null) {
+                                resultCallBack.onFailure()
+                            }
+                        }
+
+                        override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
+                            resultCallBack.onFailure()
+                        }
+                    })
+        }
+    }
+
+    /**
+     * 鍒犻櫎闂
+     */
+    fun deleteProblem(problemId: String, resultCallBack: ResultCallBack2<Int>) {
+        retrofit.create(ProblemListService::class.java).deleteProblem(problemId)
+                .enqueue(ResponseBodyCallBack2(resultCallBack))
+    }
+
+    //灏嗕笅杞界殑鍥剧墖鍐欏叆纾佺洏
+    private fun writeResponseBodyToDisk(mediafile: Mediafile, body: ResponseBody?): File? {
+        if (body == null) {
+            return null
+        }
+        return try {
+            val `is` = body.byteStream()
+            var file = File(Environment.getExternalStorageDirectory(), mediafile.path + mediafile.description)
+            if (file.exists()) {
+                file.delete()
+                file = File(Environment.getExternalStorageDirectory(), mediafile.path + mediafile.description)
+            }
+            file.parentFile.mkdirs()
+            val fos = FileOutputStream(file)
+            val bis = BufferedInputStream(`is`)
+            val buffer = ByteArray(1024)
+            var len: Int
+            while (bis.read(buffer).also { len = it } != -1) {
+                fos.write(buffer, 0, len)
+            }
+            fos.flush()
+            fos.close()
+            bis.close()
+            `is`.close()
+            file
+        } catch (e: IOException) {
+            e.printStackTrace()
+            null
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/repository/dao/MediaFileDao.kt b/app/src/main/java/cn/flightfeather/thirdapp/repository/dao/MediaFileDao.kt
index 28b39d8..ed00c3e 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/repository/dao/MediaFileDao.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/repository/dao/MediaFileDao.kt
@@ -48,4 +48,26 @@
                     ).list()
         }
     }
+
+    /**
+     * 鏍规嵁闂id鑾峰彇瀵瑰簲鐨勭浉鍏冲浘鐗�
+     */
+    fun getMediaFileByProblemId(problemId: String): Observable<List<Mediafile>> {
+        return DbFactory.getGreenDaoObservable().map {
+            it.mediafileDao.queryBuilder().where(
+                    MediafileDao.Properties.Businessguid.eq(problemId),
+                    MediafileDao.Properties.Remark.eq("鏈笂浼�")
+            ).list()
+        }
+    }
+
+    /**
+     * 鍒犻櫎鍥剧墖
+     */
+    fun deleteMediaFile(id: String): Observable<Boolean> {
+        return DbFactory.getGreenDaoObservable().map {
+            it.mediafileDao.deleteByKey(id)
+            true
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt b/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt
index fb3bc41..a866f6c 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/util/DialogUtil2.kt
@@ -13,6 +13,7 @@
 import android.widget.TextView
 import cn.flightfeather.thirdapp.R
 import cn.flightfeather.thirdapp.module.base.BaseActivity
+import cn.flightfeather.thirdapp.view.PopupWindowWithMask
 
 /**
  * @author riku
@@ -56,7 +57,7 @@
     ) {
         val view = LayoutInflater.from(activity).inflate(R.layout.dialog_bottom_sheet, null)
         activity?.let {
-            PopupWindow(it).apply popupWindow@{
+            PopupWindowWithMask(it).apply popupWindow@{
                 isFocusable = true
                 isOutsideTouchable = true
                 contentView = view
@@ -80,17 +81,8 @@
                 width = ViewGroup.LayoutParams.MATCH_PARENT
                 animationStyle = R.style.PopWin_bottom_anim_style
                 background.alpha = 0
-                setOnDismissListener {
-                    val wl = activity.window.attributes
-                    wl.alpha = 1f
-                    activity.window.attributes = wl
-                }
             }.run {
-                val wl = activity.window.attributes
-                wl.alpha = 0.9f
-                activity.window.attributes = wl
                 showAtLocation(anchorView, Gravity.BOTTOM, 0, 0)
-
             }
         }
     }
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/util/updateApp/UpdateAppUtil.java b/app/src/main/java/cn/flightfeather/thirdapp/util/updateApp/UpdateAppUtil.java
index ffa45ee..34ba6b6 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/util/updateApp/UpdateAppUtil.java
+++ b/app/src/main/java/cn/flightfeather/thirdapp/util/updateApp/UpdateAppUtil.java
@@ -97,7 +97,7 @@
     public void downLoadApk() {
         try {
             DownloadManager.Request request = new DownloadManager.Request(Uri.parse(versionVo.getDownloadUrl()));
-            request.setTitle("绗笁鏂圭洃绠�");
+            request.setTitle(application.getString(R.string.app_name));
             request.setDescription("姝e湪涓嬭浇...");
             request.setDestinationInExternalFilesDir(application, Environment.DIRECTORY_DOWNLOADS, "supervision.apk");
             downloadManager = (DownloadManager) application.getSystemService(Context.DOWNLOAD_SERVICE);
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/view/PopupWindowWithMask.kt b/app/src/main/java/cn/flightfeather/thirdapp/view/PopupWindowWithMask.kt
new file mode 100644
index 0000000..ba30640
--- /dev/null
+++ b/app/src/main/java/cn/flightfeather/thirdapp/view/PopupWindowWithMask.kt
@@ -0,0 +1,65 @@
+package cn.flightfeather.thirdapp.view
+
+import android.content.Context
+import android.graphics.PixelFormat
+import android.os.IBinder
+import android.view.KeyEvent
+import android.view.View
+import android.view.WindowManager
+import android.widget.PopupWindow
+import org.jetbrains.anko.windowManager
+
+/**
+ * @author riku
+ * Date: 2020/8/28
+ */
+class PopupWindowWithMask(private val context: Context) : PopupWindow(context) {
+
+    private var windowManager: WindowManager? = null
+    private var maskView: View? = null
+
+    init {
+        windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
+    }
+
+    override fun showAtLocation(parent: View?, gravity: Int, x: Int, y: Int) {
+        addMask(parent?.windowToken)
+        super.showAtLocation(parent, gravity, x, y)
+    }
+
+    override fun dismiss() {
+        removeMask()
+        super.dismiss()
+    }
+
+    private fun addMask(token: IBinder?) {
+        val wl: WindowManager.LayoutParams = WindowManager.LayoutParams()
+        wl.width = WindowManager.LayoutParams.MATCH_PARENT
+        wl.height = WindowManager.LayoutParams.MATCH_PARENT
+        wl.format = PixelFormat.TRANSLUCENT //涓嶈缃繖涓脊鍑烘鐨勯�忔槑閬僵鏄剧ず涓洪粦鑹�
+        wl.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL //璇ype鎻忚堪鐨勬槸褰㈡垚鐨勭獥鍙g殑灞傜骇鍏崇郴
+        wl.token = token //鑾峰彇褰撳墠Activity涓殑View涓殑token,鏉ヤ緷闄凙ctivity
+        maskView = View(context)
+        maskView?.setBackgroundColor(0x7f000000)
+        maskView?.fitsSystemWindows = false
+        maskView?.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
+            if (keyCode == KeyEvent.KEYCODE_BACK) {
+                removeMask()
+                return@OnKeyListener true
+            }
+            false
+        })
+        /**
+         * 閫氳繃WindowManager鐨刟ddView鏂规硶鍒涘缓View锛屼骇鐢熷嚭鏉ョ殑View鏍规嵁WindowManager.LayoutParams灞炴�т笉鍚岋紝鏁堟灉涔熷氨涓嶅悓浜嗐��
+         * 姣斿鍒涘缓绯荤粺椤剁骇绐楀彛锛屽疄鐜版偓娴獥鍙f晥鏋滐紒
+         */
+        windowManager?.addView(maskView, wl)
+    }
+
+    private fun removeMask() {
+        if (null != maskView) {
+            windowManager?.removeViewImmediate(maskView)
+            maskView = null
+        }
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-xxhdpi/shape_black_spinner.xml b/app/src/main/res/drawable-xxhdpi/shape_black_spinner.xml
new file mode 100644
index 0000000..491bf69
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/shape_black_spinner.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape
+            android:shape="rectangle">
+            <!-- 濉厖鐨勯鑹� -->
+            <solid android:color="@color/white"/>
+            <!-- 璁剧疆鎸夐挳鐨勫洓涓涓哄姬褰� -->
+            <!-- android:radius 寮у舰鐨勫崐寰� -->
+            <corners android:radius="2dp" />
+            <!--鎻忚竟-->
+            <stroke
+                android:width="1dp"
+                android:color="@color/black" />
+            <!-- padding锛欱utton閲岄潰鐨勬枃瀛椾笌Button杈圭晫鐨勯棿闅� -->
+        </shape>
+    </item>
+    <item android:drawable="@drawable/ic_unfold_more_black_20dp"
+        android:gravity="end|center"/>
+</layer-list>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_unfold_more_black_20dp.xml b/app/src/main/res/drawable/ic_unfold_more_black_20dp.xml
new file mode 100644
index 0000000..2cd89b6
--- /dev/null
+++ b/app/src/main/res/drawable/ic_unfold_more_black_20dp.xml
@@ -0,0 +1,4 @@
+<vector android:height="20dp" android:viewportHeight="24.0"
+    android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="#FF000000" android:pathData="M12,5.83L15.17,9l1.41,-1.41L12,3 7.41,7.59 8.83,9 12,5.83zM12,18.17L8.83,15l-1.41,1.41L12,21l4.59,-4.59L15.17,15 12,18.17z"/>
+</vector>
diff --git a/app/src/main/res/layout/dialog_take_evidence.xml b/app/src/main/res/layout/dialog_take_evidence.xml
index 94a7037..b98715b 100644
--- a/app/src/main/res/layout/dialog_take_evidence.xml
+++ b/app/src/main/res/layout/dialog_take_evidence.xml
@@ -2,7 +2,8 @@
 <android.support.design.widget.CoordinatorLayout 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="match_parent">
+    android:layout_height="match_parent"
+    xmlns:tools="http://schemas.android.com/tools">
 
     <android.support.design.widget.FloatingActionButton
         android:src="@drawable/icon_close_white"
@@ -64,9 +65,9 @@
                     android:id="@+id/tv_dialog_take_evidence_title"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="鏂板闂"
+                    android:text="闂鍙栬瘉"
                     android:textColor="@color/primary_text"
-                    android:textSize="18dp" />
+                    android:textSize="18sp" />
             </LinearLayout>
 
             <TextView
@@ -80,8 +81,9 @@
                 android:id="@+id/sp_take_evidence_select_problem_type"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="-7dp"
-                android:layout_marginRight="-7dp"></Spinner>
+                android:layout_marginTop="@dimen/dimen4"
+                style="@style/SpinnerStyle.Black"
+                tools:listitem="@layout/item_spinner_drop_down" />
 
             <TextView
                 android:id="@+id/tv_chose"
@@ -94,15 +96,16 @@
                 android:id="@+id/sp_take_evidence_select_problem"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="-7dp"
-                android:layout_marginRight="-7dp"></Spinner>
+                android:layout_marginTop="@dimen/dimen4"
+                style="@style/SpinnerStyle.Black"
+                tools:listitem="@layout/item_spinner_drop_down"/>
 
             <EditText
                 android:id="@+id/et_take_evidence_problem_des"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="8dp"
                 android:hint="闂鎻忚堪(鍙��)"
+                android:textSize="@dimen/textSize_14"
                 android:visibility="visible" />
 
             <TextView
@@ -116,14 +119,16 @@
                 android:id="@+id/sp_take_evidence_select_location"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="-7dp"
-                android:layout_marginRight="-7dp"></Spinner>
+                android:layout_marginTop="@dimen/dimen4"
+                style="@style/SpinnerStyle.Black"
+                tools:listitem="@layout/item_spinner_drop_down"/>
 
             <EditText
                 android:id="@+id/et_take_evidence_location"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:hint="浣嶇疆澶囨敞(鍙��)" />
+                android:hint="浣嶇疆澶囨敞(鍙��)"
+                android:textSize="@dimen/textSize_14"/>
 
             <LinearLayout
                 android:id="@+id/ll_change_suggestion"
@@ -142,50 +147,63 @@
                     android:id="@+id/sp_take_evidence_select_suggestion"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginLeft="-7dp"
-                    android:layout_marginRight="-7dp">
-                </Spinner>
+                    android:layout_marginTop="@dimen/dimen4"
+                    style="@style/SpinnerStyle.Black"
+                    tools:listitem="@layout/item_spinner_drop_down"/>
 
                 <EditText
                     android:id="@+id/et_take_evidence_suggestion"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:hint="鏁存敼寤鸿(鍙��)" />
+                    android:hint="鏁存敼寤鸿(鍙��)"
+                    android:textSize="@dimen/textSize_14"/>
             </LinearLayout>
 
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="10dp"
-                android:layout_marginTop="10dp"
-                android:orientation="horizontal">
+                <android.support.constraint.ConstraintLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="10dp"
+                    android:layout_marginTop="10dp"
+                    android:orientation="horizontal">
 
-                <ImageView
-                    android:id="@+id/iv_take_evidence_add_photo1"
-                    android:layout_width="60dp"
-                    android:layout_height="60dp"
-                    android:layout_marginTop="6dp"
-                    android:scaleType="centerCrop"
-                    android:src="@drawable/icon_add_photo" />
+                    <ImageView
+                        android:id="@+id/iv_take_evidence_add_photo1"
+                        android:layout_width="0dp"
+                        android:layout_height="0dp"
+                        android:scaleType="fitCenter"
+                        android:src="@drawable/icon_add_photo"
+                        android:layout_marginEnd="@dimen/dimen8"
+                        app:layout_constraintDimensionRatio="W, 1:1"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintEnd_toStartOf="@id/iv_take_evidence_add_photo2"
+                        app:layout_constraintTop_toTopOf="parent"/>
 
-                <ImageView
-                    android:id="@+id/iv_take_evidence_add_photo2"
-                    android:layout_width="60dp"
-                    android:layout_height="60dp"
-                    android:layout_marginLeft="10dp"
-                    android:layout_marginTop="6dp"
-                    android:scaleType="centerCrop"
-                    android:src="@drawable/icon_add_photo_blank" />
+                    <ImageView
+                        android:id="@+id/iv_take_evidence_add_photo2"
+                        android:layout_width="0dp"
+                        android:layout_height="0dp"
+                        android:scaleType="fitCenter"
+                        android:src="@drawable/icon_add_photo_blank"
+                        android:layout_marginEnd="@dimen/dimen8"
+                        app:layout_constraintDimensionRatio="W, 1:1"
+                        app:layout_constrainedWidth="true"
+                        app:layout_constraintStart_toEndOf="@id/iv_take_evidence_add_photo1"
+                        app:layout_constraintEnd_toStartOf="@id/iv_take_evidence_add_photo3"
+                        app:layout_constraintTop_toTopOf="parent"/>
 
-                <ImageView
-                    android:id="@+id/iv_take_evidence_add_photo3"
-                    android:layout_width="60dp"
-                    android:layout_height="60dp"
-                    android:layout_marginLeft="10dp"
-                    android:layout_marginTop="6dp"
-                    android:scaleType="centerCrop"
-                    android:src="@drawable/icon_add_photo_blank" />
-            </LinearLayout>
+                    <ImageView
+                        android:id="@+id/iv_take_evidence_add_photo3"
+                        android:layout_width="0dp"
+                        android:layout_height="0dp"
+                        android:scaleType="fitCenter"
+                        android:src="@drawable/icon_add_photo_blank"
+                        app:layout_constraintDimensionRatio="W, 1:1"
+                        app:layout_constrainedWidth="true"
+                        app:layout_constraintStart_toEndOf="@id/iv_take_evidence_add_photo2"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintTop_toTopOf="parent"/>
+                </android.support.constraint.ConstraintLayout>
+
         </LinearLayout>
         </ScrollView>
     </android.support.v7.widget.CardView>
diff --git a/app/src/main/res/layout/item_spinner_drop_down.xml b/app/src/main/res/layout/item_spinner_drop_down.xml
index 8567c18..e2818b2 100644
--- a/app/src/main/res/layout/item_spinner_drop_down.xml
+++ b/app/src/main/res/layout/item_spinner_drop_down.xml
@@ -25,6 +25,7 @@
     android:textSize="14sp"
     tools:text="@string/app_name"
     android:maxLines="1"
+    android:padding="@dimen/dimen8"
     android:layout_width="match_parent"
-    android:layout_height="40dp"
+    android:layout_height="wrap_content"
     android:ellipsize="end" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8232306..99c40ba 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -57,6 +57,7 @@
     <string name="problem_recheck">闂澶嶆牳</string>
     <string name="history_patrol">鍘嗗彶宸℃煡</string>
     <string name="locale_take_evidence">闂鍙栬瘉</string>
+    <string name="problem_update">闂淇敼</string>
     <string name="question_list">闂娓呭崟</string>
     <string name="locale_change">鐜板満鏁存敼</string>
     <string name="colligate_score">缁煎悎璇勫垎</string>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 6dc82c3..39d7c7d 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -155,6 +155,17 @@
         <item name="android:textSize">12sp</item>
     </style>
 
+    <style name="SpinnerStyle">
+        <item name="android:textColor">@color/main_color_1</item>
+        <item name="android:textSize">14sp</item>
+        <item name="android:background">@drawable/shape_black_spinner</item>
+        <item name="android:paddingEnd">20dp</item>
+    </style>
+
+    <style name="SpinnerStyle.Black" >
+        <item name="android:background">@drawable/shape_black_spinner</item>
+    </style>
+
     <!--    //鏍囩鏂囧瓧鏍峰紡-->
     <style name="TextStyle.Tag">
         <item name="android:textColor">@color/boardGreen</item>

--
Gitblit v1.9.3