常用货物
This commit is contained in:
parent
5a895fe5af
commit
4adbd239e7
@ -79,6 +79,7 @@
|
||||
android:value="203d8b896f30ce1e7dd55d7c4a62c362" />
|
||||
|
||||
<service android:name="com.amap.api.location.APSService"></service>
|
||||
|
||||
<activity
|
||||
android:name=".ui.LauncherActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
@ -126,6 +127,11 @@
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.GoodsListActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.home.activtiy.CarTypeActivity"
|
||||
|
34
app/src/main/java/com/dhsd/glowner/adapter/GoodsAdapter.kt
Normal file
34
app/src/main/java/com/dhsd/glowner/adapter/GoodsAdapter.kt
Normal file
@ -0,0 +1,34 @@
|
||||
package com.dhsd.glowner.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.dhsd.glowner.R
|
||||
import com.dhsd.glowner.bean.GoodBean
|
||||
|
||||
/**
|
||||
* @ClassName GoodsAdapter
|
||||
* @Author john
|
||||
* @Date 2024/11/1 16:47
|
||||
* @Description TODO
|
||||
*/
|
||||
class GoodsAdapter : BaseQuickAdapter<GoodBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: GoodBean?) {
|
||||
item?.let {
|
||||
holder.run {
|
||||
setText(R.id.tvAddress, it.goodName)
|
||||
setText(R.id.tvName, it.goodsPropertyTypeCode)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
context: Context,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): QuickViewHolder {
|
||||
return QuickViewHolder(R.layout.item_good,parent)
|
||||
}
|
||||
}
|
17
app/src/main/java/com/dhsd/glowner/bean/GoodBean.kt
Normal file
17
app/src/main/java/com/dhsd/glowner/bean/GoodBean.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package com.dhsd.glowner.bean
|
||||
|
||||
data class GoodBean(
|
||||
val cargoTypeClassificationCode: String,
|
||||
val commonGoodsId: Int,
|
||||
val createBy: String,
|
||||
val createTime: String,
|
||||
val goodName: String,
|
||||
val goodsPropertyTypeCode: String,
|
||||
val isDeleted: String,
|
||||
val packName: String,
|
||||
val remark: String,
|
||||
val shipperId: Int,
|
||||
val sortValue: String,
|
||||
val updateBy: String,
|
||||
val updateTime: String
|
||||
)
|
@ -5,6 +5,7 @@ import com.dhsd.glowner.bean.AddressBean
|
||||
import com.dhsd.glowner.bean.CaptainBean
|
||||
import com.dhsd.glowner.bean.CarBean
|
||||
import com.dhsd.glowner.bean.DictBean
|
||||
import com.dhsd.glowner.bean.GoodBean
|
||||
import com.dhsd.glowner.bean.GoodTypeBean
|
||||
import com.dhsd.glowner.bean.LoginBean
|
||||
import com.dhsd.glowner.bean.PostAddressBean
|
||||
@ -131,6 +132,14 @@ interface Api {
|
||||
fun deleteAddress(@Path("addressIds") addressIds: String): Observable<CommonResponseBean<Any>>
|
||||
|
||||
|
||||
/**
|
||||
* 获取货主常用货物类型列表
|
||||
* @return Observable<CommonResponseBean<MutableList<DictBean>>>
|
||||
*/
|
||||
@GET(BASE_URL + "devApi//business/shipper/common/goods/list")
|
||||
fun getGoodsList(): Observable<CommonResponseBean<OrderListBean<GoodBean>>>
|
||||
|
||||
|
||||
/**
|
||||
* 获取地址列表
|
||||
* @return Observable<CommonResponseBean<OrderListBean<AddressBean>>>
|
||||
|
@ -0,0 +1,80 @@
|
||||
package com.dhsd.glowner.ui.home.activtiy
|
||||
|
||||
import BaseObserver
|
||||
import DataManager
|
||||
import RxHttpCallBack
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.dahe.glex.bean.OrderListBean
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.callback.RefreshCallBack
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import com.dhsd.glowner.R
|
||||
import com.dhsd.glowner.adapter.GoodsAdapter
|
||||
import com.dhsd.glowner.bean.AddressBean
|
||||
import com.dhsd.glowner.bean.GoodBean
|
||||
import com.dhsd.glowner.databinding.ActivityGoodsListBinding
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* @ClassName GoodsListActivity
|
||||
* @Author john
|
||||
* @Date 2024/11/1 16:36
|
||||
* @Description 常用货物
|
||||
*/
|
||||
class GoodsListActivity : BaseActivity<ActivityGoodsListBinding>(), RefreshCallBack {
|
||||
lateinit var adapter: GoodsAdapter
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("货物列表",true)
|
||||
binding.run {
|
||||
setRefresh(smartRefresh,this@GoodsListActivity)
|
||||
adapter = recycler.run {
|
||||
layoutManager = LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)
|
||||
addItemDecoration(RecycleViewDivider(LinearLayout.VERTICAL, ConvertUtils.dp2px(10.0f), Color.TRANSPARENT))
|
||||
adapter = GoodsAdapter()
|
||||
adapter as GoodsAdapter
|
||||
}.apply {
|
||||
isStateViewEnable = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
DataManager.getInstance().getGoodsList()
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<OrderListBean<GoodBean>>(){
|
||||
override fun onSuccess(t: CommonResponseBean<OrderListBean<GoodBean>>) {
|
||||
super.onSuccess(t)
|
||||
initList(t.data.rows)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
override fun getRefreshDate(stat: Int, page: Int, count: Int) {
|
||||
if (stat == 2){
|
||||
binding.smartRefresh.finishLoadMoreWithNoMoreData()
|
||||
return
|
||||
}
|
||||
initDate()
|
||||
}
|
||||
|
||||
private fun initList(rows: List<GoodBean>) {
|
||||
if (rows.isEmpty()) {
|
||||
adapter.submitList(null)
|
||||
adapter.setStateViewLayout(mContext, R.layout.empty_view)
|
||||
} else {
|
||||
if (mRefreshPage === 1) {
|
||||
adapter?.submitList(rows)
|
||||
} else {
|
||||
adapter?.addAll(rows)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -62,13 +62,14 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(14.0f),
|
||||
ConvertUtils.dp2px(10.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = SendGoodsAdapter()
|
||||
adapter as SendGoodsAdapter
|
||||
}.apply {
|
||||
isStateViewEnable = true
|
||||
setOnItemClickListener { adapter, view, position ->
|
||||
ActivityUtils.startActivityForResult(
|
||||
this@SendGoodsActivity,
|
||||
|
48
app/src/main/res/layout/activity_goods_list.xml
Normal file
48
app/src/main/res/layout/activity_goods_list.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?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>
|
||||
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smartRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
<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>
|
77
app/src/main/res/layout/item_good.xml
Normal file
77
app/src/main/res/layout/item_good.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_6"
|
||||
android:background="@drawable/shape_white_8"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/dp_11">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:text="河南省郑州市金水区农业路经 三路东南角银丰商务A座"
|
||||
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_marginTop="@dimen/dp_4"
|
||||
android:maxLines="2"
|
||||
android:text="刘静 15424412450"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_6"
|
||||
android:paddingRight="@dimen/dp_6"
|
||||
android:text="删除"
|
||||
android:textColor="@color/main_red"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
<View
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:background="@color/color_c" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvEdit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_6"
|
||||
android:paddingRight="@dimen/dp_6"
|
||||
android:text="编辑"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user