查看单据

This commit is contained in:
lijia 2024-03-19 09:53:01 +08:00
parent e7f173fde2
commit e9b9834a5c
20 changed files with 827 additions and 27 deletions

View File

@ -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" />
<activity
android:name=".ui.waybill.activity.SeeDocActivity"
android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name=".ui.waybill.activity.WaybillSuccActivity"
android:configChanges="keyboardHidden|orientation|locale"

View File

@ -0,0 +1,30 @@
package com.dahe.gldriver.adapter
import android.content.Context
import android.view.ViewGroup
import android.widget.ImageView
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.dahe.gldriver.R
import com.dahe.gldriver.bean.CarBean
import com.dahe.mylibrary.utils.ImageLoader
import com.luck.picture.lib.entity.LocalMedia
/**
* @ClassName ShowImageAdapter
* @Author john
* @Date 2024/3/19 08:39
* @Description TODO
*/
class ShowImageAdapter : BaseQuickAdapter<LocalMedia, QuickViewHolder>() {
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: LocalMedia?) {
val view = holder.getView<ImageView>(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)
}

View File

@ -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
)

View File

@ -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<CommonResponseBean<RateBean>>
/**
* 查看单据
* @param orderId String
* @return Observable<CommonResponseBean<RateBean>>
*/
@GET(BASE_URL + "driver/order/orderPhoto")
fun orderPhoto(@Query("orderId") orderId :String): Observable<CommonResponseBean<MutableList<OrderChild>>>
companion object {
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
const val BASE_URL = BuildConfig.BASE_URL

View File

@ -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<ActivitySeeDocBinding>() {
private lateinit var loadDatas: ShowImageAdapter
private lateinit var loadBackDatas: ShowImageAdapter
private lateinit var unLoadDatas: ShowImageAdapter
private lateinit var unLoadBackDatas: ShowImageAdapter
private var picList = arrayListOf<String>()
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<LocalMedia> = 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<LocalMedia> = 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<LocalMedia> = 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<LocalMedia> = 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<MutableList<OrderChild>>() {
override fun onSuccess(t: CommonResponseBean<MutableList<OrderChild>>) {
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
}
}
}))
}
}

View File

@ -51,14 +51,13 @@ class WaybillLoadActivity : BaseActivity<ActivityWaybillLoadBinding>() {
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()

View File

@ -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<ActivityWaybillRateBinding>() {
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<Any>(){
override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t)
EventBus.getDefault().post(RefreshEvent(3))
finish()
}
}))

View File

@ -48,11 +48,12 @@ class WaybillUnlLoadActivity : BaseActivity<ActivityWaybillUnloadBinding>() {
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 {

View File

@ -71,8 +71,6 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
tvPosi.setOnClickListener {
getLocation()
}
recyclerView.run {
layoutManager =
FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)

View File

@ -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<FragmentWaybillListBinding>(), Refres
}
override fun onFragmentFirstVisible() {
EventBus.getDefault().register(this);
binding.run {
setRefresh(refresh, this@CancelWaybillFragment)
adapter = recyclerView.run {
@ -116,4 +120,16 @@ class CancelWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), Refres
}
}))
}
@Subscribe
fun eventStatu(event: RefreshEvent) {
if (event.statu == 3) {
initData()
}
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this);
}
}

View File

@ -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<FragmentWaybillListBinding>(), Refresh
}
override fun onFragmentFirstVisible() {
EventBus.getDefault().register(this);
binding.run {
setRefresh(refresh, this@WaitAppraiseFragment)
adapter = recyclerView.run {
@ -61,6 +67,11 @@ class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>(), 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<FragmentWaybillListBinding>(), Refresh
}
}))
}
@Subscribe
fun eventStatu(event: RefreshEvent) {
if (event.statu == 3) {
initData()
}
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this);
}
}

View File

@ -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<Any>
*/
fun showPics(
context: Context,
imageView: ImageView? = null,
position: Int,
recyclerView: RecyclerView,
mutableList: List<Any>
) {
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()
}
}

View File

