|
@@ -710,60 +710,27 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
|
val picFile = File(path)
|
|
|
if (picFile.exists()) {
|
|
|
val key = picFile.name
|
|
|
- if (isHaveInternet()) {
|
|
|
- val url: String = Constant.ServerImgIPUp + key
|
|
|
- val str = UploadImage.uploadFiles(picFile, url)
|
|
|
- if (!TextUtils.isEmpty(str)) {
|
|
|
- var resultString: String? = null
|
|
|
- try {
|
|
|
- val `object` = JSONObject(str)
|
|
|
- resultString = `object`.getString("Result")
|
|
|
- } catch (e: JSONException) {
|
|
|
- e.printStackTrace()
|
|
|
- }
|
|
|
- if ("success" == resultString) {
|
|
|
- val photos = Photos()
|
|
|
- photos.itemType = 0
|
|
|
- photos.path = path
|
|
|
- photos.key = key
|
|
|
- if (info == null) {
|
|
|
- beans.add(photos)
|
|
|
- } else {
|
|
|
- val photosList = ArrayList<Photos>()
|
|
|
- if (staticInfoAdapter.hashMap[info!!.code] != null) {
|
|
|
- val value = Gson().fromJson<ArrayList<Photos>>(
|
|
|
- Gson().toJson(staticInfoAdapter.hashMap[info!!.code]), object : TypeToken<List<Photos?>?>() {}.type
|
|
|
- )
|
|
|
- photosList.addAll(value)
|
|
|
- }
|
|
|
- photosList.add(photos)
|
|
|
- staticInfoAdapter.hashMap.put(info!!.code, photosList)
|
|
|
- staticInfoAdapter.valueList.remove(info?.code)
|
|
|
- runOnUiThread { staticInfoAdapter.notifyItemChanged(currentPosition!!) }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ val photos = Photos()
|
|
|
+ photos.itemType = 0
|
|
|
+ photos.path = path
|
|
|
+ photos.key = key
|
|
|
+ if (info == null) {
|
|
|
+ beans.add(photos)
|
|
|
} else {
|
|
|
- val photos = Photos()
|
|
|
- photos.itemType = 0
|
|
|
- photos.path = path
|
|
|
- photos.key = key
|
|
|
- if (info == null) {
|
|
|
- beans.add(photos)
|
|
|
- } else {
|
|
|
- val photosList = ArrayList<Photos>()
|
|
|
- if (staticInfoAdapter.hashMap[info!!.code] != null) {
|
|
|
- val value = Gson().fromJson<ArrayList<Photos>>(
|
|
|
- staticInfoAdapter.hashMap[info!!.code] as String, object : TypeToken<List<Photos?>?>() {}.type
|
|
|
- )
|
|
|
- photosList.addAll(value)
|
|
|
- }
|
|
|
- photosList.add(photos)
|
|
|
- staticInfoAdapter.hashMap.put(info!!.code, photosList)
|
|
|
- staticInfoAdapter.valueList.remove(info?.code)
|
|
|
- runOnUiThread { staticInfoAdapter.notifyItemChanged(currentPosition!!) }
|
|
|
+ val photosList = ArrayList<Photos>()
|
|
|
+ if (staticInfoAdapter.hashMap[info!!.code] != null) {
|
|
|
+ val value = Gson().fromJson<ArrayList<Photos>>(
|
|
|
+ staticInfoAdapter.hashMap[info!!.code] as String, object : TypeToken<List<Photos?>?>() {}.type
|
|
|
+ )
|
|
|
+ photosList.addAll(value)
|
|
|
}
|
|
|
+ photosList.add(photos)
|
|
|
+ staticInfoAdapter.hashMap.put(info!!.code, photosList)
|
|
|
+ staticInfoAdapter.valueList.remove(info?.code)
|
|
|
+ runOnUiThread { staticInfoAdapter.notifyItemChanged(currentPosition!!) }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
emitter.onNext("")
|