From b4e38fe52f5e7ad3f38d94426be7371ebbd1dfea Mon Sep 17 00:00:00 2001 From: lijia Date: Tue, 30 Apr 2024 11:23:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=BC=A0=E7=85=A7=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 6 + .../waybill/activity/WaybillUpPicActivity.kt | 214 ++++++++++++------ .../ui/waybill/fragment/AllWaybillFragment.kt | 2 +- .../ui/waybill/fragment/WaitLoadFragment.kt | 2 +- .../ui/waybill/fragment/WaitUnLoadFragment.kt | 2 +- .../utils/CommonPopUtils.kt | 2 +- app/src/main/res/layout/fragment_mine.xml | 6 +- 7 files changed, 161 insertions(+), 73 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f92d6ae..b00e233 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -310,6 +310,12 @@ android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan|stateHidden" /> + + () { ) var myAdapter = GridImageAdapter(mContext, mData) - myAdapter.selectMax = 1 + myAdapter.selectMax = 6 myAdapter.setOnItemClickListener(object : OnItemClickListener { override fun onItemClick(v: View?, position: Int) { PopsUtils.getInstance() - .showSelPic(mContext, 1, true, myAdapter) { - OssServiceUtil.getInstance().run { - asyncPutImage(it[0].realPath, this@WaybillUpPicActivity) - setResultCallBack { data, oldPath -> + .showSelPic(mContext, if (type==2) 6 else 1, true, myAdapter) { it -> + OssServiceUtil.getInstance().asyncPutImages(it.map { it.availablePath },this@WaybillUpPicActivity + ) { success, failure -> + upBean.waybillPhotoList.removeAll { it.type=="3" } + success.forEachIndexed { index, s -> picBean = WaybillPhoto() picBean.run { - localPhotoUrl = it[0].availablePath - photoUrl = oldPath + localPhotoUrl = it[index].availablePath + photoUrl = s 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 - } + upBean.waybillPhotoList.add(picBean) } + } myAdapter.data.run { clear() @@ -158,32 +154,56 @@ class WaybillUpPicActivity : BaseActivity() { override fun openPicture() { PopsUtils.getInstance() - .showSelPic(mContext, 1, true, myAdapter) { - OssServiceUtil.getInstance().run { - asyncPutImage(it[0].realPath, this@WaybillUpPicActivity) - 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) { + .showSelPic(mContext, if (type==2) 6 else 1, true, myAdapter) { it -> + OssServiceUtil.getInstance().asyncPutImages(it.map { it.availablePath },this@WaybillUpPicActivity + ) { success, failure -> + upBean.waybillPhotoList.removeAll { it.type=="3" } + success.forEachIndexed { index, s -> + picBean = WaybillPhoto() + picBean.run { + localPhotoUrl = it[index].availablePath + photoUrl = s + location = binding.tvLoca.text.toString() + receiptType = + if (type == 1) "4" else if (type == 2) "5" else "6" + this.type = "3" + } upBean.waybillPhotoList.add(picBean) - } else { - upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl = - oldPath } + + } - } myAdapter.data.run { clear() addAll(it) } 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() { upTrafficReceipt(location) receiptImage() - //平台更换运单状态 + //todo 平台更换运单状态 暂时注释 DataManager.getInstance().driverLoadOrUnload(upBean) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { @@ -491,46 +511,106 @@ class WaybillUpPicActivity : BaseActivity() { //卸货回单照片 fun receiptImage() { ///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg + var upCount = 0 + upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.forEach { it -> + var photoPaht = it.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("上报安联", "回单照片上传成功") + upCount++ + dissLoading() + 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() + } - 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()); + 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) + // 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); - } - }) + } + }) + + + + + } + +// 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); +// } +// }) } diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/AllWaybillFragment.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/AllWaybillFragment.kt index bc4a98c..89130b2 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/AllWaybillFragment.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/AllWaybillFragment.kt @@ -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.WaybillRateActivity 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.glex.bean.OrderBean +import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity import com.arpa.mylibrary.base.BaseFragment import com.arpa.mylibrary.callback.RefreshCallBack import com.arpa.mylibrary.net.CommonResponseBean diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitLoadFragment.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitLoadFragment.kt index f25f568..221dd24 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitLoadFragment.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitLoadFragment.kt @@ -16,9 +16,9 @@ import com.arpa.hndahesudintocctmsdriver.net.BaseObserver import com.arpa.hndahesudintocctmsdriver.net.DataManager import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack 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.glex.bean.OrderBean +import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity import com.arpa.mylibrary.base.BaseFragment import com.arpa.mylibrary.callback.RefreshCallBack import com.arpa.mylibrary.net.CommonResponseBean diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitUnLoadFragment.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitUnLoadFragment.kt index 23c96ed..88e2d58 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitUnLoadFragment.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/fragment/WaitUnLoadFragment.kt @@ -16,9 +16,9 @@ import com.arpa.hndahesudintocctmsdriver.net.BaseObserver import com.arpa.hndahesudintocctmsdriver.net.DataManager import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack 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.glex.bean.OrderBean +import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUpPicActivity import com.arpa.mylibrary.base.BaseFragment import com.arpa.mylibrary.callback.RefreshCallBack import com.arpa.mylibrary.net.CommonResponseBean diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/utils/CommonPopUtils.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/utils/CommonPopUtils.kt index 156cb3e..3355a28 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/utils/CommonPopUtils.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/utils/CommonPopUtils.kt @@ -148,7 +148,7 @@ class CommonPopUtils private constructor() { false, true, -1, -1, ConvertUtils.dp2px(10F), false, Color.rgb(32, 36, 46), { popupView, position -> - popupView.updateSrcView(recyclerView.getChildAt(position) as ImageView) +// popupView.updateSrcView(recyclerView.getChildAt(position) as ImageView) }, SmartGlideImageLoader(true, R.mipmap.ic_launcher), null ) .show() diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index bace90e..694b952 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -203,7 +203,7 @@ android:layout_height="wrap_content" android:maxLines="1" android:singleLine="true" - android:text="26431.5" + tools:text="26431.5" android:textColor="@color/black" android:textSize="@dimen/sp_20" android:textStyle="bold"> @@ -254,7 +254,9 @@ android:id="@+id/tvIncome" android:layout_width="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:textSize="@dimen/sp_20" android:textStyle="bold">