@ -0,0 +1,276 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F5"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_240"
android:background="@drawable/home_top_bg"
>
<include layout="@layout/common_toolbar"></include>
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-130dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@drawable/shape_white_8"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/dp_16">
<ImageView
android:id="@+id/tvLocation"
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:background="@drawable/icon_location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
android:text="装货地点"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tvLoca"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvLocation"
android:layout_marginTop="@dimen/dp_16"
android:background="@drawable/shape_orange_5"
android:paddingLeft="@dimen/dp_9"
android:paddingTop="@dimen/dp_14"
android:paddingRight="@dimen/dp_9"
android:paddingBottom="@dimen/dp_14"
android:textColor="@color/black"
android:textSize="@dimen/sp_16"
tools:text="河南省郑州市金水区农业路经三路东南角银 丰商务A座" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/dp_16">
<ImageView
android:id="@+id/ivLoad"
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_2"
android:background="@drawable/icon_load_pic" />
<TextView
android:id="@+id/tvPicTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
android:text="装货照片"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:overScrollMode="never" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/dp_16">
<ImageView
android:id="@+id/ivRece"
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_2"
android:background="@drawable/icon_rece" />
<TextView
android:id="@+id/tvRece"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
android:text="装货回单"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:overScrollMode="never" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_marginTop="@dimen/dp_14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@drawable/shape_white_8"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/dp_16">
<ImageView
android:id="@+id/tvUnLocation"
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:background="@drawable/icon_location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
android:text="卸货地点"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tvUnLoca"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvUnLocation"
android:layout_marginTop="@dimen/dp_16"
android:background="@drawable/shape_orange_5"
android:paddingLeft="@dimen/dp_9"
android:paddingTop="@dimen/dp_14"
android:paddingRight="@dimen/dp_9"
android:paddingBottom="@dimen/dp_14"
android:textColor="@color/black"
android:textSize="@dimen/sp_16"
tools:text="河南省郑州市金水区农业路经三路东南角银 丰商务A座" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/dp_16">
<ImageView
android:id="@+id/ivUnLoad"
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_2"
android:background="@drawable/icon_load_pic" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
android:text="卸货照片"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/unRecycler"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:overScrollMode="never" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/dp_16">
<ImageView
android:id="@+id/ivUnRece"
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_2"
android:background="@drawable/icon_rece" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
android:text="装货回单"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/unRecycler2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:overScrollMode="never" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<View
android:layout_width="0dp"
android:layout_height="@dimen/dp_30"
android:background="@color/color_transparent"
/>
</LinearLayout>

View File

@ -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">
<TextView
android:id="@+id/tvTitle"

View File

@ -8,10 +8,11 @@
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:layout_height="@dimen/dp_90"
android:background="@drawable/waybill_top_bg"
android:gravity="bottom">
>
<include layout="@layout/common_toolbar"></include>
</RelativeLayout>

View File

@ -8,8 +8,9 @@
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:layout_height="@dimen/dp_90"
android:background="@drawable/waybill_top_bg"
android:gravity="bottom">
@ -38,6 +39,7 @@
android:layout_width="0dp"
android:layout_height="@dimen/dp_10"
android:background="@android:color/transparent" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -132,31 +134,31 @@
<TextView
android:layout_weight="1"
android:id="@+id/tvCarNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="豫A87SF9"
android:layout_weight="1"
android:gravity="left"
android:text="豫A87SF9"
android:textColor="@color/black"
android:textSize="@dimen/sp_17"
android:textStyle="bold" />
<TextView
android:layout_weight="1"
android:id="@+id/tvCarLen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="16米/30吨"
android:textColor="@color/color_01"
android:textSize="@dimen/sp_14" />
<TextView
android:layout_weight="1"
android:id="@+id/tvCarType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="重型栏板半挂车"
android:textColor="@color/color_01"

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<com.luck.picture.lib.widget.SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/fiv"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:src="@color/app_color_f6" />
</com.luck.picture.lib.widget.SquareRelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -25,7 +25,7 @@ import com.luck.picture.lib.utils.DateUtils
class GridImageAdapter(context: Context?, result: List<LocalMedia>?) :
RecyclerView.Adapter<GridImageAdapter.ViewHolder?>() {
private val mInflater: LayoutInflater
val data = ArrayList<LocalMedia>()
var data = mutableListOf<LocalMedia>()
var selectMax = 9
/**
@ -49,6 +49,12 @@ class GridImageAdapter(context: Context?, result: List<LocalMedia>?) :
}
}
fun setDatas(datas:MutableList<LocalMedia>){
this.data.clear()
this.data = datas
notifyDataSetChanged()
}
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
var mImg: ImageView
var mIvDel: ImageView

View File

@ -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
/**
* @authorluck
* @date2016-7-27 23:02
* @describeGridImageAdapter
*/
class OnlyShowImageAdapter(context: Context?, result: List<LocalMedia>?) :
RecyclerView.Adapter<OnlyShowImageAdapter.ViewHolder?>() {
private val mInflater: LayoutInflater
var data = mutableListOf<LocalMedia>()
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<LocalMedia>){
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
}
}