车辆管理优化
This commit is contained in:
parent
afcd241bbf
commit
632bfc4912
@ -15,7 +15,7 @@ import com.dahe.mylibrary.utils.ImageLoader
|
||||
* @Date 2024/1/23 16:27
|
||||
* @Description TODO
|
||||
*/
|
||||
class CarsAdapter(private var isCanUnbind: Boolean) :
|
||||
class CarsAdapter() :
|
||||
BaseQuickAdapter<CarBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CarBean?) {
|
||||
holder.run {
|
||||
@ -31,8 +31,6 @@ class CarsAdapter(private var isCanUnbind: Boolean) :
|
||||
}吨"""
|
||||
)
|
||||
|
||||
setGone(R.id.tvUnbind,!isCanUnbind)
|
||||
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(context, item?.carUrl, 6, getView<ImageView>(R.id.ivHead))
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
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
|
||||
|
||||
/**
|
||||
* @ClassName WaybillAdapter
|
||||
* @Author 用户
|
||||
* @Date 2024/1/23 16:27
|
||||
* @Description TODO
|
||||
*/
|
||||
class DriverCarsAdapter() :
|
||||
BaseQuickAdapter<CarBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CarBean?) {
|
||||
holder.run {
|
||||
setText(R.id.tvCarNum, item?.vehicleNum)
|
||||
setText(R.id.tvCarType, item?.vehicleType)
|
||||
setText(R.id.tvDriverName, item?.idcardName)
|
||||
setText(R.id.tvPhone, item?.contactPhone)
|
||||
setText(R.id.tvCarLen, """${if (!item?.carLong.isNullOrEmpty()) item?.carLong else ""}mm""")
|
||||
setText(
|
||||
R.id.tvCarWei,
|
||||
"""${
|
||||
if (!item?.approvedLoad.isNullOrEmpty()) item?.approvedLoad?.toFloat()
|
||||
?.div(1000) else if (!item?.tractionWeight.isNullOrEmpty()) item?.tractionWeight?.toFloat()
|
||||
?.div(1000) else 0
|
||||
}吨"""
|
||||
)
|
||||
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(context, item?.carUrl, 6, getView<ImageView>(R.id.ivHead))
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(context, item?.avatar, 6, getView<ImageView>(R.id.ivDriverHead))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
context: Context,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): QuickViewHolder {
|
||||
// 返回一个 ViewHolder
|
||||
return QuickViewHolder(R.layout.item_driver_cars, parent)
|
||||
}
|
||||
}
|
@ -30,6 +30,9 @@ data class CarBean(
|
||||
var vehicleNum: String="",
|
||||
val vehicleType: String="",
|
||||
val vehicleTypeCode: String="",
|
||||
val idcardName: String="",
|
||||
val contactPhone: String="",
|
||||
val avatar: String="",
|
||||
var isSelect: Boolean = false
|
||||
)
|
||||
|
||||
|
@ -12,6 +12,7 @@ import com.dahe.gldriver.databinding.ActivityCarTeamBinding
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.ui.account.authteam.EditCaTeamActivity
|
||||
import com.dahe.gldriver.ui.mine.InviteRecordActivity
|
||||
import com.dahe.gldriver.ui.mine.fragment.CarsManFragment
|
||||
import com.dahe.gldriver.ui.mine.fragment.DriversManFragment
|
||||
@ -114,6 +115,18 @@ class CarTeamManActivity : BaseActivity<ActivityCarTeamBinding>() {
|
||||
|
||||
binding.magicIndicator.navigator = commonNavigator
|
||||
mFragmentContainerHelper.attachMagicIndicator(binding.magicIndicator)
|
||||
|
||||
binding.run {
|
||||
llTeam.setOnClickListener {
|
||||
val userInfo = SPUtils.instance.getUserInfo(mContext)
|
||||
ActivityUtils.startActivity(
|
||||
mContext,
|
||||
EditCaTeamActivity::class.java,
|
||||
Bundle().apply {
|
||||
putString(AppConfig.ID, userInfo.captainId)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
|
@ -47,7 +47,7 @@ class CarsManActivity : BaseActivity<ActivityCarsManBinding>() {
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = CarsAdapter(true)
|
||||
adapter = CarsAdapter()
|
||||
adapter as CarsAdapter
|
||||
}.apply {
|
||||
isStateViewEnable = true
|
||||
|
@ -7,6 +7,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.CarsAdapter
|
||||
import com.dahe.gldriver.adapter.DriverCarsAdapter
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
|
||||
@ -29,7 +30,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
*/
|
||||
class CarsManFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCallBack {
|
||||
private var captainId: String = ""
|
||||
lateinit var adapter: CarsAdapter
|
||||
lateinit var adapter: DriverCarsAdapter
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
}
|
||||
|
||||
@ -48,8 +49,8 @@ class CarsManFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCallB
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = CarsAdapter(false)
|
||||
adapter as CarsAdapter
|
||||
adapter = DriverCarsAdapter()
|
||||
adapter as DriverCarsAdapter
|
||||
}.apply {
|
||||
isStateViewEnable = true
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.BaseSPUtils
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import com.google.gson.Gson
|
||||
import com.gyf.cactus.Cactus
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
@ -102,6 +103,10 @@ class OrderUtils private constructor() {
|
||||
BaseObserver(context, object : RxHttpCallBack<MutableList<CarBean>>() {
|
||||
override fun onSuccess(t: CommonResponseBean<MutableList<CarBean>>) {
|
||||
super.onSuccess(t)
|
||||
if (t.data != null) {
|
||||
ToastUtils.showToast(context, "暂未查询到车辆")
|
||||
return
|
||||
}
|
||||
if (t.data.size > 0) {//多辆车需选择车辆,单个车辆直接接单
|
||||
CommonPopUtils.getInstance()
|
||||
.showCarList(context, t.data) {
|
||||
@ -164,11 +169,16 @@ class OrderUtils private constructor() {
|
||||
.subscribe(BaseObserver(context, object : RxHttpCallBack<OrderDetailBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<OrderDetailBean>) {
|
||||
super.onSuccess(t)
|
||||
if (t.data != null&&!t.data.orderId.isNullOrEmpty()) {
|
||||
if (t.data != null && !t.data.orderId.isNullOrEmpty()) {
|
||||
BaseSPUtils.put(context, NEED_UP_ORDER, Gson().toJson(t.data))
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(Intent(context, UpLocationService2::class.java))
|
||||
}else{
|
||||
context.startForegroundService(
|
||||
Intent(
|
||||
context,
|
||||
UpLocationService2::class.java
|
||||
)
|
||||
)
|
||||
} else {
|
||||
context.startService(Intent(context, UpLocationService2::class.java))
|
||||
}
|
||||
} else {
|
||||
@ -184,7 +194,7 @@ class OrderUtils private constructor() {
|
||||
* 关闭上传运行中运单轨迹
|
||||
* @param context Context
|
||||
*/
|
||||
fun stopUpLocation(context: Context){
|
||||
fun stopUpLocation(context: Context) {
|
||||
context.stopService(Intent(context, UpLocationService2::class.java))
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@
|
||||
app:cardCornerRadius="@dimen/dp_8">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llTeam"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
|
133
app/src/main/res/layout/item_driver_cars.xml
Normal file
133
app/src/main/res/layout/item_driver_cars.xml
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView 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="@dimen/dp_120"
|
||||
android:background="@color/white"
|
||||
app:cardCornerRadius="@dimen/dp_8"
|
||||
app:contentPaddingLeft="@dimen/dp_12"
|
||||
app:contentPaddingTop="@dimen/dp_10"
|
||||
app:contentPaddingBottom="@dimen/dp_10"
|
||||
app:contentPaddingRight="@dimen/dp_12">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/ivDriverHead"
|
||||
android:layout_width="@dimen/dp_21"
|
||||
android:layout_height="@dimen/dp_21"
|
||||
android:background="@drawable/head_defaut"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDriverName"
|
||||
android:layout_marginLeft="@dimen/dp_8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="王师傅"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/black"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tvPhone"
|
||||
android:layout_marginLeft="@dimen/dp_16"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="156****5410"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/black"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/color_c"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivHead"
|
||||
android:layout_width="@dimen/dp_76"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:background="@drawable/login_car" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_16"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="豫A4982S"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_18" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.5"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="重型半挂牵引车"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarLen"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="16米"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarWei"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="30吨" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
Loading…
Reference in New Issue
Block a user