选择车辆
This commit is contained in:
parent
8f1c7b93ce
commit
33e89003ca
@ -54,14 +54,14 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:theme="@style/Theme.GLOwner"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="31">
|
||||
|
||||
|
||||
<meta-data
|
||||
android:name="CHANNEL"
|
||||
android:value="${CHANNEL_VALUE}" />
|
||||
<meta-data
|
||||
android:name="CHANNEL"
|
||||
android:value="${CHANNEL_VALUE}" />
|
||||
|
||||
<!-- 适配全面屏 Android O vivo&oppo -->
|
||||
<meta-data
|
||||
@ -106,7 +106,6 @@
|
||||
<activity
|
||||
android:name=".ui.account.LoginActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
@ -114,40 +113,34 @@
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.SendGoodsActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.AddressEditActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.GoodsInfoActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.CarTypeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.SendSuccActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.waybill.activity.SourceDetailActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
@ -157,6 +150,12 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.mine.activity.ChoiceCarActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,54 @@
|
||||
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 DriverCarsAdapter() :
|
||||
BaseQuickAdapter<CarBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CarBean?) {
|
||||
holder.run {
|
||||
if (item != null) {
|
||||
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.tvCarType, item?.vehicleType)
|
||||
setText(R.id.tvDriverName, item?.contactName)
|
||||
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)
|
||||
}
|
||||
}
|
41
app/src/main/java/com/dhsd/glowner/bean/CarBean.kt
Normal file
41
app/src/main/java/com/dhsd/glowner/bean/CarBean.kt
Normal file
@ -0,0 +1,41 @@
|
||||
package com.dhsd.glowner.bean
|
||||
|
||||
/**
|
||||
* @ClassName CarBean
|
||||
* @Author john
|
||||
* @Date 2024/10/24 10:46
|
||||
* @Description TODO
|
||||
*/
|
||||
data class CarBean(
|
||||
val approvedLoad: String="",
|
||||
val tractionWeight: String="",
|
||||
val carHeight: String="",
|
||||
var carId: String="",
|
||||
var driverId: String="",
|
||||
var roadLicenseValidityOverdue: String="",
|
||||
var licenseValidityOverdue: String="",
|
||||
val carLong: String="",
|
||||
val carUrl: String="",
|
||||
val carWidth: String="",
|
||||
val energySign: String="",
|
||||
val energySignCode: String="",
|
||||
val isTrailer: String="",
|
||||
val plateColor: String="",
|
||||
val plateColorCode: String="",
|
||||
val trailerApprovedLoad: String="",
|
||||
val trailerHeight: String="",
|
||||
val trailerId: String="",
|
||||
val trailerLong: String="",
|
||||
val trailerUrl: String="",
|
||||
val trailerVehicleNum: String="",
|
||||
val trailerVehicleType: String="",
|
||||
val trailerVehicleTypeCode: String="",
|
||||
var vehicleNum: String="",
|
||||
val vehicleType: String="",
|
||||
val contactName: String="",
|
||||
val vehicleTypeCode: String="",
|
||||
val idcardName: String="",
|
||||
val contactPhone: String="",
|
||||
val avatar: String="",
|
||||
var isSelect: Boolean = false
|
||||
)
|
@ -7,8 +7,8 @@ package com.dahe.glex.bean
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
data class OrderListBean(
|
||||
var rows: List<OrderBean>
|
||||
data class OrderListBean<T>(
|
||||
var rows: List<T>
|
||||
)
|
||||
|
||||
data class TextOrder(val orderId: String)
|
||||
@ -110,3 +110,10 @@ data class OrderBean(
|
||||
val vehicleLength: String,
|
||||
val vehicleType: String
|
||||
)
|
||||
|
||||
data class DispatchBean(
|
||||
var orderId: String,
|
||||
var shipperCaptainId: String = "",
|
||||
var shipperDriverId: String,
|
||||
var shipperCarId: String
|
||||
)
|
||||
|
@ -48,6 +48,8 @@ class PopBottomCar(
|
||||
// isSelect = true
|
||||
// currCar = this
|
||||
// }
|
||||
|
||||
currCar = cars.find { it.isSelect }
|
||||
initRecycle(recycler)
|
||||
btnOk.setOnClickListener {
|
||||
if (currCar == null) {
|
||||
|
@ -1,13 +1,14 @@
|
||||
|
||||
import com.dahe.glex.bean.*
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dhsd.glowner.BuildConfig
|
||||
import com.dhsd.glowner.bean.CarBean
|
||||
import com.dhsd.glowner.bean.LoginBean
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.PUT
|
||||
import retrofit2.http.Query
|
||||
|
||||
|
||||
/**
|
||||
@ -28,6 +29,7 @@ interface Api {
|
||||
|
||||
companion object {
|
||||
const val BASE_URL = BuildConfig.BASE_URL
|
||||
|
||||
//获取版本
|
||||
const val VERSION = BASE_URL + "app/version"
|
||||
}
|
||||
@ -37,21 +39,37 @@ interface Api {
|
||||
* 是否需要验证码登录
|
||||
* @return Observable<CommonResponseBean<CodeBean>>
|
||||
*/
|
||||
@GET(BASE_URL+"devApi/code")
|
||||
@GET(BASE_URL + "devApi/code")
|
||||
fun getCode(): Observable<CommonResponseBean<CodeBean>>
|
||||
|
||||
/**
|
||||
* 是否需要验证码登录
|
||||
* @return Observable<CommonResponseBean<CodeBean>>
|
||||
*/
|
||||
@POST(BASE_URL+"devApi/auth/login")
|
||||
@POST(BASE_URL + "devApi/auth/login")
|
||||
fun login(@Body bean: LoginBean): Observable<CommonResponseBean<UserBean>>
|
||||
|
||||
@GET(BASE_URL+"devApi/business/shipper/order/list")
|
||||
fun getOrderList(): Observable<CommonResponseBean<OrderListBean>>
|
||||
@GET(BASE_URL + "devApi/business/shipper/order/list")
|
||||
fun getOrderList(): Observable<CommonResponseBean<OrderListBean<OrderBean>>>
|
||||
|
||||
@PUT(BASE_URL+"devApi/business/shipper/order/cancelSourceOfOrder")
|
||||
@PUT(BASE_URL + "devApi/business/shipper/order/cancelSourceOfOrder")
|
||||
fun cancelSourceOfOrder(@Body bean: TextOrder): Observable<CommonResponseBean<Any>>
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆信息列表
|
||||
*/
|
||||
@GET(BASE_URL + "devApi/business/ft/common/dict/driver/all")
|
||||
fun getCarList(@Query("searchValue") searchValue: String): Observable<CommonResponseBean<MutableList<CarBean>>>
|
||||
|
||||
|
||||
/**
|
||||
* 货主指派车辆
|
||||
* @param bean DispatchBean
|
||||
* @return Observable<CommonResponseBean<Any>>
|
||||
*/
|
||||
@POST(BASE_URL+"devApi/business/shipper/order/dispatchVehicles")
|
||||
fun dispatchVehicles(@Body bean: DispatchBean): Observable<CommonResponseBean<Any>>
|
||||
|
||||
|
||||
}
|
@ -3,11 +3,18 @@ package com.dhsd.glowner.ui.home
|
||||
import BaseObserver
|
||||
import DataManager
|
||||
import RxHttpCallBack
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import androidx.activity.result.ActivityResultRegistry
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
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.OrderBean
|
||||
import com.dahe.glex.bean.OrderListBean
|
||||
import com.dahe.glex.bean.TextOrder
|
||||
@ -25,6 +32,7 @@ import com.dhsd.glowner.bean.PopBean
|
||||
import com.dhsd.glowner.cuspop.OnCarSelectListener
|
||||
import com.dhsd.glowner.databinding.FragmentHomeBinding
|
||||
import com.dhsd.glowner.ui.home.activtiy.SendGoodsActivity
|
||||
import com.dhsd.glowner.ui.mine.activity.ChoiceCarActivity
|
||||
import com.dhsd.glowner.utils.CommonPopUtils
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
@ -36,6 +44,15 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
* @Description TODO
|
||||
*/
|
||||
class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
|
||||
private val launcher =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
if (result.resultCode == AppCompatActivity.RESULT_OK) {
|
||||
initData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lateinit var adapter: WaybillAdapter
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
@ -49,11 +66,11 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
binding.tvMar.isSelected = true
|
||||
|
||||
binding.ivNor.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,SendGoodsActivity::class.java)
|
||||
ActivityUtils.startActivity(mContext, SendGoodsActivity::class.java)
|
||||
}
|
||||
|
||||
binding.ivNor.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,SendGoodsActivity::class.java)
|
||||
ActivityUtils.startActivity(mContext, SendGoodsActivity::class.java)
|
||||
}
|
||||
initData()
|
||||
|
||||
@ -66,16 +83,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
|
||||
private fun initRecy() {
|
||||
setRefresh(binding.refresh, this)
|
||||
var datas = mutableListOf<WayBillBean>(
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean()
|
||||
)
|
||||
adapter = binding.recyclerView.run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
setHasFixedSize(true)
|
||||
@ -92,20 +99,26 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
setOnItemClickListener { _, _, position ->
|
||||
ToastUtils.showToast(mContext, position.toString())
|
||||
}
|
||||
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
||||
addOnItemChildClickListener(R.id.btnOk) { adapter, _, position ->
|
||||
// ActivityUtils.startActivity(mContext, WaybillDetailActivity::class.java)
|
||||
CommonPopUtils.getInstance().showCarList(mContext
|
||||
val item = adapter.getItem(position)
|
||||
CommonPopUtils.getInstance().showCarList(
|
||||
mContext
|
||||
) { _, position ->
|
||||
|
||||
showToast(position.toString())
|
||||
if (position === 0) {
|
||||
launcher.launch(Intent(mContext, ChoiceCarActivity::class.java).apply {
|
||||
putExtras(Bundle().apply { putString(AppConfig.ID, item?.orderId) })
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addOnItemChildClickListener(R.id.btnCancel) { adapter, view, position ->
|
||||
val item = adapter.getItem(position) as OrderBean
|
||||
DataManager.getInstance().cancelSourceOfOrder(TextOrder(item.orderId)).subscribeOn(Schedulers.io())
|
||||
DataManager.getInstance().cancelSourceOfOrder(TextOrder(item.orderId))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<Any>(){
|
||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
||||
super.onSuccess(t)
|
||||
showToast(t.msg)
|
||||
@ -121,23 +134,27 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
DataManager.getInstance().getOrderList()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext,object :RxHttpCallBack<OrderListBean>(binding.refresh){
|
||||
override fun onSuccess(t: CommonResponseBean<OrderListBean>) {
|
||||
super.onSuccess(t)
|
||||
initList(t.data.rows)
|
||||
}
|
||||
.subscribe(
|
||||
BaseObserver(mContext,
|
||||
object : RxHttpCallBack<OrderListBean<OrderBean>>(binding.refresh) {
|
||||
override fun onSuccess(t: CommonResponseBean<OrderListBean<OrderBean>>) {
|
||||
super.onSuccess(t)
|
||||
initList(t.data.rows)
|
||||
}
|
||||
|
||||
}))
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun initList(rows: List<OrderBean>) {
|
||||
if (rows.isEmpty()){
|
||||
if (rows.isEmpty()) {
|
||||
adapter.submitList(null)
|
||||
adapter.setStateViewLayout(mContext, R.layout.empty_view)
|
||||
}else{
|
||||
if (mRefreshPage===1){
|
||||
} else {
|
||||
if (mRefreshPage === 1) {
|
||||
adapter?.submitList(rows)
|
||||
}else{
|
||||
} else {
|
||||
adapter?.addAll(rows)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,169 @@
|
||||
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.AdapterView.OnItemClickListener
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
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.glex.bean.OrderBean
|
||||
import com.dahe.glex.bean.OrderListBean
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
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.bean.CarBean
|
||||
import com.dhsd.glowner.databinding.ActivityChoiceCarBinding
|
||||
import com.dhsd.glowner.utils.OnLimitClickHelper
|
||||
import com.dhsd.glowner.utils.OnLimitClickListener
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* @ClassName ChoiceCarActivity
|
||||
* @Author john
|
||||
* @Date 2024/10/24 10:17
|
||||
* @Description 选择车辆
|
||||
*/
|
||||
class ChoiceCarActivity : BaseActivity<ActivityChoiceCarBinding>(), OnLimitClickListener {
|
||||
|
||||
lateinit var adapter: DriverCarsAdapter
|
||||
var searchValue: String = ""
|
||||
private var orderId: String = ""
|
||||
private var selectCar: CarBean? = null
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("选择车辆", View.OnClickListener { finish() }, true, "我的熟车") {
|
||||
ToastUtils.showToast(mContext, "查看单据")
|
||||
}
|
||||
|
||||
orderId = intent.extras?.getString(AppConfig.ID).toString()
|
||||
binding.recycler.run {
|
||||
|
||||
this@ChoiceCarActivity.adapter = run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(12.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = DriverCarsAdapter()
|
||||
adapter as DriverCarsAdapter
|
||||
}.apply {
|
||||
isStateViewEnable = true
|
||||
submitList(null)
|
||||
setStateViewLayout(mContext, R.layout.empty_view)
|
||||
setOnItemClickListener { adapter, _, position ->
|
||||
adapter.items.find { it.isSelect }?.isSelect = false
|
||||
adapter.getItem(position)?.isSelect = true
|
||||
selectCar = adapter.getItem(position)
|
||||
|
||||
notifyDataSetChanged()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.etInput.addTextChangedListener {
|
||||
val text = it.toString()
|
||||
if (text.isNotEmpty()) {
|
||||
searchValue = text
|
||||
getCarList()
|
||||
} else {
|
||||
searchValue = ""
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnOk.setOnClickListener(OnLimitClickHelper(this))
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
|
||||
}
|
||||
|
||||
override fun onClick(view: View?) {
|
||||
super.onClick(view)
|
||||
when (view?.id) {
|
||||
binding.btnOk.id -> {
|
||||
dispatchVehicles()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCarList() {
|
||||
DataManager.getInstance().getCarList(searchValue)
|
||||
.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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (selectCar == null) {
|
||||
showToast("请选择车辆")
|
||||
return
|
||||
}
|
||||
DataManager.getInstance().dispatchVehicles(
|
||||
DispatchBean(
|
||||
orderId,
|
||||
"",
|
||||
selectCar?.driverId.toString(),
|
||||
selectCar?.carId.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,21 @@
|
||||
package com.dhsd.glowner.ui.mine.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dhsd.glowner.databinding.ActivityChoiceFleetCarBinding
|
||||
|
||||
/**
|
||||
* @ClassName ChoiceFleetActivity
|
||||
* @Author john
|
||||
* @Date 2024/10/24 16:02
|
||||
* @Description 选择车队/车辆
|
||||
*/
|
||||
class ChoiceFleetActivity : BaseActivity<ActivityChoiceFleetCarBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xxhdpi/search_icon_white.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/search_icon_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
7
app/src/main/res/drawable/select_choice_car_bg.xml
Normal file
7
app/src/main/res/drawable/select_choice_car_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/shape_white_8" android:state_selected="false"></item>
|
||||
<item android:drawable="@drawable/shape_discar_8" android:state_selected="true"></item>
|
||||
<item android:drawable="@drawable/shape_white_8"></item>
|
||||
</selector>
|
14
app/src/main/res/drawable/shape_discar_8.xml
Normal file
14
app/src/main/res/drawable/shape_discar_8.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#ffffffff" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#FFFFFF"
|
||||
android:endColor="#FFBEA4"
|
||||
/>
|
||||
|
||||
<corners
|
||||
android:radius="@dimen/dp_8"/>
|
||||
|
||||
</shape>
|
7
app/src/main/res/drawable/shape_gray_bg20.xml
Normal file
7
app/src/main/res/drawable/shape_gray_bg20.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/color_F3" />
|
||||
<corners
|
||||
android:radius="@dimen/dp_20" />
|
||||
</shape>
|
78
app/src/main/res/layout/activity_choice_car.xml
Normal file
78
app/src/main/res/layout/activity_choice_car.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<?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_F3"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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:text=""
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<LinearLayout
|
||||
android:id="@+id/llBtn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="确定"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_17">
|
||||
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
78
app/src/main/res/layout/activity_choice_fleet_car.xml
Normal file
78
app/src/main/res/layout/activity_choice_fleet_car.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<?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_F3"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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:text=""
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<LinearLayout
|
||||
android:id="@+id/llBtn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_btn"
|
||||
android:text="确定"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_17">
|
||||
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
136
app/src/main/res/layout/item_driver_cars.xml
Normal file
136
app/src/main/res/layout/item_driver_cars.xml
Normal file
@ -0,0 +1,136 @@
|
||||
<?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_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>
|
@ -185,7 +185,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
protected void setTitleBar(String title, View.OnClickListener listener, boolean isVisible, String right, View.OnClickListener rightListener) {
|
||||
mToolbar = (Toolbar) findViewById(R.id.common_toolbar);
|
||||
mToolbar.setBackgroundColor(Color.TRANSPARENT);
|
||||
mToolbar.setBackgroundColor(statusColor == -1 ? Color.TRANSPARENT : ContextCompat.getColor(mContext, statusColor));
|
||||
if (!TextUtils.isEmpty(title))
|
||||
((TextView) findViewById(R.id.common_toolBar_title)).setText(title);
|
||||
TextView mTextRight = (TextView) findViewById(R.id.common_toolBar_text_right);
|
||||
|
@ -25,15 +25,14 @@ public class RecycleViewDivider extends RecyclerView.ItemDecoration {
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
|
||||
/**
|
||||
*
|
||||
* 默认分割线:高度为2px,颜色为灰色
|
||||
* 获取属性值,
|
||||
*
|
||||
* @param context
|
||||
* @param orientation 列表方向
|
||||
* @param orientation 列表方向
|
||||
*/
|
||||
|
||||
public RecycleViewDivider(Context context, int orientation){
|
||||
public RecycleViewDivider(Context context, int orientation) {
|
||||
if (orientation != LinearLayoutManager.VERTICAL && orientation != LinearLayoutManager.HORIZONTAL) {
|
||||
throw new IllegalArgumentException("请输入正确的参数!");
|
||||
}
|
||||
@ -88,7 +87,11 @@ public class RecycleViewDivider extends RecyclerView.ItemDecoration {
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
|
||||
if (mOrientation == LinearLayoutManager.VERTICAL) {
|
||||
outRect.set(0, 0, 0, mDividerHeight);
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
outRect.set(0, mDividerHeight, 0, mDividerHeight);
|
||||
} else {
|
||||
outRect.set(0, 0, 0, mDividerHeight);
|
||||
}
|
||||
} else {
|
||||
outRect.set(0, 0, mDividerHeight, 0);
|
||||
}
|
||||
@ -97,10 +100,10 @@ public class RecycleViewDivider extends RecyclerView.ItemDecoration {
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
super.onDraw(c, parent, state);
|
||||
if(mOrientation==LinearLayoutManager.VERTICAL){
|
||||
drawVerticalLine(c,parent);
|
||||
}else{
|
||||
drawHorizontalLine(c,parent);
|
||||
if (mOrientation == LinearLayoutManager.VERTICAL) {
|
||||
drawVerticalLine(c, parent);
|
||||
} else {
|
||||
drawHorizontalLine(c, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +114,7 @@ public class RecycleViewDivider extends RecyclerView.ItemDecoration {
|
||||
final int bottom = parent.getMeasuredHeight() - parent.getPaddingBottom();
|
||||
final int childSize = parent.getChildCount();
|
||||
for (int i = 0; i < childSize - 1; i++) {
|
||||
if ((i+1) % 3 != 0) {
|
||||
if ((i + 1) % 3 != 0) {
|
||||
final View child = parent.getChildAt(i);
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
final int left = child.getRight() + layoutParams.rightMargin;
|
||||
@ -134,7 +137,7 @@ public class RecycleViewDivider extends RecyclerView.ItemDecoration {
|
||||
final int right = parent.getMeasuredWidth() - parent.getPaddingRight();
|
||||
final int childSize = parent.getChildCount();
|
||||
for (int i = 0; i < childSize; i++) {
|
||||
if (i < childSize -1) {
|
||||
if (i < childSize - 1) {
|
||||
final View child = parent.getChildAt(i);
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
final int top = child.getBottom() + layoutParams.bottomMargin;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
|
||||
<color name="color_F5">#F5F5F5</color>
|
||||
<color name="color_F3">#F3F3F5</color>
|
||||
<color name="color_E1">#E1E1E1</color>
|
||||
<color name="colorBlack0">#000000</color>
|
||||
<color name="color_line">#E6E6E6</color>
|
||||
|
Loading…
Reference in New Issue
Block a user