[6.6.0]数据闭环-接管记录
This commit is contained in:
@@ -22,6 +22,7 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.iflytek.cloud.ErrorCode
|
||||
import com.iflytek.cloud.InitListener
|
||||
@@ -37,6 +38,7 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.tts.base.SpeechUtils
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.workorder.adapter.OrderReasonAdapter
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
@@ -88,6 +90,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
private lateinit var tvUploadSuccess: TextView
|
||||
private lateinit var faultReasonGroup: Group
|
||||
|
||||
private lateinit var orderReasonAdapter: OrderReasonAdapter
|
||||
|
||||
init {
|
||||
initFloatWindow()
|
||||
}
|
||||
@@ -131,6 +135,16 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
rvFaultList = mFloatLayout.findViewById(R.id.rvFaultList)
|
||||
tvUploadSuccess = mFloatLayout.findViewById(R.id.tvUploadSuccess)
|
||||
faultReasonGroup = mFloatLayout.findViewById(R.id.faultReasonGroup)
|
||||
val linearLayoutManager = LinearLayoutManager(mActivity)
|
||||
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
|
||||
rvFaultList.layoutManager = linearLayoutManager
|
||||
orderReasonAdapter = OrderReasonAdapter()
|
||||
orderReasonAdapter.setListener(object: OrderReasonAdapter.ReasonSelectListener{
|
||||
override fun onSelectReason(reason: String) {
|
||||
|
||||
}
|
||||
})
|
||||
rvFaultList.adapter = orderReasonAdapter
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.iflytek.cloud.ErrorCode
|
||||
import com.iflytek.cloud.InitListener
|
||||
@@ -37,6 +38,7 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.tts.base.SpeechUtils
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.workorder.adapter.OrderReasonAdapter
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
@@ -84,6 +86,8 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
private lateinit var tvUploadSuccess: AppCompatTextView
|
||||
private lateinit var takeOverReasonGroup: Group
|
||||
|
||||
private lateinit var orderReasonAdapter: OrderReasonAdapter
|
||||
|
||||
init {
|
||||
initFloatWindow()
|
||||
}
|
||||
@@ -123,6 +127,16 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
rvTakeOverList = mFloatLayout.findViewById(R.id.rvTakeOverList)
|
||||
tvUploadSuccess = mFloatLayout.findViewById(R.id.tvUploadSuccess)
|
||||
takeOverReasonGroup = mFloatLayout.findViewById(R.id.takeOverReasonGroup)
|
||||
val linearLayoutManager = LinearLayoutManager(mActivity)
|
||||
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
|
||||
rvTakeOverList.layoutManager = linearLayoutManager
|
||||
orderReasonAdapter = OrderReasonAdapter()
|
||||
orderReasonAdapter.setListener(object: OrderReasonAdapter.ReasonSelectListener{
|
||||
override fun onSelectReason(reason: String) {
|
||||
|
||||
}
|
||||
})
|
||||
rvTakeOverList.adapter = orderReasonAdapter
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhjt.mogo_core_function_devatools.workorder
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
@@ -38,6 +39,7 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
|
||||
private var takeOverListAdapter: TakeOverListAdapter ?= null
|
||||
private var clickListener: ClickListener? = null
|
||||
private val selectedUploadRecord = ArrayList<TakeOverRecordInfo>()
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_take_over_record, this, true)
|
||||
@@ -62,6 +64,17 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
val takeOverReasonWindow = TakeOverReasonWindow(activity)
|
||||
takeOverReasonWindow.showFloatWindow()
|
||||
}
|
||||
|
||||
override fun onSelectRecord(
|
||||
takeOverRecordInfo: TakeOverRecordInfo,
|
||||
isChecked: Boolean
|
||||
) {
|
||||
if(isChecked){
|
||||
selectedUploadRecord.add(takeOverRecordInfo)
|
||||
}else{
|
||||
selectedUploadRecord.remove(takeOverRecordInfo)
|
||||
}
|
||||
}
|
||||
})
|
||||
rvTakeOverList.addItemDecoration(
|
||||
BottomDecoration(
|
||||
@@ -102,28 +115,7 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
|
||||
//一键上传
|
||||
tvUpload.setOnClickListener {
|
||||
val takeOverRecordInfoOne = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述1",false)
|
||||
val takeOverRecordInfoTwo = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述2",false)
|
||||
val takeOverRecordInfoThree = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述3",true)
|
||||
val takeOverRecordInfoFour = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述4",true)
|
||||
val takeOverRecordInfoFive = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述5",false)
|
||||
val takeOverRecordInfoSix = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述6",false)
|
||||
val takeOverRecordInfoSeven = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述7",false)
|
||||
val takeOverRecordInfoEight = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述8",true)
|
||||
val takeOverRecordInfoNine = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述9",false)
|
||||
val takeOverRecordInfoTen = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineName","描述10",true)
|
||||
|
||||
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoOne)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoTwo)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoThree)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoFour)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoFive)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoSix)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoSeven)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoEight)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoNine)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfoTen)
|
||||
}
|
||||
//删除
|
||||
tvDeleteSelect.setOnClickListener {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zhjt.mogo_core_function_devatools.workorder.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
|
||||
/**
|
||||
* 上报类型、原因列表适配器
|
||||
*/
|
||||
class OrderReasonAdapter: RecyclerView.Adapter<OrderReasonAdapter.ReasonHolder>() {
|
||||
|
||||
private var data: List<String> ?= null
|
||||
private var selectListener: ReasonSelectListener ?= null
|
||||
|
||||
fun setData(data: List<String>){
|
||||
this.data = data
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReasonHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_order_reason, parent, false)
|
||||
return ReasonHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ReasonHolder, position: Int) {
|
||||
data?.let {
|
||||
val reason = it[position]
|
||||
holder.tvReason.text = reason
|
||||
holder.tvReason.setOnClickListener {
|
||||
selectListener?.onSelectReason(reason)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
class ReasonHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
val tvReason: TextView = itemView.findViewById(R.id.tvReason)
|
||||
}
|
||||
|
||||
fun setListener(listener: ReasonSelectListener){
|
||||
selectListener = listener
|
||||
}
|
||||
|
||||
interface ReasonSelectListener{
|
||||
//选择原因
|
||||
fun onSelectReason(reason: String)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,9 @@ class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter<Ta
|
||||
data?.let {
|
||||
val recordEntity = it[position]
|
||||
holder.cbRecordSelect.isClickable = !recordEntity.reportStatus
|
||||
holder.cbRecordSelect.setOnCheckedChangeListener { _, isChecked ->
|
||||
clickListener?.onSelectRecord(recordEntity,isChecked)
|
||||
}
|
||||
holder.tvFaultStartTime.text = recordEntity.faultStartTime
|
||||
holder.tvLineName.text = recordEntity.lineName
|
||||
holder.tvTakeOverReason.text = recordEntity.reportNote
|
||||
@@ -82,6 +85,8 @@ class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter<Ta
|
||||
interface RecordClickListener{
|
||||
//编辑接管记录
|
||||
fun onEditRecord(takeOverRecordInfo: TakeOverRecordInfo)
|
||||
//选择接管记录
|
||||
fun onSelectRecord(takeOverRecordInfo: TakeOverRecordInfo,isChecked: Boolean)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tvReason"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:textSize="@dimen/sp_30"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
>
|
||||
|
||||
</TextView>
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbRecordSelect"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/record_radio_button_style"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_30"
|
||||
android:paddingTop="@dimen/dp_30"
|
||||
android:paddingBottom="@dimen/dp_30"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -24,7 +25,6 @@
|
||||
app:layout_constraintLeft_toRightOf="@id/cbRecordSelect"
|
||||
android:textSize="@dimen/sp_38"
|
||||
android:textColor="#8E9DD4"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Reference in New Issue
Block a user