多张照片上传
This commit is contained in:
parent
23f6e12b35
commit
b4e38fe52f
@ -310,6 +310,12 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.waybill.activity.WaybillUpPicActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.waybill.activity.WaybillUpPicActivity"
|
android:name=".ui.waybill.activity.WaybillUpPicActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|locale"
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
|
@ -33,7 +33,6 @@ import com.arpa.mylibrary.utils.ActivityUtils
|
|||||||
import com.arpa.mylibrary.utils.BitmapUtil
|
import com.arpa.mylibrary.utils.BitmapUtil
|
||||||
import com.arpa.mylibrary.utils.FileUtil
|
import com.arpa.mylibrary.utils.FileUtil
|
||||||
import com.arpa.mylibrary.utils.LoadingUtils
|
import com.arpa.mylibrary.utils.LoadingUtils
|
||||||
import com.arpa.mylibrary.utils.LoadingUtils.Companion.instance
|
|
||||||
import com.arpa.mylibrary.utils.PopsUtils
|
import com.arpa.mylibrary.utils.PopsUtils
|
||||||
import com.arpa.mylibrary.utils.TimeUtil
|
import com.arpa.mylibrary.utils.TimeUtil
|
||||||
import com.arpa.mylibrary.utils.ToastUtils
|
import com.arpa.mylibrary.utils.ToastUtils
|
||||||
@ -123,30 +122,27 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
var myAdapter = GridImageAdapter(mContext, mData)
|
var myAdapter = GridImageAdapter(mContext, mData)
|
||||||
myAdapter.selectMax = 1
|
myAdapter.selectMax = 6
|
||||||
myAdapter.setOnItemClickListener(object : OnItemClickListener {
|
myAdapter.setOnItemClickListener(object : OnItemClickListener {
|
||||||
override fun onItemClick(v: View?, position: Int) {
|
override fun onItemClick(v: View?, position: Int) {
|
||||||
PopsUtils.getInstance()
|
PopsUtils.getInstance()
|
||||||
.showSelPic(mContext, 1, true, myAdapter) {
|
.showSelPic(mContext, if (type==2) 6 else 1, true, myAdapter) { it ->
|
||||||
OssServiceUtil.getInstance().run {
|
OssServiceUtil.getInstance().asyncPutImages(it.map { it.availablePath },this@WaybillUpPicActivity
|
||||||
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
|
) { success, failure ->
|
||||||
setResultCallBack { data, oldPath ->
|
upBean.waybillPhotoList.removeAll { it.type=="3" }
|
||||||
|
success.forEachIndexed { index, s ->
|
||||||
picBean = WaybillPhoto()
|
picBean = WaybillPhoto()
|
||||||
picBean.run {
|
picBean.run {
|
||||||
localPhotoUrl = it[0].availablePath
|
localPhotoUrl = it[index].availablePath
|
||||||
photoUrl = oldPath
|
photoUrl = s
|
||||||
location = binding.tvLoca.text.toString()
|
location = binding.tvLoca.text.toString()
|
||||||
receiptType =
|
receiptType =
|
||||||
if (type == 1) "4" else if (type == 2) "5" else "6"
|
if (type == 1) "4" else if (type == 2) "5" else "6"
|
||||||
this.type = "3"
|
this.type = "3"
|
||||||
}
|
}
|
||||||
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
|
|
||||||
upBean.waybillPhotoList.add(picBean)
|
upBean.waybillPhotoList.add(picBean)
|
||||||
} else {
|
|
||||||
upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl =
|
|
||||||
oldPath
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
myAdapter.data.run {
|
myAdapter.data.run {
|
||||||
clear()
|
clear()
|
||||||
@ -158,32 +154,56 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
|
|
||||||
override fun openPicture() {
|
override fun openPicture() {
|
||||||
PopsUtils.getInstance()
|
PopsUtils.getInstance()
|
||||||
.showSelPic(mContext, 1, true, myAdapter) {
|
.showSelPic(mContext, if (type==2) 6 else 1, true, myAdapter) { it ->
|
||||||
OssServiceUtil.getInstance().run {
|
OssServiceUtil.getInstance().asyncPutImages(it.map { it.availablePath },this@WaybillUpPicActivity
|
||||||
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
|
) { success, failure ->
|
||||||
setResultCallBack { data, oldPath ->
|
upBean.waybillPhotoList.removeAll { it.type=="3" }
|
||||||
|
success.forEachIndexed { index, s ->
|
||||||
picBean = WaybillPhoto()
|
picBean = WaybillPhoto()
|
||||||
picBean.run {
|
picBean.run {
|
||||||
localPhotoUrl = it[0].availablePath
|
localPhotoUrl = it[index].availablePath
|
||||||
photoUrl = oldPath
|
photoUrl = s
|
||||||
location = binding.tvLoca.text.toString()
|
location = binding.tvLoca.text.toString()
|
||||||
receiptType =
|
receiptType =
|
||||||
if (type == 1) "4" else if (type == 2) "5" else "6"
|
if (type == 1) "4" else if (type == 2) "5" else "6"
|
||||||
this.type = "3"
|
this.type = "3"
|
||||||
}
|
}
|
||||||
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
|
|
||||||
upBean.waybillPhotoList.add(picBean)
|
upBean.waybillPhotoList.add(picBean)
|
||||||
} else {
|
|
||||||
upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl =
|
|
||||||
oldPath
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
myAdapter.data.run {
|
myAdapter.data.run {
|
||||||
clear()
|
clear()
|
||||||
addAll(it)
|
addAll(it)
|
||||||
}
|
}
|
||||||
myAdapter.notifyDataSetChanged()
|
myAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
// OssServiceUtil.getInstance().run {
|
||||||
|
// asyncPutImage(it[0].realPath, this@WaybillUpPicActivity2)
|
||||||
|
// setResultCallBack { data, oldPath ->
|
||||||
|
// picBean = WaybillPhoto()
|
||||||
|
// picBean.run {
|
||||||
|
// localPhotoUrl = it[0].availablePath
|
||||||
|
// photoUrl = oldPath
|
||||||
|
// location = binding.tvLoca.text.toString()
|
||||||
|
// receiptType =
|
||||||
|
// if (type == 1) "4" else if (type == 2) "5" else "6"
|
||||||
|
// this.type = "3"
|
||||||
|
// }
|
||||||
|
// if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
|
||||||
|
// upBean.waybillPhotoList.add(picBean)
|
||||||
|
// } else {
|
||||||
|
// upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl =
|
||||||
|
// oldPath
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// myAdapter.data.run {
|
||||||
|
// clear()
|
||||||
|
// addAll(it)
|
||||||
|
// }
|
||||||
|
// myAdapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -344,7 +364,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
upTrafficReceipt(location)
|
upTrafficReceipt(location)
|
||||||
receiptImage()
|
receiptImage()
|
||||||
|
|
||||||
//平台更换运单状态
|
//todo 平台更换运单状态 暂时注释
|
||||||
DataManager.getInstance().driverLoadOrUnload(upBean)
|
DataManager.getInstance().driverLoadOrUnload(upBean)
|
||||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
||||||
@ -491,9 +511,9 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
//卸货回单照片
|
//卸货回单照片
|
||||||
fun receiptImage() {
|
fun receiptImage() {
|
||||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||||
|
var upCount = 0
|
||||||
var photoPaht =
|
upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.forEach { it ->
|
||||||
upBean.waybillPhotoList.find { it.type == "3" && it.receiptType == "5" }?.localPhotoUrl
|
var photoPaht = it.localPhotoUrl
|
||||||
val file: File = File(photoPaht)
|
val file: File = File(photoPaht)
|
||||||
val image = Image()
|
val image = Image()
|
||||||
val base = BitmapUtil.imageToBase64(photoPaht)
|
val base = BitmapUtil.imageToBase64(photoPaht)
|
||||||
@ -511,7 +531,9 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
object : OnResultListener {
|
object : OnResultListener {
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "回单照片上传成功")
|
Log.e("上报安联", "回单照片上传成功")
|
||||||
|
upCount++
|
||||||
dissLoading()
|
dissLoading()
|
||||||
|
if (upCount==upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size){
|
||||||
//跳转成功页面,停止上传轨迹
|
//跳转成功页面,停止上传轨迹
|
||||||
OrderUtils.getInstance().stopUpLocation(mContext)
|
OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
ActivityUtils.startActivity(
|
ActivityUtils.startActivity(
|
||||||
@ -520,10 +542,23 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
intent.extras
|
intent.extras
|
||||||
)
|
)
|
||||||
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
// finish()
|
// finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(s: String, s1: String) {
|
override fun onFailure(s: String, s1: String) {
|
||||||
|
upCount++
|
||||||
|
if (upCount==upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size){
|
||||||
|
//跳转成功页面,停止上传轨迹
|
||||||
|
OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
|
ActivityUtils.startActivity(
|
||||||
|
mContext,
|
||||||
|
WaybillSuccActivity::class.java,
|
||||||
|
intent.extras
|
||||||
|
)
|
||||||
|
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
Log.e("上报安联失败(回单照片):", s + s1)
|
Log.e("上报安联失败(回单照片):", s + s1)
|
||||||
// SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
// SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
||||||
//// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
//// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||||
@ -531,6 +566,51 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
//// startService(serviceIn);
|
//// startService(serviceIn);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// var photoPaht =
|
||||||
|
// upBean.waybillPhotoList.find { it.type == "3" && it.receiptType == "5" }?.localPhotoUrl
|
||||||
|
// val file: File = File(photoPaht)
|
||||||
|
// val image = Image()
|
||||||
|
// val base = BitmapUtil.imageToBase64(photoPaht)
|
||||||
|
// image.fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
||||||
|
// image.fileExt = FileUtil.lastName(file)
|
||||||
|
// image.fileName = FileUtil.fileName(file)
|
||||||
|
// image.imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||||
|
// image.baiduLongitude = bdLatLng.longitude
|
||||||
|
// image.baiduLatitude = bdLatLng.latitude
|
||||||
|
// image.location = binding.tvLoca.text.toString()
|
||||||
|
// MDPLocationCollectionManager.uploadPODImage(
|
||||||
|
// mContext,
|
||||||
|
// orderBean.orderNum,
|
||||||
|
// image,
|
||||||
|
// object : OnResultListener {
|
||||||
|
// override fun onSuccess() {
|
||||||
|
// Log.e("上报安联", "回单照片上传成功")
|
||||||
|
// dissLoading()
|
||||||
|
// //跳转成功页面,停止上传轨迹
|
||||||
|
// OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
|
// ActivityUtils.startActivity(
|
||||||
|
// mContext,
|
||||||
|
// WaybillSuccActivity::class.java,
|
||||||
|
// intent.extras
|
||||||
|
// )
|
||||||
|
// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
|
//// finish()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onFailure(s: String, s1: String) {
|
||||||
|
// Log.e("上报安联失败(回单照片):", s + s1)
|
||||||
|
// // SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
||||||
|
////// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||||
|
////// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||||
|
////// startService(serviceIn);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillAppraiseActi
|
|||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillLoadActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillLoadActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillRateActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillRateActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUnlLoadActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUnlLoadActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
||||||
import com.arpa.glex.bean.OrderBean
|
import com.arpa.glex.bean.OrderBean
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity
|
||||||
import com.arpa.mylibrary.base.BaseFragment
|
import com.arpa.mylibrary.base.BaseFragment
|
||||||
import com.arpa.mylibrary.callback.RefreshCallBack
|
import com.arpa.mylibrary.callback.RefreshCallBack
|
||||||
import com.arpa.mylibrary.net.CommonResponseBean
|
import com.arpa.mylibrary.net.CommonResponseBean
|
||||||
|
@ -16,9 +16,9 @@ import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
|||||||
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillLoadActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillLoadActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
||||||
import com.arpa.glex.bean.OrderBean
|
import com.arpa.glex.bean.OrderBean
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity
|
||||||
import com.arpa.mylibrary.base.BaseFragment
|
import com.arpa.mylibrary.base.BaseFragment
|
||||||
import com.arpa.mylibrary.callback.RefreshCallBack
|
import com.arpa.mylibrary.callback.RefreshCallBack
|
||||||
import com.arpa.mylibrary.net.CommonResponseBean
|
import com.arpa.mylibrary.net.CommonResponseBean
|
||||||
|
@ -16,9 +16,9 @@ import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
|||||||
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUnlLoadActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUnlLoadActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
||||||
import com.arpa.glex.bean.OrderBean
|
import com.arpa.glex.bean.OrderBean
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity
|
||||||
import com.arpa.mylibrary.base.BaseFragment
|
import com.arpa.mylibrary.base.BaseFragment
|
||||||
import com.arpa.mylibrary.callback.RefreshCallBack
|
import com.arpa.mylibrary.callback.RefreshCallBack
|
||||||
import com.arpa.mylibrary.net.CommonResponseBean
|
import com.arpa.mylibrary.net.CommonResponseBean
|
||||||
|
@ -148,7 +148,7 @@ class CommonPopUtils private constructor() {
|
|||||||
false, true, -1, -1, ConvertUtils.dp2px(10F), false,
|
false, true, -1, -1, ConvertUtils.dp2px(10F), false,
|
||||||
Color.rgb(32, 36, 46),
|
Color.rgb(32, 36, 46),
|
||||||
{ popupView, position ->
|
{ popupView, position ->
|
||||||
popupView.updateSrcView(recyclerView.getChildAt(position) as ImageView)
|
// popupView.updateSrcView(recyclerView.getChildAt(position) as ImageView)
|
||||||
}, SmartGlideImageLoader(true, R.mipmap.ic_launcher), null
|
}, SmartGlideImageLoader(true, R.mipmap.ic_launcher), null
|
||||||
)
|
)
|
||||||
.show()
|
.show()
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="26431.5"
|
tools:text="26431.5"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="@dimen/sp_20"
|
android:textSize="@dimen/sp_20"
|
||||||
android:textStyle="bold"></TextView>
|
android:textStyle="bold"></TextView>
|
||||||
@ -254,7 +254,9 @@
|
|||||||
android:id="@+id/tvIncome"
|
android:id="@+id/tvIncome"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="2643.5"
|
tools:text="2643.5"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="@dimen/sp_20"
|
android:textSize="@dimen/sp_20"
|
||||||
android:textStyle="bold"></TextView>
|
android:textStyle="bold"></TextView>
|
||||||
|
Loading…
Reference in New Issue
Block a user