init: init proj
This commit is contained in:
@@ -0,0 +1,230 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjCangDanInfoItemModel
|
||||
import com.lukouguoji.module_base.common.String.isValidInt
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import java.util.*
|
||||
|
||||
class GjjCangDanInfoAdapter(val activity: Activity, private val collectList: MutableList<GjjCangDanInfoItemModel>) :
|
||||
RecyclerView.Adapter<GjjCangDanInfoAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val titleName: TextView = view.findViewById(R.id.titleName)
|
||||
val isMust: TextView = view.findViewById(R.id.isMust)
|
||||
val inputLayout: LinearLayout = view.findViewById(R.id.inputLayout)
|
||||
val inputContent: EditText = view.findViewById(R.id.inputContent)
|
||||
val inputContentPreView: View = view.findViewById(R.id.inputContentPreView)
|
||||
val inputContentPre: EditText = view.findViewById(R.id.inputContentPre)
|
||||
val selContent: TextView = view.findViewById(R.id.selContent)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_cang_dan_info_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
viewHolder.setIsRecyclable(false)
|
||||
|
||||
/* viewHolder.itemView.setOnClickListener {
|
||||
|
||||
var adapterPosition = viewHolder.adapterPosition
|
||||
if (adapterPosition < 0 || collectList.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
var gncFuBang = collectList[adapterPosition]
|
||||
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GOUT_FU_BANG_ACTIVITY).withString("userIdParam", gncFuBang.useId.toString())
|
||||
.navigation(activity, Constant.RequestCode.gnc_shouyun_list_refresh)
|
||||
|
||||
}
|
||||
*/
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
val must = collect.isMust
|
||||
val enable = collect.isEnable
|
||||
val titleName = collect.titleName
|
||||
val isSel = collect.isSel
|
||||
val inputContent = collect.inputContent
|
||||
val inputContentPre = collect.inputContentPre
|
||||
val selList = collect.selList
|
||||
val selContentCode = collect.selContentCode
|
||||
val selContentName = collect.selContentName
|
||||
|
||||
//是否必填
|
||||
if (must) {
|
||||
holder.isMust.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.isMust.visibility = View.GONE
|
||||
}
|
||||
holder.titleName.text = titleName
|
||||
//下拉框
|
||||
if (isSel) {
|
||||
holder.selContent.visibility = View.VISIBLE
|
||||
holder.inputLayout.visibility = View.GONE
|
||||
|
||||
var anyMatchCode = false
|
||||
selList?.forEach { sel ->
|
||||
var selObj = sel as JSONObject
|
||||
var name = selObj.getString("name")
|
||||
var code = selObj.getString("code")
|
||||
if (selContentCode == code) {
|
||||
anyMatchCode = true
|
||||
holder.selContent.text = name
|
||||
}
|
||||
}
|
||||
//没匹配到,渲染成selContentName
|
||||
if (!anyMatchCode) {
|
||||
holder.selContent.text = selContentName
|
||||
}
|
||||
|
||||
//是否允许
|
||||
holder.selContent.isEnabled = enable
|
||||
if (enable) {
|
||||
holder.selContent.setBackgroundResource(R.drawable.gjj_cang_dan_info_edit_shape)
|
||||
} else {
|
||||
holder.selContent.setBackgroundResource(R.drawable.gjj_cang_dan_info_edit_disable_shape)
|
||||
}
|
||||
//下拉框监听
|
||||
holder.selContent.setOnClickListener {
|
||||
Common.singleSelect(activity, titleName, selList!!, selContentCode) { _, item ->
|
||||
val jsonObject = item as JSONObject
|
||||
val code = jsonObject.getString("code")
|
||||
collect.selContentCode = code
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
//输入框
|
||||
else {
|
||||
//输入框1
|
||||
holder.selContent.visibility = View.GONE
|
||||
holder.inputContentPreView.visibility = View.GONE
|
||||
holder.inputContentPre.visibility = View.GONE
|
||||
holder.inputLayout.visibility = View.VISIBLE
|
||||
holder.inputContent.visibility = View.VISIBLE
|
||||
|
||||
//是否允许
|
||||
holder.inputContent.isEnabled = enable
|
||||
if (enable) {
|
||||
holder.inputContent.setBackgroundResource(R.drawable.gjj_cang_dan_info_edit_shape)
|
||||
} else {
|
||||
holder.inputContent.setBackgroundResource(R.drawable.gjj_cang_dan_info_edit_disable_shape)
|
||||
}
|
||||
holder.inputContent.setText(inputContent)
|
||||
holder.inputContent.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
collect.inputContent = s.toString()
|
||||
}
|
||||
})
|
||||
//如果是订单,监听输入事件
|
||||
if (collect.titleCode == "no") {
|
||||
//失去焦点
|
||||
holder.inputContent.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
if (hasFocus) {
|
||||
|
||||
} else {
|
||||
val editText = v as EditText
|
||||
//失去焦点
|
||||
if (editText.text.toString().length != 8 || !editText.text.toString().isValidInt()) {
|
||||
Common.showToast(activity, "请输入正确的运单号格式!")
|
||||
return@OnFocusChangeListener
|
||||
}
|
||||
val subSequence = editText.text.toString().subSequence(0, 7).toString().toInt()
|
||||
val subSequence2 = editText.text.toString()[7].toString().toInt()
|
||||
if (subSequence % 7 != subSequence2) {
|
||||
Common.showToast(activity, "请输入正确的运单号格式!")
|
||||
return@OnFocusChangeListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果是始发港或者目的港,监听输入事件 只能输入大写字母
|
||||
if (collect.titleCode == "origin" || collect.titleCode == "dest") {
|
||||
//失去焦点
|
||||
holder.inputContent.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(editable: Editable?) {
|
||||
val originText = editable.toString()
|
||||
if (originText != null && originText != "") {
|
||||
val regularExpression = "(^([A-Z]+)$)"
|
||||
val matches = originText.matches(regularExpression.toRegex())
|
||||
if(!matches){
|
||||
val regularExpression2 = "([^A-Za-z]+)"
|
||||
val replaceStr = originText.replace(regularExpression2.toRegex(),"")
|
||||
val replaceStrToUpper = replaceStr.uppercase(Locale.ROOT)//小写转大写
|
||||
holder.inputContent.setText(replaceStrToUpper)
|
||||
holder.inputContent.setSelection(replaceStrToUpper.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//输入框2
|
||||
if (collect.titleCodePre != null && collect.inputContentPre != null) {
|
||||
holder.inputContentPreView.visibility = View.VISIBLE
|
||||
holder.inputContentPre.visibility = View.VISIBLE
|
||||
|
||||
//是否允许
|
||||
holder.inputContentPre.isEnabled = enable
|
||||
if (enable) {
|
||||
holder.inputContentPre.setBackgroundResource(R.drawable.gjj_cang_dan_info_edit_shape)
|
||||
} else {
|
||||
holder.inputContentPre.setBackgroundResource(R.drawable.gjj_cang_dan_info_edit_disable_shape)
|
||||
}
|
||||
holder.inputContentPre.setText(inputContentPre)
|
||||
holder.inputContentPre.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
collect.inputContentPre = s.toString()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
fun append(gjjCangDanInfoItemModel: GjjCangDanInfoItemModel) {
|
||||
collectList.add(gjjCangDanInfoItemModel)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjCangDanListModel
|
||||
import com.lukouguoji.gjj.viewModel.GjjCangDanListViewModel
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
|
||||
class GjjCangDanListAdapter(
|
||||
val activity: Activity,
|
||||
private val viewModel: GjjCangDanListViewModel,
|
||||
private val collectList: MutableList<GjjCangDanListModel>
|
||||
) :
|
||||
RecyclerView.Adapter<GjjCangDanListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val leftIcon: ImageView = view.findViewById(R.id.leftIcon)
|
||||
val wbNo: TextView = view.findViewById(R.id.wbNo)
|
||||
val goods: TextView = view.findViewById(R.id.goods)
|
||||
val awbType: TextView = view.findViewById(R.id.awbType)
|
||||
val startPort: TextView = view.findViewById(R.id.startPort)
|
||||
val destPort: TextView = view.findViewById(R.id.destPort)
|
||||
|
||||
val agentCode: TextView = view.findViewById(R.id.agentCode)
|
||||
val spCode: TextView = view.findViewById(R.id.spCode)
|
||||
val totalPc: TextView = view.findViewById(R.id.totalPc)
|
||||
val pc: TextView = view.findViewById(R.id.pc)
|
||||
val acWeight: TextView = view.findViewById(R.id.acWeight)
|
||||
val chWight: TextView = view.findViewById(R.id.chWight)
|
||||
|
||||
val delete: TextView = view.findViewById(R.id.delete)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_cang_dan_list_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
viewHolder.itemView.setOnClickListener {
|
||||
|
||||
var adapterPosition = viewHolder.adapterPosition
|
||||
if (adapterPosition < 0 || collectList.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
var item = collectList[adapterPosition]
|
||||
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_CANG_DAN_INFO).withString("id", item.id).withString("ref", item.ref)
|
||||
.withInt("fid", viewModel.fid ?: -9999).withString("prefix", viewModel.prefix)
|
||||
.navigation(activity, Constant.RequestCode.gnj_cang_dan_list)
|
||||
|
||||
}
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
|
||||
val ref = collect.ref
|
||||
if (ref == "1") {
|
||||
collect.isCheck = false
|
||||
}
|
||||
val leftIcon = holder.leftIcon
|
||||
//选中
|
||||
if (collect.isCheck) {
|
||||
leftIcon.setImageResource(R.mipmap.img_plane_s)
|
||||
} else {
|
||||
leftIcon.setImageResource(R.mipmap.gnc_ware_house_left_icon)
|
||||
}
|
||||
|
||||
holder.wbNo.text = collect.wbNo
|
||||
holder.goods.text = collect.goods
|
||||
holder.awbType.text = collect.awbType
|
||||
holder.startPort.text = collect.startPort
|
||||
holder.destPort.text = collect.destPort
|
||||
holder.agentCode.text = collect.agentCode
|
||||
holder.spCode.text = collect.spCode
|
||||
holder.totalPc.text = "${collect.totalPc}"
|
||||
holder.pc.text = "${collect.pc}"
|
||||
holder.acWeight.text = "${collect.acWeight} KG"
|
||||
holder.chWight.text = "${collect.chWight} KG"
|
||||
|
||||
//红色图标 不允许操作
|
||||
if (ref == "1") {
|
||||
leftIcon.setImageResource(R.mipmap.img_plane_disable)
|
||||
} else {
|
||||
leftIcon.setOnClickListener {
|
||||
collect.isCheck = !collect.isCheck
|
||||
if (collect.isCheck) {
|
||||
viewModel.plusOne()
|
||||
} else {
|
||||
viewModel.subOne()
|
||||
}
|
||||
notifyDataSetChanged() // 更新数据
|
||||
}
|
||||
}
|
||||
|
||||
holder.delete.setOnClickListener {
|
||||
if (ref == "1") {
|
||||
Common.showToast(activity, "货物已发放,无法删除!")
|
||||
} else {
|
||||
Common.secondConfirmDialog(activity, "确认删除?") { dialog ->
|
||||
dialog.dismiss()
|
||||
val position = holder.adapterPosition
|
||||
viewModel.deleteFestGjjCangDan(collect.id.toInt(), position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
fun append(gjjCangDanListModel: GjjCangDanListModel) {
|
||||
collectList.add(gjjCangDanListModel)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjChuKuListModel
|
||||
import com.lukouguoji.gjj.viewModel.GjjChuKuListViewModel
|
||||
|
||||
class GjjChuKuListAdapter(
|
||||
val activity: Activity,
|
||||
private val viewModel: GjjChuKuListViewModel,
|
||||
private val collectList: MutableList<GjjChuKuListModel>
|
||||
) :
|
||||
RecyclerView.Adapter<GjjChuKuListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val leftIcon: ImageView = view.findViewById(R.id.leftIcon)
|
||||
val wbNo: TextView = view.findViewById(R.id.wbNo)
|
||||
val pickNo: TextView = view.findViewById(R.id.pickNo)
|
||||
val fno: TextView = view.findViewById(R.id.fno)
|
||||
val pc: TextView = view.findViewById(R.id.pc)
|
||||
val weight: TextView = view.findViewById(R.id.weight)
|
||||
|
||||
val goods: TextView = view.findViewById(R.id.goods)
|
||||
val agentCode: TextView = view.findViewById(R.id.agentCode)
|
||||
val spCode: TextView = view.findViewById(R.id.spCode)
|
||||
val pickDate: TextView = view.findViewById(R.id.pickDate)
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_chu_ku_list_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
|
||||
val leftIcon = holder.leftIcon
|
||||
//选中
|
||||
if (collect.isCheck) {
|
||||
leftIcon.setImageResource(R.mipmap.gjj_chu_ku_left_icon_check)
|
||||
} else {
|
||||
leftIcon.setImageResource(R.mipmap.gnc_ware_house_left_icon)
|
||||
}
|
||||
|
||||
holder.wbNo.text = collect.wbNo
|
||||
holder.pickNo.text = collect.pickNo.toString()
|
||||
holder.fno.text = collect.fno
|
||||
holder.pc.text = "${collect.pc}"
|
||||
holder.weight.text = "${collect.weight} KG"
|
||||
|
||||
holder.goods.text = collect.goods
|
||||
holder.agentCode.text = collect.agentCode
|
||||
holder.spCode.text = collect.spCode
|
||||
holder.pickDate.text = collect.pickDate
|
||||
|
||||
leftIcon.setOnClickListener {
|
||||
collect.isCheck = !collect.isCheck
|
||||
if (collect.isCheck) {
|
||||
viewModel.plusOne()
|
||||
} else {
|
||||
viewModel.subOne()
|
||||
}
|
||||
notifyDataSetChanged() // 更新数据
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
fun append(gjjChuKuListModel: GjjChuKuListModel) {
|
||||
collectList.add(gjjChuKuListModel)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjQueryInfo
|
||||
|
||||
/**
|
||||
* 出港查询详情
|
||||
*/
|
||||
class GjjQueryInfoListAdapter(val activity: Activity, val collectList: MutableList<GjjQueryInfo>) :
|
||||
RecyclerView.Adapter<GjjQueryInfoListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val title: TextView = view.findViewById(R.id.title)
|
||||
val content: EditText = view.findViewById(R.id.content)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_query_info_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
/* viewHolder.itemView.setOnClickListener {
|
||||
|
||||
var adapterPosition = viewHolder.adapterPosition
|
||||
if (adapterPosition < 0 || collectList.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
var gncFuBang = collectList[adapterPosition]
|
||||
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GOUT_FU_BANG_ACTIVITY).withString("userIdParam", gncFuBang.useId.toString())
|
||||
.navigation(activity, Constant.RequestCode.gnc_shouyun_list_refresh)
|
||||
|
||||
}
|
||||
*/
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
holder.title.text = collect.title
|
||||
holder.content.setText(collect.content)
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
fun append(gjjQueryInfo: GjjQueryInfo) {
|
||||
collectList.add(gjjQueryInfo)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjQueryInfoWh
|
||||
|
||||
class GjjQueryInfoWhListAdapter(val activity: Activity, val collectList: MutableList<GjjQueryInfoWh>) :
|
||||
RecyclerView.Adapter<GjjQueryInfoWhListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val location: TextView = view.findViewById(R.id.location)
|
||||
val pc: TextView = view.findViewById(R.id.pc)
|
||||
val weight: TextView = view.findViewById(R.id.weight)
|
||||
val flight: TextView = view.findViewById(R.id.flight)
|
||||
val opDate: TextView = view.findViewById(R.id.opDate)
|
||||
val mclose: TextView = view.findViewById(R.id.mclose)
|
||||
val opId: TextView = view.findViewById(R.id.opId)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_query_info_wh_list_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
holder.location.text = collect.location
|
||||
holder.pc.text = collect.pc.toString()
|
||||
holder.weight.text = "${collect.weight} KG"
|
||||
holder.flight.text = collect.flight
|
||||
holder.opDate.text = collect.opDate
|
||||
holder.mclose.text = collect.mclose
|
||||
holder.opId.text = collect.opId
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
fun append(gjjQueryInfoWh: GjjQueryInfoWh) {
|
||||
collectList.add(gjjQueryInfoWh)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjQueryList
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
/**
|
||||
* 国内出港查询列表
|
||||
*/
|
||||
class GjjQueryListAdapter(val activity: Activity, private val collectList: List<GjjQueryList>) :
|
||||
RecyclerView.Adapter<GjjQueryListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val no: TextView = view.findViewById(R.id.no)
|
||||
val agentCode: TextView = view.findViewById(R.id.agentCode)
|
||||
val goods: TextView = view.findViewById(R.id.goods)
|
||||
val flight: TextView = view.findViewById(R.id.flight)
|
||||
val range: TextView = view.findViewById(R.id.range)
|
||||
val pc: TextView = view.findViewById(R.id.pc)
|
||||
val weight: TextView = view.findViewById(R.id.weight)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view =
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.gjj_query_list_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
viewHolder.itemView.setOnClickListener {
|
||||
|
||||
var adapterPosition = viewHolder.adapterPosition
|
||||
if (adapterPosition < 0 || collectList.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
var gncQueryList = collectList[adapterPosition]
|
||||
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_QUERY_INFO)
|
||||
.withInt("id", gncQueryList.mawbId)
|
||||
.navigation()
|
||||
|
||||
}
|
||||
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
holder.no.text = collect.wbNo
|
||||
holder.agentCode.text = collect.agentCode
|
||||
holder.goods.text = collect.goods
|
||||
holder.flight.text = collect.flight
|
||||
holder.range.text = collect.range
|
||||
holder.pc.text = collect.pc
|
||||
holder.weight.text = collect.weight
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjWareHouseInfo
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
class GjjWareHouseInfoListAdapter(val activity: Activity, val collectList: MutableList<GjjWareHouseInfo>) :
|
||||
RecyclerView.Adapter<GjjWareHouseInfoListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val title: TextView = view.findViewById(R.id.title)
|
||||
val content: EditText = view.findViewById(R.id.content)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_ware_house_info_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
/* viewHolder.itemView.setOnClickListener {
|
||||
|
||||
var adapterPosition = viewHolder.adapterPosition
|
||||
if (adapterPosition < 0 || collectList.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
var gncFuBang = collectList[adapterPosition]
|
||||
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GOUT_FU_BANG_ACTIVITY).withString("userIdParam", gncFuBang.useId.toString())
|
||||
.navigation(activity, Constant.RequestCode.gnc_shouyun_list_refresh)
|
||||
|
||||
}
|
||||
*/
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
holder.title.text = collect.title
|
||||
holder.content.setText(collect.content)
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
fun append(gjjWareHouseInfo: GjjWareHouseInfo) {
|
||||
collectList.add(gjjWareHouseInfo)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.lukouguoji.gjj.adapt
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.model.GjjWareHouseList
|
||||
|
||||
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
/**
|
||||
* 仓库管理列表
|
||||
*/
|
||||
class GjjWareHouseListAdapter(val activity: Activity, private val collectList: List<GjjWareHouseList>) :
|
||||
RecyclerView.Adapter<GjjWareHouseListAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val groupNameLayout: LinearLayout = view.findViewById(R.id.groupNameLayout)
|
||||
val groupTitle: TextView = view.findViewById(R.id.groupTitle)
|
||||
val groupContent: TextView = view.findViewById(R.id.groupContent)
|
||||
val days: TextView = view.findViewById(R.id.days)
|
||||
|
||||
val no: TextView = view.findViewById(R.id.no)
|
||||
val pc: TextView = view.findViewById(R.id.pc)
|
||||
val weight: TextView = view.findViewById(R.id.weight)
|
||||
/*val goods: TextView = view.findViewById(R.id.goods)
|
||||
val spCode: TextView = view.findViewById(R.id.spCode)
|
||||
val agentCode: TextView = view.findViewById(R.id.agentCode)
|
||||
val by1: TextView = view.findViewById(R.id.by1)
|
||||
val origin: TextView = view.findViewById(R.id.origin)*/
|
||||
|
||||
val flight: TextView = view.findViewById(R.id.flight)
|
||||
|
||||
/* val location: TextView = view.findViewById(R.id.location)
|
||||
val awbType: TextView = view.findViewById(R.id.awbType)
|
||||
val businessType: TextView = view.findViewById(R.id.businessType)
|
||||
val status: TextView = view.findViewById(R.id.status)*/
|
||||
val date: TextView = view.findViewById(R.id.date)
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.gjj_ware_house_list_item, parent, false)
|
||||
val viewHolder = ViewHolder(view)
|
||||
|
||||
viewHolder.itemView.setOnClickListener {
|
||||
|
||||
var adapterPosition = viewHolder.adapterPosition
|
||||
if (adapterPosition < 0 || collectList.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
var gncFuBang = collectList[adapterPosition]
|
||||
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_WARE_HOUSE_INFO).withInt("id", gncFuBang.id)
|
||||
.navigation()
|
||||
|
||||
}
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val collect = collectList[position]
|
||||
val groupTitle = collect.groupTitle
|
||||
val groupName = collect.groupName
|
||||
val days = collect.days
|
||||
//第一条
|
||||
if (position == 0 && groupName != "") {
|
||||
holder.groupNameLayout.visibility = View.VISIBLE
|
||||
holder.groupTitle.text = groupTitle
|
||||
holder.groupContent.text = groupName
|
||||
//出库时间分组时,days数据不为null,展示
|
||||
if (days != null) {
|
||||
holder.days.text = days
|
||||
holder.days.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.days.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
//不是第一条
|
||||
else if (groupName != "") {
|
||||
//当前分组名和上一次分组名不一样,展示新的分组
|
||||
val preCollect = collectList[position - 1]
|
||||
val preGroupName = preCollect.groupName
|
||||
if (groupName != preGroupName) {
|
||||
holder.groupNameLayout.visibility = View.VISIBLE
|
||||
holder.groupTitle.text = groupTitle
|
||||
holder.groupContent.text = groupName
|
||||
//出库时间分组时,days数据不为null,展示
|
||||
if (days != null) {
|
||||
holder.days.text = days
|
||||
holder.days.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.days.visibility = View.GONE
|
||||
}
|
||||
} else {
|
||||
holder.groupNameLayout.visibility = View.GONE
|
||||
}
|
||||
} else {
|
||||
holder.groupNameLayout.visibility = View.GONE
|
||||
}
|
||||
|
||||
holder.no.text = collect.waybillNo
|
||||
holder.pc.text = collect.pc.toString()
|
||||
holder.weight.text = "${collect.weight} KG"
|
||||
/*holder.goods.text = collect.goods
|
||||
holder.spCode.text = collect.spCode
|
||||
holder.agentCode.text = collect.agentCode
|
||||
holder.by1.text = collect.by1
|
||||
holder.origin.text = collect.origin*/
|
||||
|
||||
holder.flight.text = collect.flight
|
||||
/*holder.location.text = collect.location
|
||||
holder.awbType.text = collect.awbType
|
||||
holder.businessType.text = collect.businessType
|
||||
holder.status.text = collect.status*/
|
||||
holder.date.text = collect.date
|
||||
}
|
||||
|
||||
override fun getItemCount() = collectList.size
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user