[6.6.0]接管记录
This commit is contained in:
@@ -105,7 +105,7 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
it.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||
it.gravity = Gravity.START or Gravity.TOP
|
||||
it.width = 844
|
||||
it.height = 991
|
||||
it.height = 846
|
||||
it.alpha = 1.0f
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,24 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.deva.report.TakeOverRecordInfo
|
||||
import com.mogo.eagle.core.function.call.takeover.CallerTakeOverManager
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils.getYMDFormat
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.workorder.adapter.BottomDecoration
|
||||
import com.zhjt.mogo_core_function_devatools.workorder.adapter.TakeOverListAdapter
|
||||
import kotlinx.android.synthetic.main.view_take_over_record.view.ivTakeOverRecordClose
|
||||
import kotlinx.android.synthetic.main.view_take_over_record.view.rvTakeOverList
|
||||
import kotlinx.android.synthetic.main.view_take_over_record.view.tvDeleteSelect
|
||||
import kotlinx.android.synthetic.main.view_take_over_record.view.tvTakeOverRecordDate
|
||||
import kotlinx.android.synthetic.main.view_take_over_record.view.tvUpload
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* 接管信息管理页面
|
||||
@@ -40,15 +49,86 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
ivTakeOverRecordClose.setOnClickListener {
|
||||
clickListener?.onClose()
|
||||
}
|
||||
takeOverListAdapter = TakeOverListAdapter()
|
||||
//接管记录日期
|
||||
tvTakeOverRecordDate.text = TimeUtils.millis2String(System.currentTimeMillis(), getYMDFormat())
|
||||
val linearLayoutManager = LinearLayoutManager(context)
|
||||
rvTakeOverList.layoutManager = linearLayoutManager
|
||||
takeOverListAdapter = TakeOverListAdapter(context)
|
||||
takeOverListAdapter?.setListener(object: TakeOverListAdapter.RecordClickListener{
|
||||
override fun onEditRecord(takeOverRecordInfo: TakeOverRecordInfo) {
|
||||
//展示接管原因窗口
|
||||
val activity = context as? FragmentActivity
|
||||
?: throw IllegalStateException("please ensure context is FragmentActivity.")
|
||||
val takeOverReasonWindow = TakeOverReasonWindow(activity)
|
||||
takeOverReasonWindow.showFloatWindow()
|
||||
}
|
||||
})
|
||||
rvTakeOverList.addItemDecoration(
|
||||
BottomDecoration(
|
||||
AutoSizeUtils.dp2px(context, 194f)
|
||||
)
|
||||
)
|
||||
rvTakeOverList.adapter = takeOverListAdapter
|
||||
|
||||
GlobalScope.launch(Dispatchers.IO){
|
||||
CallerTakeOverManager.getAllRecord(context)
|
||||
}
|
||||
val list = ArrayList<TakeOverRecordInfo>()
|
||||
|
||||
// GlobalScope.launch(Dispatchers.IO){
|
||||
// list = CallerTakeOverManager.getAllRecord(context)
|
||||
// }
|
||||
|
||||
val takeOverRecordInfoOne = TakeOverRecordInfo(System.currentTimeMillis().toString(),"环球贸易中心",1,2,3,"lineNamelineNamelineNamelineNamelineNamelineNamelineNamelineNamelineNamelineName","描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述1描述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)
|
||||
|
||||
list.add(takeOverRecordInfoOne)
|
||||
list.add(takeOverRecordInfoTwo)
|
||||
list.add(takeOverRecordInfoThree)
|
||||
list.add(takeOverRecordInfoFour)
|
||||
list.add(takeOverRecordInfoFive)
|
||||
list.add(takeOverRecordInfoSix)
|
||||
list.add(takeOverRecordInfoSeven)
|
||||
list.add(takeOverRecordInfoEight)
|
||||
list.add(takeOverRecordInfoNine)
|
||||
list.add(takeOverRecordInfoTen)
|
||||
|
||||
takeOverListAdapter?.setData(list)
|
||||
|
||||
//一键上传
|
||||
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 {
|
||||
// CallerTakeOverManager.deleteRecord(context,)
|
||||
}
|
||||
}
|
||||
|
||||
fun setOnClickListener(clickListener: ClickListener) {
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class BottomDecoration extends RecyclerView.ItemDecoration {
|
||||
/**
|
||||
* 第一个视图和最后一个视图偏移的距离
|
||||
@@ -16,7 +18,7 @@ public class BottomDecoration extends RecyclerView.ItemDecoration {
|
||||
* 设置RecyclerView子视图的边距,本示例仅用于定义两个子视图之间的边距,为space*2
|
||||
*/
|
||||
public BottomDecoration(int distance) {
|
||||
this.distance = distance;
|
||||
BottomDecoration.distance = distance;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,10 +26,8 @@ public class BottomDecoration extends RecyclerView.ItemDecoration {
|
||||
int pos = parent.getChildAdapterPosition(view);
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams)view.getLayoutParams();
|
||||
|
||||
/**
|
||||
* 通过设置Item左右边距实现第一个左侧和最后一个右侧设置边距,确保显示的视图位于屏幕中间
|
||||
*/
|
||||
int itemCount = parent.getAdapter().getItemCount();
|
||||
//通过设置Item左右边距实现第一个左侧和最后一个右侧设置边距,确保显示的视图位于屏幕中间
|
||||
int itemCount = Objects.requireNonNull(parent.getAdapter()).getItemCount();
|
||||
if(pos == itemCount-1){
|
||||
layoutParams.setMargins(0,0,0,distance);
|
||||
}else {
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
package com.zhjt.mogo_core_function_devatools.workorder.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.deva.report.TakeOverRecordInfo
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
|
||||
/**
|
||||
* 接管记录适配器
|
||||
*/
|
||||
class TakeOverListAdapter: RecyclerView.Adapter<TakeOverListAdapter.TakeOverRecordHolder>() {
|
||||
class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter<TakeOverListAdapter.TakeOverRecordHolder>() {
|
||||
|
||||
private var data:List<TakeOverRecordInfo> ?= null
|
||||
private var clickListener: RecordClickListener ?= null
|
||||
|
||||
fun setData(data: List<TakeOverRecordInfo>){
|
||||
this.data = data
|
||||
@@ -31,6 +35,32 @@ class TakeOverListAdapter: RecyclerView.Adapter<TakeOverListAdapter.TakeOverReco
|
||||
override fun onBindViewHolder(holder: TakeOverRecordHolder, position: Int) {
|
||||
data?.let {
|
||||
val recordEntity = it[position]
|
||||
holder.cbRecordSelect.isClickable = !recordEntity.reportStatus
|
||||
holder.tvFaultStartTime.text = recordEntity.faultStartTime
|
||||
holder.tvLineName.text = recordEntity.lineName
|
||||
holder.tvTakeOverReason.text = recordEntity.reportNote
|
||||
if(recordEntity.reportStatus){
|
||||
//已上报
|
||||
holder.ivRecordStatusLabel.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_record_upload
|
||||
))
|
||||
}else{
|
||||
//未上报
|
||||
holder.ivRecordStatusLabel.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_record_edit
|
||||
))
|
||||
}
|
||||
holder.ivRecordStatusLabel.setOnClickListener {
|
||||
if(recordEntity.reportStatus){
|
||||
ToastUtils.showShort("此条记录已上传不可再次编辑")
|
||||
}else{
|
||||
clickListener?.onEditRecord(recordEntity)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,4 +75,13 @@ class TakeOverListAdapter: RecyclerView.Adapter<TakeOverListAdapter.TakeOverReco
|
||||
val tvTakeOverReason: TextView = itemView.findViewById(R.id.tvTakeOverReason)
|
||||
}
|
||||
|
||||
fun setListener(listener: RecordClickListener){
|
||||
clickListener = listener
|
||||
}
|
||||
|
||||
interface RecordClickListener{
|
||||
//编辑接管记录
|
||||
fun onEditRecord(takeOverRecordInfo: TakeOverRecordInfo)
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -2,8 +2,8 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_checked="false"
|
||||
android:drawable="@drawable/shape_size_check_false" />
|
||||
android:drawable="@drawable/icon_record_check_false" />
|
||||
<item
|
||||
android:state_checked="true"
|
||||
android:drawable="@drawable/shape_size_check_true" />
|
||||
android:drawable="@drawable/icon_record_check_true" />
|
||||
</selector>
|
||||
@@ -6,12 +6,13 @@
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbRecordSelect"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
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"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -21,9 +22,9 @@
|
||||
app:layout_constraintTop_toTopOf="@id/cbRecordSelect"
|
||||
app:layout_constraintBottom_toBottomOf="@id/cbRecordSelect"
|
||||
app:layout_constraintLeft_toRightOf="@id/cbRecordSelect"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:textSize="@dimen/sp_38"
|
||||
android:textColor="#8E9DD4"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@@ -49,6 +50,7 @@
|
||||
android:textColor="#8E9DD4"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -65,4 +67,13 @@
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0_5"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="#668E9DD4"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,7 +3,7 @@
|
||||
android:layout_width="@dimen/dp_960"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="#F0151D41">
|
||||
android:background="@drawable/bg_take_over_record">
|
||||
|
||||
<View
|
||||
android:id="@+id/viewTakeOverRecordLine"
|
||||
|
||||
Reference in New Issue
Block a user