派单-指派车队
This commit is contained in:
parent
b967c7b5c2
commit
68084cfcf1
@ -155,12 +155,22 @@
|
|||||||
android:configChanges="keyboardHidden|orientation|locale"
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
|
<activity
|
||||||
<activity android:name=".ui.MarketsActivity"
|
android:name=".ui.mine.activity.ChoiceFleetActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|locale"
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
></activity>
|
<activity
|
||||||
|
android:name=".ui.mine.activity.ChoiceFleetCarActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.MarketsActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustPan|stateHidden"></activity>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.dhsd.glowner.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.mylibrary.utils.ImageLoader
|
||||||
|
import com.dhsd.glowner.R
|
||||||
|
import com.dhsd.glowner.bean.CarBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WaybillAdapter
|
||||||
|
* @Author 用户
|
||||||
|
* @Date 2024/1/23 16:27
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
class DriverFleetCarAdapter() :
|
||||||
|
BaseQuickAdapter<CarBean, QuickViewHolder>() {
|
||||||
|
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CarBean?) {
|
||||||
|
|
||||||
|
item?.let {
|
||||||
|
holder.run {
|
||||||
|
setBackgroundResource(R.id.cdContent, if (item.isSelect) R.drawable.shape_discar_8 else R.drawable.shape_white_8)
|
||||||
|
setText(R.id.tvCarNum, item.vehicleNum)
|
||||||
|
setText(R.id.tvDriverName, item.driverContactName)
|
||||||
|
setText(R.id.tvPhone, item.driverContactPhone)
|
||||||
|
setText(R.id.tvCarLen, """${item.carLong.toFloat().div(1000)}m/${item.approvedLoad.toFloat().div(1000)}吨/${item?.vehicleType}""")
|
||||||
|
ImageLoader.getInstance()
|
||||||
|
.loadRoundImage(context, item?.carUrl, 6, getView<ImageView>(R.id.ivHead))
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(
|
||||||
|
context: Context,
|
||||||
|
parent: ViewGroup,
|
||||||
|
viewType: Int
|
||||||
|
): QuickViewHolder {
|
||||||
|
// 返回一个 ViewHolder
|
||||||
|
return QuickViewHolder(R.layout.item_driver_fleet_car, parent)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.dhsd.glowner.adapter.popadapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.CheckBox
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
|
import com.dahe.mylibrary.utils.ImageLoader
|
||||||
|
import com.dhsd.glowner.R
|
||||||
|
import com.dhsd.glowner.bean.CaptainBean
|
||||||
|
import com.dhsd.glowner.bean.CarBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WaybillAdapter
|
||||||
|
* @Author 用户
|
||||||
|
* @Date 2024/1/23 16:27
|
||||||
|
* @Description 选择车队
|
||||||
|
*/
|
||||||
|
class DriverFleetAdapter() :
|
||||||
|
BaseQuickAdapter<CaptainBean, QuickViewHolder>() {
|
||||||
|
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CaptainBean?) {
|
||||||
|
holder.run {
|
||||||
|
item?.let {
|
||||||
|
holder.run {
|
||||||
|
setText(R.id.tvTitle,it.captainName)
|
||||||
|
setText(R.id.tvName,it.contactName)
|
||||||
|
setText(R.id.tvPhone,it.idcardName)
|
||||||
|
// ImageLoader.getInstance()
|
||||||
|
// .loadRoundImage(context, it.driverAvatar, 6, getView<ImageView>(R.id.ivHead))
|
||||||
|
getView<CheckBox>(R.id.cBox).isChecked = it.isSelect
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(
|
||||||
|
context: Context,
|
||||||
|
parent: ViewGroup,
|
||||||
|
viewType: Int
|
||||||
|
): QuickViewHolder {
|
||||||
|
// 返回一个 ViewHolder
|
||||||
|
return QuickViewHolder(R.layout.item_driver_fleet, parent)
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ object AppConfig {
|
|||||||
const val BUGLY_APP_ID = "a5b894cef7"
|
const val BUGLY_APP_ID = "a5b894cef7"
|
||||||
const val TIME = "DA_HE_TIME"
|
const val TIME = "DA_HE_TIME"
|
||||||
const val ID = "DA_HE_ID"
|
const val ID = "DA_HE_ID"
|
||||||
|
const val CAPTAIN_ID = "CAPTAIN_ID"
|
||||||
const val PWD = "DA_HE_PHONE"
|
const val PWD = "DA_HE_PHONE"
|
||||||
const val CODE = "DA_HE_PHONE"
|
const val CODE = "DA_HE_PHONE"
|
||||||
const val SUCCESS_TYPE = "DA_HE_SUCCESS_TYPE"
|
const val SUCCESS_TYPE = "DA_HE_SUCCESS_TYPE"
|
||||||
|
@ -33,6 +33,8 @@ data class CarBean(
|
|||||||
var vehicleNum: String="",
|
var vehicleNum: String="",
|
||||||
val vehicleType: String="",
|
val vehicleType: String="",
|
||||||
val contactName: String="",
|
val contactName: String="",
|
||||||
|
val driverContactName: String="",
|
||||||
|
val driverContactPhone: String="",
|
||||||
val vehicleTypeCode: String="",
|
val vehicleTypeCode: String="",
|
||||||
val idcardName: String="",
|
val idcardName: String="",
|
||||||
val contactPhone: String="",
|
val contactPhone: String="",
|
||||||
@ -43,7 +45,7 @@ data class CaptainBean(
|
|||||||
val auditStatus: String,
|
val auditStatus: String,
|
||||||
val businessEnterpriseName: String,
|
val businessEnterpriseName: String,
|
||||||
val businessLegalPerson: String,
|
val businessLegalPerson: String,
|
||||||
val captainId: Int,
|
val captainId: String,
|
||||||
val captainName: String,
|
val captainName: String,
|
||||||
val captainType: String,
|
val captainType: String,
|
||||||
val contactName: String,
|
val contactName: String,
|
||||||
|
10
app/src/main/java/com/dhsd/glowner/bean/EventBean.kt
Normal file
10
app/src/main/java/com/dhsd/glowner/bean/EventBean.kt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package com.dhsd.glowner.bean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EventBean
|
||||||
|
* @Author john
|
||||||
|
* @Date 2024/10/29 16:17
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
|
||||||
|
class HomeEvent(var isRefresh: Boolean)
|
@ -88,5 +88,5 @@ interface Api {
|
|||||||
* @return Observable<CommonResponseBean<MutableList<CaptainBean>>>
|
* @return Observable<CommonResponseBean<MutableList<CaptainBean>>>
|
||||||
*/
|
*/
|
||||||
@GET(BASE_URL+"devApi/business/ft/common/dict/captain/driverAndCar")
|
@GET(BASE_URL+"devApi/business/ft/common/dict/captain/driverAndCar")
|
||||||
fun driverAndCarList(@Query("captainId") captainId:String): Observable<CommonResponseBean<MutableList<CaptainBean>>>
|
fun driverAndCarList(@Query("captainId") captainId:String): Observable<CommonResponseBean<MutableList<CarBean>>>
|
||||||
}
|
}
|
@ -3,22 +3,19 @@ package com.dhsd.glowner.ui.home
|
|||||||
import BaseObserver
|
import BaseObserver
|
||||||
import DataManager
|
import DataManager
|
||||||
import RxHttpCallBack
|
import RxHttpCallBack
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.activity.result.ActivityResultRegistry
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.chad.library.adapter4.BaseQuickAdapter
|
|
||||||
import com.dahe.gldriver.base.AppConfig
|
import com.dahe.gldriver.base.AppConfig
|
||||||
import com.dahe.glex.bean.OrderBean
|
import com.dahe.glex.bean.OrderBean
|
||||||
import com.dahe.glex.bean.OrderListBean
|
import com.dahe.glex.bean.OrderListBean
|
||||||
import com.dahe.glex.bean.TextOrder
|
import com.dahe.glex.bean.TextOrder
|
||||||
import com.dahe.glex.bean.WayBillBean
|
|
||||||
import com.dahe.mylibrary.base.BaseFragment
|
import com.dahe.mylibrary.base.BaseFragment
|
||||||
import com.dahe.mylibrary.callback.RefreshCallBack
|
import com.dahe.mylibrary.callback.RefreshCallBack
|
||||||
import com.dahe.mylibrary.net.CommonResponseBean
|
import com.dahe.mylibrary.net.CommonResponseBean
|
||||||
@ -28,15 +25,17 @@ import com.dahe.mylibrary.utils.ConvertUtils
|
|||||||
import com.dahe.mylibrary.utils.ToastUtils
|
import com.dahe.mylibrary.utils.ToastUtils
|
||||||
import com.dhsd.glowner.R
|
import com.dhsd.glowner.R
|
||||||
import com.dhsd.glowner.adapter.WaybillAdapter
|
import com.dhsd.glowner.adapter.WaybillAdapter
|
||||||
import com.dhsd.glowner.bean.PopBean
|
import com.dhsd.glowner.bean.HomeEvent
|
||||||
import com.dhsd.glowner.cuspop.OnCarSelectListener
|
|
||||||
import com.dhsd.glowner.databinding.FragmentHomeBinding
|
import com.dhsd.glowner.databinding.FragmentHomeBinding
|
||||||
import com.dhsd.glowner.ui.MarketsActivity
|
|
||||||
import com.dhsd.glowner.ui.home.activtiy.SendGoodsActivity
|
import com.dhsd.glowner.ui.home.activtiy.SendGoodsActivity
|
||||||
import com.dhsd.glowner.ui.mine.activity.ChoiceCarActivity
|
import com.dhsd.glowner.ui.mine.activity.ChoiceCarActivity
|
||||||
|
import com.dhsd.glowner.ui.mine.activity.ChoiceFleetActivity
|
||||||
import com.dhsd.glowner.utils.CommonPopUtils
|
import com.dhsd.glowner.utils.CommonPopUtils
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName HomeFragment
|
* @ClassName HomeFragment
|
||||||
@ -62,6 +61,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onFragmentFirstVisible() {
|
override fun onFragmentFirstVisible() {
|
||||||
|
EventBus.getDefault().register(this)
|
||||||
initRecy()
|
initRecy()
|
||||||
|
|
||||||
binding.tvMar.isSelected = true
|
binding.tvMar.isSelected = true
|
||||||
@ -83,6 +83,13 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
initData()
|
initData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun processResult(home: HomeEvent) {
|
||||||
|
if (home.isRefresh){
|
||||||
|
initData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun initRecy() {
|
private fun initRecy() {
|
||||||
setRefresh(binding.refresh, this)
|
setRefresh(binding.refresh, this)
|
||||||
adapter = binding.recyclerView.run {
|
adapter = binding.recyclerView.run {
|
||||||
@ -108,9 +115,20 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
mContext
|
mContext
|
||||||
) { _, position ->
|
) { _, position ->
|
||||||
if (position === 0) {
|
if (position === 0) {
|
||||||
launcher.launch(Intent(mContext, ChoiceCarActivity::class.java).apply {
|
|
||||||
putExtras(Bundle().apply { putString(AppConfig.ID, item?.orderId) })
|
}
|
||||||
})
|
|
||||||
|
when (position) {
|
||||||
|
0->{
|
||||||
|
launcher.launch(Intent(mContext, ChoiceCarActivity::class.java).apply {
|
||||||
|
putExtras(Bundle().apply { putString(AppConfig.ID, item?.orderId) })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
launcher.launch(Intent(mContext, ChoiceFleetActivity::class.java).apply {
|
||||||
|
putExtras(Bundle().apply { putString(AppConfig.ID, item?.orderId) })
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,10 +138,6 @@ class ChoiceCarActivity : BaseActivity<ActivityChoiceCarBinding>(), OnLimitClick
|
|||||||
if (orderId.isEmpty())
|
if (orderId.isEmpty())
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (selectCar == null) {
|
if (selectCar == null) {
|
||||||
showToast("请选择车辆")
|
showToast("请选择车辆")
|
||||||
return
|
return
|
||||||
|
@ -3,22 +3,31 @@ package com.dhsd.glowner.ui.mine.activity
|
|||||||
import BaseObserver
|
import BaseObserver
|
||||||
import DataManager
|
import DataManager
|
||||||
import RxHttpCallBack
|
import RxHttpCallBack
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
|
import com.dahe.gldriver.base.AppConfig
|
||||||
|
import com.dahe.glex.bean.DispatchBean
|
||||||
import com.dahe.mylibrary.base.BaseActivity
|
import com.dahe.mylibrary.base.BaseActivity
|
||||||
import com.dahe.mylibrary.net.CommonResponseBean
|
import com.dahe.mylibrary.net.CommonResponseBean
|
||||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||||
|
import com.dahe.mylibrary.utils.ActivityUtils
|
||||||
import com.dahe.mylibrary.utils.ConvertUtils
|
import com.dahe.mylibrary.utils.ConvertUtils
|
||||||
import com.dahe.mylibrary.utils.ToastUtils
|
import com.dahe.mylibrary.utils.ToastUtils
|
||||||
import com.dhsd.glowner.R
|
import com.dhsd.glowner.R
|
||||||
import com.dhsd.glowner.adapter.DriverCarsAdapter
|
import com.dhsd.glowner.adapter.DriverCarsAdapter
|
||||||
|
import com.dhsd.glowner.adapter.popadapter.DriverFleetAdapter
|
||||||
import com.dhsd.glowner.bean.CaptainBean
|
import com.dhsd.glowner.bean.CaptainBean
|
||||||
import com.dhsd.glowner.bean.CarBean
|
import com.dhsd.glowner.bean.CarBean
|
||||||
import com.dhsd.glowner.databinding.ActivityChoiceFleetCarBinding
|
import com.dhsd.glowner.databinding.ActivityChoiceFleetCarBinding
|
||||||
|
import com.dhsd.glowner.utils.OnLimitClickHelper
|
||||||
|
import com.dhsd.glowner.utils.OnLimitClickListener
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.core.Scheduler
|
import io.reactivex.rxjava3.core.Scheduler
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
@ -29,15 +38,17 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
|||||||
* @Date 2024/10/24 16:02
|
* @Date 2024/10/24 16:02
|
||||||
* @Description 选择车队/车辆
|
* @Description 选择车队/车辆
|
||||||
*/
|
*/
|
||||||
class ChoiceFleetActivity : BaseActivity<ActivityChoiceFleetCarBinding>() {
|
class ChoiceFleetActivity : BaseActivity<ActivityChoiceFleetCarBinding>(), OnLimitClickListener {
|
||||||
|
lateinit var adapter: DriverFleetAdapter
|
||||||
|
private var orderId: String = ""
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
setStatusBarColor(R.color.white)
|
setStatusBarColor(R.color.white)
|
||||||
setTitleBar("选择车队/车辆", View.OnClickListener { finish() }, true, "我的熟车") {
|
setTitleBar("选择车队/车辆", View.OnClickListener { finish() }, true, "我的熟车") {
|
||||||
ToastUtils.showToast(mContext, "我的熟车")
|
ToastUtils.showToast(mContext, "我的熟车")
|
||||||
}
|
}
|
||||||
|
orderId = intent.extras?.getString(AppConfig.ID).toString()
|
||||||
binding.run {
|
binding.run {
|
||||||
recycler.run {
|
adapter = recycler.run {
|
||||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||||
addItemDecoration(
|
addItemDecoration(
|
||||||
RecycleViewDivider(
|
RecycleViewDivider(
|
||||||
@ -46,37 +57,101 @@ class ChoiceFleetActivity : BaseActivity<ActivityChoiceFleetCarBinding>() {
|
|||||||
Color.TRANSPARENT
|
Color.TRANSPARENT
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
adapter = DriverCarsAdapter()
|
adapter = DriverFleetAdapter()
|
||||||
adapter as DriverCarsAdapter
|
adapter as DriverFleetAdapter
|
||||||
}.apply {
|
}.apply {
|
||||||
isStateViewEnable = true
|
isStateViewEnable = true
|
||||||
|
|
||||||
|
addOnItemChildClickListener(R.id.cBox) { adapter, view, position ->
|
||||||
|
val captainBean = adapter.items[position]
|
||||||
|
adapter.items.find { it.isSelect }?.isSelect = false
|
||||||
|
adapter.items[position].isSelect = true
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
setOnItemClickListener { adapter, view, position ->
|
||||||
|
|
||||||
|
ActivityUtils.startActivity(mContext, ChoiceFleetCarActivity::class.java, intent.extras?.apply {
|
||||||
|
putString(AppConfig.CAPTAIN_ID, adapter.items[position].captainId)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
btnOk.setOnClickListener(OnLimitClickHelper(this@ChoiceFleetActivity))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(view: View?) {
|
||||||
|
super.onClick(view)
|
||||||
|
when (view?.id) {
|
||||||
|
R.id.btnOk -> {
|
||||||
|
dispatchVehicles()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun initDate() {
|
override fun initDate() {
|
||||||
DataManager.getInstance().getCaptainList()
|
DataManager.getInstance().getCaptainList()
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(BaseObserver(mContext,object :RxHttpCallBack<MutableList<CaptainBean>>(){
|
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<CaptainBean>>() {
|
||||||
override fun onSuccess(t: CommonResponseBean<MutableList<CaptainBean>>) {
|
override fun onSuccess(t: CommonResponseBean<MutableList<CaptainBean>>) {
|
||||||
super.onSuccess(t)
|
super.onSuccess(t)
|
||||||
|
initList(t.data)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initList(rows: List<CarBean>) {
|
private fun initList(rows: List<CaptainBean>) {
|
||||||
// if (rows.isEmpty()) {
|
if (rows.isEmpty()) {
|
||||||
// adapter.submitList(null)
|
adapter.submitList(null)
|
||||||
// adapter.setStateViewLayout(mContext, R.layout.empty_view)
|
adapter.setStateViewLayout(mContext, R.layout.empty_view)
|
||||||
// } else {
|
} else {
|
||||||
// if (mRefreshPage === 1) {
|
if (mRefreshPage === 1) {
|
||||||
// adapter?.submitList(rows)
|
adapter?.submitList(rows)
|
||||||
// } else {
|
} else {
|
||||||
// adapter?.addAll(rows)
|
adapter?.addAll(rows)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配车辆
|
||||||
|
*/
|
||||||
|
private fun dispatchVehicles() {
|
||||||
|
if (orderId.isEmpty())
|
||||||
|
return
|
||||||
|
|
||||||
|
val captainBean = adapter.items.find { it.isSelect }
|
||||||
|
if (captainBean == null) {
|
||||||
|
ToastUtils.showToast(mContext, "请选择车队")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
DataManager.getInstance().dispatchVehicles(
|
||||||
|
DispatchBean(
|
||||||
|
orderId,
|
||||||
|
adapter.items.find { it.isSelect }?.captainId.toString(),
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
||||||
|
override fun onSuccess(t: CommonResponseBean<Any>) {
|
||||||
|
super.onSuccess(t)
|
||||||
|
showToast(t.msg)
|
||||||
|
// 设置返回结果
|
||||||
|
setResult(AppCompatActivity.RESULT_OK, Intent())
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,160 @@
|
|||||||
|
package com.dhsd.glowner.ui.mine.activity
|
||||||
|
|
||||||
|
import BaseObserver
|
||||||
|
import DataManager
|
||||||
|
import RxHttpCallBack
|
||||||
|
import android.content.Intent
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
|
import com.dahe.gldriver.base.AppConfig
|
||||||
|
import com.dahe.glex.bean.DispatchBean
|
||||||
|
import com.dahe.mylibrary.base.BaseActivity
|
||||||
|
import com.dahe.mylibrary.net.CommonResponseBean
|
||||||
|
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||||
|
import com.dahe.mylibrary.utils.ActivityUtils
|
||||||
|
import com.dahe.mylibrary.utils.ConvertUtils
|
||||||
|
import com.dahe.mylibrary.utils.ToastUtils
|
||||||
|
import com.dhsd.glowner.R
|
||||||
|
import com.dhsd.glowner.adapter.DriverCarsAdapter
|
||||||
|
import com.dhsd.glowner.adapter.DriverFleetCarAdapter
|
||||||
|
import com.dhsd.glowner.adapter.popadapter.DriverFleetAdapter
|
||||||
|
import com.dhsd.glowner.bean.CaptainBean
|
||||||
|
import com.dhsd.glowner.bean.CarBean
|
||||||
|
import com.dhsd.glowner.bean.HomeEvent
|
||||||
|
import com.dhsd.glowner.databinding.ActivityChoiceFleetCarBinding
|
||||||
|
import com.dhsd.glowner.ui.HomeActivity
|
||||||
|
import com.dhsd.glowner.utils.OnLimitClickHelper
|
||||||
|
import com.dhsd.glowner.utils.OnLimitClickListener
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.rxjava3.core.Scheduler
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ChoiceFleetActivity
|
||||||
|
* @Author john
|
||||||
|
* @Date 2024/10/24 16:02
|
||||||
|
* @Description 选择车队->车辆
|
||||||
|
*/
|
||||||
|
class ChoiceFleetCarActivity : BaseActivity<ActivityChoiceFleetCarBinding>(), OnLimitClickListener {
|
||||||
|
lateinit var adapter: DriverFleetCarAdapter
|
||||||
|
private var orderId: String = ""
|
||||||
|
private var captainId: String = ""
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
setStatusBarColor(R.color.white)
|
||||||
|
setTitleBar("选择车队/车辆", View.OnClickListener { finish() }, true, "我的熟车") {
|
||||||
|
ToastUtils.showToast(mContext, "我的熟车")
|
||||||
|
}
|
||||||
|
|
||||||
|
intent.extras?.let {
|
||||||
|
orderId = it.getString(AppConfig.ID).toString()
|
||||||
|
captainId = it.getString(AppConfig.CAPTAIN_ID).toString()
|
||||||
|
}
|
||||||
|
binding.run {
|
||||||
|
adapter = recycler.run {
|
||||||
|
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||||
|
addItemDecoration(
|
||||||
|
RecycleViewDivider(
|
||||||
|
LinearLayout.VERTICAL,
|
||||||
|
ConvertUtils.dp2px(12.0f),
|
||||||
|
Color.TRANSPARENT
|
||||||
|
)
|
||||||
|
)
|
||||||
|
adapter = DriverFleetCarAdapter()
|
||||||
|
adapter as DriverFleetCarAdapter
|
||||||
|
}.apply {
|
||||||
|
isStateViewEnable = true
|
||||||
|
|
||||||
|
setOnItemClickListener { adapter, view, position ->
|
||||||
|
adapter.items.find { it.isSelect }?.isSelect = false
|
||||||
|
adapter.getItem(position)?.isSelect = true
|
||||||
|
// selectCar = adapter.getItem(position)
|
||||||
|
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
btnOk.setOnClickListener(OnLimitClickHelper(this@ChoiceFleetCarActivity))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(view: View?) {
|
||||||
|
super.onClick(view)
|
||||||
|
when (view?.id) {
|
||||||
|
R.id.btnOk -> {
|
||||||
|
dispatchVehicles()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun initDate() {
|
||||||
|
DataManager.getInstance().driverAndCarList(captainId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<CarBean>>() {
|
||||||
|
override fun onSuccess(t: CommonResponseBean<MutableList<CarBean>>) {
|
||||||
|
super.onSuccess(t)
|
||||||
|
initList(t.data)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initList(rows: List<CarBean>) {
|
||||||
|
if (rows.isEmpty()) {
|
||||||
|
adapter.submitList(null)
|
||||||
|
adapter.setStateViewLayout(mContext, R.layout.empty_view)
|
||||||
|
} else {
|
||||||
|
if (mRefreshPage === 1) {
|
||||||
|
adapter?.submitList(rows)
|
||||||
|
} else {
|
||||||
|
adapter?.addAll(rows)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配车辆
|
||||||
|
*/
|
||||||
|
private fun dispatchVehicles() {
|
||||||
|
if (orderId.isEmpty())
|
||||||
|
return
|
||||||
|
|
||||||
|
val captainBean = adapter.items.find { it.isSelect }
|
||||||
|
if (captainBean == null) {
|
||||||
|
ToastUtils.showToast(mContext, "请选择车辆")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DataManager.getInstance().dispatchVehicles(
|
||||||
|
DispatchBean(
|
||||||
|
orderId,
|
||||||
|
captainId,
|
||||||
|
captainBean.driverId,
|
||||||
|
captainBean.carId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
||||||
|
override fun onSuccess(t: CommonResponseBean<Any>) {
|
||||||
|
super.onSuccess(t)
|
||||||
|
showToast(t.msg)
|
||||||
|
ActivityUtils.finishToActivity(HomeActivity::class.java, false)
|
||||||
|
EventBus.getDefault().post(HomeEvent(true))
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
8
app/src/main/res/drawable/shape_orange_4.xml
Normal file
8
app/src/main/res/drawable/shape_orange_4.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#FFFFFAF0" />
|
||||||
|
<corners
|
||||||
|
android:radius="@dimen/dp_4" />
|
||||||
|
|
||||||
|
</shape>
|
@ -9,44 +9,7 @@
|
|||||||
|
|
||||||
<include layout="@layout/common_toolbar"></include>
|
<include layout="@layout/common_toolbar"></include>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:paddingLeft="@dimen/dp_15"
|
|
||||||
android:paddingTop="@dimen/dp_8"
|
|
||||||
android:paddingRight="@dimen/dp_15"
|
|
||||||
android:paddingBottom="@dimen/dp_8">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_40"
|
|
||||||
|
|
||||||
android:background="@drawable/shape_gray_bg20"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="@dimen/dp_16"
|
|
||||||
android:layout_height="@dimen/dp_16"
|
|
||||||
android:layout_marginLeft="@dimen/dp_10"
|
|
||||||
android:background="@drawable/search_icon_white"></ImageView>
|
|
||||||
|
|
||||||
<AutoCompleteTextView
|
|
||||||
android:id="@+id/etInput"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginLeft="@dimen/dp_6"
|
|
||||||
android:background="#00000000"
|
|
||||||
android:hint="请输入车队名称,车队长/司机姓名,手机号或车牌号"
|
|
||||||
android:inputType="text|textAutoComplete"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler"
|
android:id="@+id/recycler"
|
||||||
|
77
app/src/main/res/layout/item_driver_fleet.xml
Normal file
77
app/src/main/res/layout/item_driver_fleet.xml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout 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"
|
||||||
|
android:background="@drawable/shape_bg8"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="@dimen/dp_8"
|
||||||
|
android:paddingTop="@dimen/dp_12"
|
||||||
|
android:paddingRight="@dimen/dp_8"
|
||||||
|
android:paddingBottom="@dimen/dp_12">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivHead"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/head_defaut" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_toRightOf="@+id/ivHead"
|
||||||
|
android:text="王师傅的车队"
|
||||||
|
android:maxLength="10"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@+id/ivHead"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_toRightOf="@+id/ivHead"
|
||||||
|
android:textColor="@color/color_9"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
tools:text="john" />
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/vLine"
|
||||||
|
android:layout_width="@dimen/dp_1"
|
||||||
|
android:layout_height="@dimen/dp_10"
|
||||||
|
android:layout_alignBottom="@+id/tvName"
|
||||||
|
android:layout_marginLeft="@dimen/dp_10"
|
||||||
|
android:layout_marginBottom="@dimen/dp_2"
|
||||||
|
android:layout_toRightOf="@+id/tvName"
|
||||||
|
android:background="@color/color_c" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvPhone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@+id/ivHead"
|
||||||
|
android:layout_marginLeft="@dimen/dp_22"
|
||||||
|
android:layout_toRightOf="@+id/tvName"
|
||||||
|
android:textColor="@color/color_9"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
tools:text="15836200025" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cBox"
|
||||||
|
android:layout_width="@dimen/dp_30"
|
||||||
|
android:layout_height="@dimen/dp_30"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:button="@null"
|
||||||
|
android:drawableStart="@drawable/select_read"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
97
app/src/main/res/layout/item_driver_fleet_car.xml
Normal file
97
app/src/main/res/layout/item_driver_fleet_car.xml
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?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:id="@+id/cdContent"
|
||||||
|
android:clickable="true"
|
||||||
|
app:cardCornerRadius="@dimen/dp_8"
|
||||||
|
android:layout_marginLeft="@dimen/dp_15"
|
||||||
|
android:layout_marginRight="@dimen/dp_15"
|
||||||
|
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_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
|
android:id="@+id/tvCarLen"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="16米"
|
||||||
|
android:textColor="@color/color_9"
|
||||||
|
android:textSize="@dimen/sp_12" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
@ -86,7 +86,10 @@ dependencies {
|
|||||||
api 'pub.devrel:easypermissions:3.0.0'
|
api 'pub.devrel:easypermissions:3.0.0'
|
||||||
api 'io.github.lucksiege:compress:v3.11.2'
|
api 'io.github.lucksiege:compress:v3.11.2'
|
||||||
api 'androidx.cardview:cardview:1.0.0'
|
api 'androidx.cardview:cardview:1.0.0'
|
||||||
|
|
||||||
|
|
||||||
api "com.github.pokercc:ExpandableRecyclerView:0.9.3"
|
api "com.github.pokercc:ExpandableRecyclerView:0.9.3"
|
||||||
|
api 'org.greenrobot:eventbus:3.1.1'
|
||||||
|
|
||||||
|
|
||||||
api rootProject.ext.dependencies["WheelPicker"]
|
api rootProject.ext.dependencies["WheelPicker"]
|
||||||
|
Loading…
Reference in New Issue
Block a user