diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 04462de..e5d29f3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -59,9 +59,8 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
- android:icon="@mipmap/ic_launcher"
+ android:icon="@mipmap/app_icon"
android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GLDriver"
android:usesCleartextTraffic="true"
@@ -200,6 +199,11 @@
android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
+
() {
+ override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: LocalMedia?) {
+ val view = holder.getView(R.id.fiv)
+ ImageLoader.getInstance().loadRoundImage(context,item?.availablePath,6,view)
+ }
+
+ override fun onCreateViewHolder(
+ context: Context,
+ parent: ViewGroup,
+ viewType: Int
+ ) = QuickViewHolder(R.layout.item_show_image, parent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/dahe/gldriver/bean/OrderDetailBean.kt b/app/src/main/java/com/dahe/gldriver/bean/OrderDetailBean.kt
index 8856e0c..d5598f3 100644
--- a/app/src/main/java/com/dahe/gldriver/bean/OrderDetailBean.kt
+++ b/app/src/main/java/com/dahe/gldriver/bean/OrderDetailBean.kt
@@ -69,11 +69,14 @@ data class OrderChild(
val orderId: String,
val phone: String,
val province: String,
+ val location: String,
+ val photoUrl: String,
val provinceCityArea: String,
val provinceCode: String,
val sortValue: String,
val status: String,
val totalAmount: String,
+ val receiptType: String,
val type: String
)
diff --git a/app/src/main/java/com/dahe/gldriver/net/Api.kt b/app/src/main/java/com/dahe/gldriver/net/Api.kt
index e4db75c..537e0f7 100644
--- a/app/src/main/java/com/dahe/gldriver/net/Api.kt
+++ b/app/src/main/java/com/dahe/gldriver/net/Api.kt
@@ -9,6 +9,7 @@ import com.dahe.gldriver.bean.DiCarColor
import com.dahe.gldriver.bean.DriverBean
import com.dahe.gldriver.bean.InviteRecord
import com.dahe.gldriver.bean.OcrPersonBean
+import com.dahe.gldriver.bean.OrderChild
import com.dahe.gldriver.bean.OrderDetailBean
import com.dahe.gldriver.bean.OssBean
import com.dahe.gldriver.bean.RateBean
@@ -376,6 +377,15 @@ interface Api {
fun driverRate(): Observable>
+ /**
+ * 查看单据
+ * @param orderId String
+ * @return Observable>
+ */
+ @GET(BASE_URL + "driver/order/orderPhoto")
+ fun orderPhoto(@Query("orderId") orderId :String): Observable>>
+
+
companion object {
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
const val BASE_URL = BuildConfig.BASE_URL
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/SeeDocActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/SeeDocActivity.kt
new file mode 100644
index 0000000..94bdea7
--- /dev/null
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/SeeDocActivity.kt
@@ -0,0 +1,170 @@
+package com.dahe.gldriver.ui.waybill.activity
+
+import android.os.Bundle
+import android.widget.ImageView
+import androidx.recyclerview.widget.GridLayoutManager
+import com.dahe.gldriver.R
+import com.dahe.gldriver.adapter.ShowImageAdapter
+import com.dahe.gldriver.base.AppConfig
+import com.dahe.gldriver.bean.OrderChild
+import com.dahe.gldriver.databinding.ActivitySeeDocBinding
+import com.dahe.gldriver.net.BaseObserver
+import com.dahe.gldriver.net.DataManager
+import com.dahe.gldriver.net.RxHttpCallBack
+import com.dahe.gldriver.utils.CommonPopUtils
+import com.dahe.mylibrary.base.BaseActivity
+import com.dahe.mylibrary.net.CommonResponseBean
+import com.dahe.mylibrary.weight.FullyGridLayoutManager
+import com.luck.picture.lib.decoration.GridSpacingItemDecoration
+import com.luck.picture.lib.entity.LocalMedia
+import com.luck.picture.lib.utils.DensityUtil
+import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
+import io.reactivex.rxjava3.schedulers.Schedulers
+
+/**
+ * @ClassName SeeDocActivity
+ * @Author john
+ * @Date 2024/3/18 16:03
+ * @Description 查看单据
+ */
+class SeeDocActivity : BaseActivity() {
+ private lateinit var loadDatas: ShowImageAdapter
+ private lateinit var loadBackDatas: ShowImageAdapter
+ private lateinit var unLoadDatas: ShowImageAdapter
+ private lateinit var unLoadBackDatas: ShowImageAdapter
+ private var picList = arrayListOf()
+ override fun initView(savedInstanceState: Bundle?) {
+ setStatusHeightParams(binding.rlTop)
+ setTitleBar("查看单据", true, true)
+
+ binding.run {
+ loadDatas = recyclerView.run {
+ layoutManager =
+ FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)
+ addItemDecoration(
+ GridSpacingItemDecoration(
+ 4,
+ DensityUtil.dip2px(mContext, 8f), false
+ )
+ )
+ var mData: List = ArrayList()
+ var myAdapter = ShowImageAdapter()
+ adapter = myAdapter
+ myAdapter
+ }.apply {
+ setOnItemClickListener { _, view, position ->
+ CommonPopUtils.getInstance().showPics(
+ mContext,
+ view.findViewById(R.id.fiv),
+ position,
+ recyclerView,
+ items.map { it.path })
+ }
+ }
+ loadBackDatas = recyclerView2.run {
+ layoutManager =
+ FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)
+ addItemDecoration(
+ GridSpacingItemDecoration(
+ 4,
+ DensityUtil.dip2px(mContext, 8f), false
+ )
+ )
+ var mData: List = ArrayList()
+ var myAdapter = ShowImageAdapter()
+ adapter = myAdapter
+ myAdapter
+ }.apply {
+ setOnItemClickListener { _, view, position ->
+ CommonPopUtils.getInstance().showPics(
+ mContext,
+ view.findViewById(R.id.fiv),
+ position,
+ recyclerView2,
+ items.map { it.path })
+ }
+ }
+
+ unLoadDatas = unRecycler.run {
+ layoutManager =
+ FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)
+ addItemDecoration(
+ GridSpacingItemDecoration(
+ 4,
+ DensityUtil.dip2px(mContext, 8f), false
+ )
+ )
+ var mData: List = ArrayList()
+ var myAdapter = ShowImageAdapter()
+ adapter = myAdapter
+ myAdapter
+ }.apply {
+ setOnItemClickListener { _, view, position ->
+ CommonPopUtils.getInstance().showPics(
+ mContext,
+ view.findViewById(R.id.fiv),
+ position,
+ unRecycler,
+ items.map { it.path })
+ }
+ }
+
+ unLoadBackDatas = unRecycler2.run {
+ layoutManager =
+ FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)
+ addItemDecoration(
+ GridSpacingItemDecoration(
+ 4,
+ DensityUtil.dip2px(mContext, 8f), false
+ )
+ )
+ var mData: List = ArrayList()
+ var myAdapter = ShowImageAdapter()
+ adapter = myAdapter
+ myAdapter
+ }.apply {
+ setOnItemClickListener { _, view, position ->
+ CommonPopUtils.getInstance().showPics(
+ mContext,
+ view.findViewById(R.id.fiv),
+ position,
+ unRecycler2,
+ items.map { it.path })
+ }
+ }
+ }
+ }
+
+ override fun initDate() {
+ DataManager.getInstance()
+ .orderPhoto(intent.extras?.getString(AppConfig.ORDER_ID).toString())
+ .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
+ .subscribe(BaseObserver(mContext, object : RxHttpCallBack>() {
+ override fun onSuccess(t: CommonResponseBean>) {
+ super.onSuccess(t)
+ val load = t.data.find { it.type == "1" }
+ val unLoad = t.data.filter { it.type == "2" }.maxBy { it.displayOrder }
+
+ loadDatas.submitList(t.data.filter { it.type == "1" }
+ .map { LocalMedia().apply { path = it.photoUrl } }.toMutableList())
+ loadBackDatas.submitList(t.data.filter { it.type == "3" && it.receiptType == "4" }
+ .map { LocalMedia().apply { path = it.photoUrl } }.toMutableList())
+ unLoadDatas.submitList(t.data.filter { it.type == "2" }
+ .map { LocalMedia().apply { path = it.photoUrl } }.toMutableList())
+ unLoadBackDatas.submitList(t.data.filter { it.type == "3" && (it.receiptType == "5" || it.receiptType == "6") }
+ .map { LocalMedia().apply { path = it.photoUrl } }.toMutableList())
+
+// picList.addAll(t.data.filter { it.type == "1" }.map { it.photoUrl })
+// picList.addAll(t.data.filter { it.type == "3"&& it.receiptType=="4" }.map { it.photoUrl })
+// picList.addAll(t.data.filter { it.type == "2" }.map { it.photoUrl })
+// picList.addAll(t.data.filter { it.type == "3" }.map { it.photoUrl })
+
+ binding.run {
+ tvLoca.text = load?.location
+ tvUnLoca.text = unLoad?.location
+ }
+ }
+ }))
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillLoadActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillLoadActivity.kt
index 7d3533b..a4b1708 100644
--- a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillLoadActivity.kt
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillLoadActivity.kt
@@ -51,14 +51,13 @@ class WaybillLoadActivity : BaseActivity() {
var orderId: String = ""
lateinit var orderBean: OrderDetailBean
override fun initView(savedInstanceState: Bundle?) {
-
- setTitleBar("运单详情", View.OnClickListener {
- finish()
- }, true, "查看单据") {
- ToastUtils.showToast(mContext, "查看单据")
+ orderId = intent.extras?.getString(AppConfig.ORDER_ID, "").toString()
+ setStatusHeightParams(binding.rlTop)
+ setTitleBar("运单详情",true,true,"查看单据"){
+ ActivityUtils.startActivity(mContext,SeeDocActivity::class.java,Bundle().apply { putString(AppConfig.ORDER_ID,orderId) })
}
- orderId = intent.extras?.getString(AppConfig.ORDER_ID, "").toString()
+
initRecy()
getLocation()
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillRateActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillRateActivity.kt
index c870ad5..ca504e6 100644
--- a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillRateActivity.kt
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillRateActivity.kt
@@ -9,6 +9,7 @@ import com.dahe.gldriver.bean.Resources
import com.dahe.gldriver.bean.UpRate
import com.dahe.gldriver.bean.WaybillPhoto
import com.dahe.gldriver.databinding.ActivityWaybillRateBinding
+import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
@@ -25,6 +26,7 @@ import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.utils.DensityUtil
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
+import org.greenrobot.eventbus.EventBus
/**
* @ClassName WaybillRateActivtiy
@@ -83,6 +85,7 @@ class WaybillRateActivity : BaseActivity() {
.subscribe(BaseObserver(mContext,object : RxHttpCallBack(){
override fun onSuccess(t: CommonResponseBean) {
super.onSuccess(t)
+ EventBus.getDefault().post(RefreshEvent(3))
finish()
}
}))
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUnlLoadActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUnlLoadActivity.kt
index f2a1114..58a5af5 100644
--- a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUnlLoadActivity.kt
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUnlLoadActivity.kt
@@ -48,11 +48,12 @@ class WaybillUnlLoadActivity : BaseActivity() {
var waybillId: String = ""
lateinit var orderBean: OrderDetailBean
override fun initView(savedInstanceState: Bundle?) {
-
- setTitleBar("运单详情", { finish() }, true, "查看单据") {
- ToastUtils.showToast(mContext, "查看单据")
- }
orderId = intent.extras?.getString(AppConfig.ORDER_ID, "").toString()
+ setStatusHeightParams(binding.rlTop)
+ setTitleBar("运单详情",true,true,"查看单据"){
+ ActivityUtils.startActivity(mContext,SeeDocActivity::class.java,Bundle().apply { putString(AppConfig.ORDER_ID,orderId) })
+ }
+
initRecy()
getLocation()
binding.run {
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUpPicActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUpPicActivity.kt
index 3062d45..1eaa7e8 100644
--- a/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUpPicActivity.kt
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/activity/WaybillUpPicActivity.kt
@@ -71,8 +71,6 @@ class WaybillUpPicActivity : BaseActivity() {
tvPosi.setOnClickListener {
getLocation()
}
-
-
recyclerView.run {
layoutManager =
FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/CancelWaybillFragment.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/CancelWaybillFragment.kt
index 46c520b..ba98635 100644
--- a/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/CancelWaybillFragment.kt
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/CancelWaybillFragment.kt
@@ -10,6 +10,7 @@ import com.dahe.gldriver.adapter.WaybillListAdapter
import com.dahe.gldriver.callback.OnSearchListener
import com.dahe.gldriver.databinding.FragmentWaybillBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
+import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
@@ -25,6 +26,8 @@ import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
/**
* @ClassName AllWaybillFragment
@@ -43,6 +46,7 @@ class CancelWaybillFragment : BaseFragment(), Refres
}
override fun onFragmentFirstVisible() {
+ EventBus.getDefault().register(this);
binding.run {
setRefresh(refresh, this@CancelWaybillFragment)
adapter = recyclerView.run {
@@ -116,4 +120,16 @@ class CancelWaybillFragment : BaseFragment(), Refres
}
}))
}
+
+ @Subscribe
+ fun eventStatu(event: RefreshEvent) {
+ if (event.statu == 3) {
+ initData()
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ EventBus.getDefault().unregister(this);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/WaitAppraiseFragment.kt b/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/WaitAppraiseFragment.kt
index 40ff1b4..29ca802 100644
--- a/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/WaitAppraiseFragment.kt
+++ b/app/src/main/java/com/dahe/gldriver/ui/waybill/fragment/WaitAppraiseFragment.kt
@@ -12,10 +12,13 @@ import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.callback.OnSearchListener
import com.dahe.gldriver.databinding.FragmentWaybillBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
+import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
+import com.dahe.gldriver.ui.waybill.activity.SeeDocActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillRateActivity
+import com.dahe.gldriver.ui.waybill.activity.WaybillUnlLoadActivity
import com.dahe.gldriver.utils.OrderUtils
import com.dahe.glex.bean.OrderBean
import com.dahe.glex.bean.WayBillBean
@@ -27,6 +30,8 @@ import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
/**
* @ClassName AllWaybillFragment
@@ -45,6 +50,7 @@ class WaitAppraiseFragment : BaseFragment(), Refresh
}
override fun onFragmentFirstVisible() {
+ EventBus.getDefault().register(this);
binding.run {
setRefresh(refresh, this@WaitAppraiseFragment)
adapter = recyclerView.run {
@@ -61,6 +67,11 @@ class WaitAppraiseFragment : BaseFragment(), Refresh
(adapter as WaybillListAdapter).isStateViewEnable = true
adapter as WaybillListAdapter
}.apply {
+ setOnItemClickListener{_,_,position->
+ val orderBean = items[position]
+ ActivityUtils.startActivity(mContext,
+ WaybillUnlLoadActivity::class.java,Bundle().apply { putString(AppConfig.ORDER_ID,orderBean.orderId) })
+ }
addOnItemChildClickListener(R.id.btnOk) { _, _, position ->
val orderBean = items[position]
ActivityUtils.startActivity(mContext,WaybillRateActivity::class.java, Bundle().apply {
@@ -124,4 +135,16 @@ class WaitAppraiseFragment : BaseFragment(), Refresh
}
}))
}
+
+ @Subscribe
+ fun eventStatu(event: RefreshEvent) {
+ if (event.statu == 3) {
+ initData()
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ EventBus.getDefault().unregister(this);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/dahe/gldriver/utils/CommonPopUtils.kt b/app/src/main/java/com/dahe/gldriver/utils/CommonPopUtils.kt
index bf77a70..0a539e6 100644
--- a/app/src/main/java/com/dahe/gldriver/utils/CommonPopUtils.kt
+++ b/app/src/main/java/com/dahe/gldriver/utils/CommonPopUtils.kt
@@ -1,15 +1,21 @@
package com.dahe.gldriver.utils
import android.content.Context
+import android.graphics.Color
+import android.widget.ImageView
+import androidx.recyclerview.widget.RecyclerView
+import com.dahe.gldriver.R
import com.dahe.gldriver.bean.CarBean
import com.dahe.gldriver.callback.OnResultListener
import com.dahe.gldriver.mypop.AgreementAlert
import com.dahe.gldriver.mypop.OnCarSelectListener
import com.dahe.gldriver.mypop.PopBottomCar
import com.dahe.mylibrary.base.SingletonNoPHolder
+import com.dahe.mylibrary.utils.ConvertUtils
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.interfaces.OnConfirmListener
import com.lxj.xpopup.interfaces.OnInputConfirmListener
+import com.lxj.xpopup.util.SmartGlideImageLoader
/**
* @ClassName CommonPopUtils
@@ -41,15 +47,15 @@ class CommonPopUtils private constructor() {
* @param context Context
* @param listener OnResultListener
*/
- fun showCenterAgreement(context: Context,listener: OnResultListener) {
+ fun showCenterAgreement(context: Context, listener: OnResultListener) {
XPopup.Builder(context)
.dismissOnBackPressed(false)
.dismissOnTouchOutside(false)
.asCustom(
AgreementAlert(
context, "https://agreement.dahehuoyun.com/huawei/#/private",
- "http://agreement.dahehuoyun.com/#/user"
- ,listener)
+ "http://agreement.dahehuoyun.com/#/user", listener
+ )
)
.show()
}
@@ -107,8 +113,33 @@ class CommonPopUtils private constructor() {
.autoOpenSoftInput(true)
.asInputConfirm(title, "", "请输入拒绝原因", listener)
.show()
+ }
-
+ /**
+ * 展示图片
+ * @param context Context
+ * @param position Int
+ * @param recyclerView RecyclerView
+ * @param mutableList MutableList
+ */
+ fun showPics(
+ context: Context,
+ imageView: ImageView? = null,
+ position: Int,
+ recyclerView: RecyclerView,
+ mutableList: List
+ ) {
+ XPopup.Builder(context) //.animationDuration(1000)
+ .isTouchThrough(true)
+ .asImageViewer(
+ imageView, position, mutableList,
+ false, true, -1, -1, ConvertUtils.dp2px(10F), false,
+ Color.rgb(32, 36, 46),
+ { popupView, position ->
+ popupView.updateSrcView(recyclerView.getChildAt(position) as ImageView)
+ }, SmartGlideImageLoader(true, R.mipmap.ic_launcher), null
+ )
+ .show()
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_see_doc.xml b/app/src/main/res/layout/activity_see_doc.xml
new file mode 100644
index 0000000..ce16e46
--- /dev/null
+++ b/app/src/main/res/layout/activity_see_doc.xml
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_waybill_detail.xml b/app/src/main/res/layout/activity_waybill_detail.xml
index fa030e3..1f1daeb 100644
--- a/app/src/main/res/layout/activity_waybill_detail.xml
+++ b/app/src/main/res/layout/activity_waybill_detail.xml
@@ -12,7 +12,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_240"
android:background="@drawable/home_top_bg"
- android:paddingTop="@dimen/dp_48">
+ android:paddingTop="@dimen/dp_54">
+ >
diff --git a/app/src/main/res/layout/activity_waybill_unload.xml b/app/src/main/res/layout/activity_waybill_unload.xml
index 8ba4dde..d111a7c 100644
--- a/app/src/main/res/layout/activity_waybill_unload.xml
+++ b/app/src/main/res/layout/activity_waybill_unload.xml
@@ -8,8 +8,9 @@
android:orientation="vertical">
@@ -38,6 +39,7 @@
android:layout_width="0dp"
android:layout_height="@dimen/dp_10"
android:background="@android:color/transparent" />
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-xxhdpi/app_icon.jpg b/app/src/main/res/mipmap-xxhdpi/app_icon.jpg
new file mode 100644
index 0000000..4f02e5c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/app_icon.jpg differ
diff --git a/mylibrary/src/main/java/com/dahe/mylibrary/adapter/GridImageAdapter.kt b/mylibrary/src/main/java/com/dahe/mylibrary/adapter/GridImageAdapter.kt
index aaae34f..30876c0 100644
--- a/mylibrary/src/main/java/com/dahe/mylibrary/adapter/GridImageAdapter.kt
+++ b/mylibrary/src/main/java/com/dahe/mylibrary/adapter/GridImageAdapter.kt
@@ -25,7 +25,7 @@ import com.luck.picture.lib.utils.DateUtils
class GridImageAdapter(context: Context?, result: List?) :
RecyclerView.Adapter() {
private val mInflater: LayoutInflater
- val data = ArrayList()
+ var data = mutableListOf()
var selectMax = 9
/**
@@ -49,6 +49,12 @@ class GridImageAdapter(context: Context?, result: List?) :
}
}
+ fun setDatas(datas:MutableList){
+ this.data.clear()
+ this.data = datas
+ notifyDataSetChanged()
+ }
+
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
var mImg: ImageView
var mIvDel: ImageView
diff --git a/mylibrary/src/main/java/com/dahe/mylibrary/adapter/OnlyShowImageAdapter.kt b/mylibrary/src/main/java/com/dahe/mylibrary/adapter/OnlyShowImageAdapter.kt
new file mode 100644
index 0000000..5758ede
--- /dev/null
+++ b/mylibrary/src/main/java/com/dahe/mylibrary/adapter/OnlyShowImageAdapter.kt
@@ -0,0 +1,214 @@
+package com.dahe.mylibrary.adapter
+
+import android.content.Context
+import android.net.Uri
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
+import com.dahe.mylibrary.R
+import com.dahe.mylibrary.callback.OnItemLongClickListener
+import com.luck.picture.lib.config.PictureMimeType
+import com.luck.picture.lib.config.SelectMimeType
+import com.luck.picture.lib.entity.LocalMedia
+import com.luck.picture.lib.utils.DateUtils
+
+/**
+ * @author:luck
+ * @date:2016-7-27 23:02
+ * @describe:GridImageAdapter
+ */
+class OnlyShowImageAdapter(context: Context?, result: List?) :
+ RecyclerView.Adapter() {
+ private val mInflater: LayoutInflater
+ var data = mutableListOf()
+ var selectMax = 9
+
+ /**
+ * 删除
+ */
+ fun delete(position: Int) {
+ try {
+ if (position != RecyclerView.NO_POSITION && data.size > position) {
+ data.removeAt(position)
+ notifyItemRemoved(position)
+ notifyItemRangeChanged(position, data.size)
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+
+ fun remove(position: Int) {
+ if (position < data.size) {
+ data.removeAt(position)
+ }
+ }
+
+ fun setDatas(datas:MutableList){
+ this.data.clear()
+ this.data = datas
+ notifyDataSetChanged()
+ }
+
+ class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var mImg: ImageView
+ var mIvDel: ImageView
+ var tvDuration: TextView
+
+ init {
+ mImg = view.findViewById(R.id.fiv)
+ mIvDel = view.findViewById(R.id.iv_del)
+ tvDuration = view.findViewById(R.id.tv_duration)
+ }
+ }
+
+ override fun getItemCount(): Int {
+// return if (data.size < selectMax) {
+// data.size + 1
+// } else {
+ return data.size
+// }
+ }
+
+ override fun getItemViewType(position: Int): Int {
+ return if (isShowAddItem(position)) {
+ TYPE_CAMERA
+ } else {
+ TYPE_PICTURE
+ }
+ }
+
+ /**
+ * 创建ViewHolder
+ */
+ override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): ViewHolder {
+ val view = mInflater.inflate(R.layout.gv_filter_image, viewGroup, false)
+ return ViewHolder(view)
+ }
+
+ private fun isShowAddItem(position: Int): Boolean {
+ val size = data.size
+ return position == size
+ }
+
+ /**
+ * 设置值
+ */
+ override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
+ //少于MaxSize张,显示继续添加的图标
+// if (getItemViewType(position) == TYPE_CAMERA) {
+// viewHolder.mImg.setImageResource(R.drawable.ic_add_image)
+// viewHolder.mImg.setOnClickListener {
+// if (mItemClickListener != null) {
+// mItemClickListener!!.openPicture()
+// }
+// }
+// viewHolder.mIvDel.visibility = View.INVISIBLE
+// } else {
+
+ //删除按钮隐藏
+ viewHolder.mIvDel.visibility = View.GONE
+ viewHolder.mIvDel.setOnClickListener { view: View? ->
+ val index = viewHolder.absoluteAdapterPosition
+ if (index != RecyclerView.NO_POSITION && data.size > index) {
+ data.removeAt(index)
+ notifyItemRemoved(index)
+ notifyItemRangeChanged(index, data.size)
+ }
+ }
+ val media = data[position]
+ val chooseModel = media.chooseModel
+ val path = media.availablePath
+ val duration = media.duration
+ viewHolder.tvDuration.visibility =
+ if (PictureMimeType.isHasVideo(media.mimeType)) View.VISIBLE else View.GONE
+ if (chooseModel == SelectMimeType.ofAudio()) {
+ viewHolder.tvDuration.visibility = View.VISIBLE
+ viewHolder.tvDuration.setCompoundDrawablesRelativeWithIntrinsicBounds(
+ R.drawable.ps_ic_audio,
+ 0,
+ 0,
+ 0
+ )
+ } else {
+ viewHolder.tvDuration.setCompoundDrawablesRelativeWithIntrinsicBounds(
+ R.drawable.ps_ic_video,
+ 0,
+ 0,
+ 0
+ )
+ }
+ viewHolder.tvDuration.text = DateUtils.formatDurationTime(duration)
+ if (chooseModel == SelectMimeType.ofAudio()) {
+ viewHolder.mImg.setImageResource(R.drawable.ps_audio_placeholder)
+ } else {
+ Glide.with(viewHolder.itemView.context)
+ .load(
+ if (PictureMimeType.isContent(path) && !media.isCut && !media.isCompressed) Uri.parse(
+ path
+ ) else path
+ )
+ .centerCrop()
+ .placeholder(R.color.app_color_f6)
+ .diskCacheStrategy(DiskCacheStrategy.ALL)
+ .into(viewHolder.mImg)
+ }
+ //itemView 的点击事件
+ if (mItemClickListener != null) {
+ viewHolder.itemView.setOnClickListener { v: View? ->
+ val adapterPosition = viewHolder.absoluteAdapterPosition
+ mItemClickListener!!.onItemClick(v, adapterPosition)
+ }
+ }
+ if (mItemLongClickListener != null) {
+ viewHolder.itemView.setOnLongClickListener { v: View? ->
+ val adapterPosition = viewHolder.absoluteAdapterPosition
+ mItemLongClickListener!!.onItemLongClick(viewHolder, adapterPosition, v)
+ true
+ }
+ }
+// }
+ }
+
+ private var mItemClickListener: OnItemClickListener? = null
+ fun setOnItemClickListener(l: OnItemClickListener?) {
+ mItemClickListener = l
+ }
+
+ interface OnItemClickListener {
+ /**
+ * Item click event
+ *
+ * @param v
+ * @param position
+ */
+ fun onItemClick(v: View?, position: Int)
+
+ /**
+ * Open PictureSelector
+ */
+ fun openPicture()
+ }
+
+ private var mItemLongClickListener: OnItemLongClickListener? = null
+
+ init {
+ mInflater = LayoutInflater.from(context)
+ data.addAll(result!!)
+ }
+
+ fun setItemLongClickListener(l: OnItemLongClickListener?) {
+ mItemLongClickListener = l
+ }
+
+ companion object {
+ const val TAG = "PictureSelector"
+ const val TYPE_CAMERA = 1
+ const val TYPE_PICTURE = 2
+ }
+}