Merge branch 'dev_robotaxi-d_240807_6.6.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240807_6.6.0

This commit is contained in:
xinfengkun
2024-08-20 10:18:02 +08:00
15 changed files with 897 additions and 13 deletions

View File

@@ -87,7 +87,7 @@ object RecordManager {
/**
* 删除接管记录
* @param context 上下文
* @param recordInfo 接管数据实体
* @param takeOverRecordInfo 接管数据实体
*/
fun deleteRecord(context: Context, takeOverRecordInfo: TakeOverRecordInfo) {
takeOverRecordInfo.let{

View File

@@ -0,0 +1,348 @@
package com.zhjt.mogo_core_function_devatools.workorder
import android.annotation.SuppressLint
import android.app.Activity
import android.graphics.PixelFormat
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.util.DisplayMetrics
import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.View.OnFocusChangeListener
import android.view.WindowManager
import android.view.animation.Animation
import android.view.animation.ScaleAnimation
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.AppCompatEditText
import androidx.constraintlayout.widget.Group
import androidx.recyclerview.widget.RecyclerView
import com.iflytek.cloud.ErrorCode
import com.iflytek.cloud.InitListener
import com.iflytek.cloud.RecognizerListener
import com.iflytek.cloud.RecognizerResult
import com.iflytek.cloud.SpeechError
import com.iflytek.cloud.SpeechRecognizer
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.JsonParser
import com.mogo.eagle.core.utilcode.util.TimeUtils
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 kotlinx.coroutines.DelicateCoroutinesApi
import kotlin.math.absoluteValue
/**
* 故障原因编辑窗口
*/
class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener{
companion object{
const val TAG = "FaultReasonWindow"
}
private var mActivity: Activity = activity
private var mWindowParams: WindowManager.LayoutParams? = null
private var mWindowManager: WindowManager? = null
private lateinit var mFloatLayout: View
private var mInViewX = 0f
private var mInViewY = 0f
private var mInScreenX = 0f
private var mInScreenY = 0f
// 语音听写对象
private var mIat: SpeechRecognizer? = null
// 用HashMap存储听写结果
private val mIatResults: HashMap<String, String> = LinkedHashMap()
var ret = 0 // 函数调用返回值
private var audioStatus = false
private var workOrderOccurrenceTime = System.currentTimeMillis() //故障发生时间
private var clickListener: ClickListener? = null
private lateinit var tvFaultTitle: TextView
private lateinit var tvFaultTime: TextView
private lateinit var tvFaultType: TextView
private lateinit var ivFaultTypeSelect: ImageView
private lateinit var tvFaultReason: TextView
private lateinit var ivFaultReasonSelect: ImageView
private lateinit var ivTimeReduce: ImageView
private lateinit var tvOccurrenceTime: TextView
private lateinit var ivTimeAdd: ImageView
private lateinit var etNoteInput: AppCompatEditText
private lateinit var ivNoteAudio: ImageView
private lateinit var tvFaultReport: TextView
private lateinit var tvFaultCancel: TextView
private lateinit var rvFaultList: RecyclerView
private lateinit var tvUploadSuccess: TextView
private lateinit var faultReasonGroup: Group
init {
initFloatWindow()
}
@SuppressLint("InflateParams")
private fun initFloatWindow(){
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_fault_reason, null) as View
mFloatLayout.setOnTouchListener(this)
// 初始化识别无UI识别对象
// 使用SpeechRecognizer对象可根据回调消息自定义界面
mIat = SpeechRecognizer.createRecognizer(mActivity, mInitListener)
initView()
initEvent()
mWindowParams = WindowManager.LayoutParams()
mWindowManager = mActivity.windowManager
mWindowParams?.let {
it.format = PixelFormat.RGBA_8888
it.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
it.gravity = Gravity.START or Gravity.TOP
it.width = 844
it.height = 991
it.alpha = 1.0f
}
}
private fun initView(){
tvFaultTitle = mFloatLayout.findViewById(R.id.tvFaultTitle)
tvFaultTime = mFloatLayout.findViewById(R.id.tvFaultTime)
tvFaultType = mFloatLayout.findViewById(R.id.tvFaultType)
ivFaultTypeSelect = mFloatLayout.findViewById(R.id.ivFaultTypeSelect)
tvFaultReason = mFloatLayout.findViewById(R.id.tvFaultReason)
ivFaultReasonSelect = mFloatLayout.findViewById(R.id.ivFaultReasonSelect)
ivTimeReduce = mFloatLayout.findViewById(R.id.ivTimeReduce)
tvOccurrenceTime = mFloatLayout.findViewById(R.id.tvOccurrenceTime)
ivTimeAdd = mFloatLayout.findViewById(R.id.ivTimeAdd)
etNoteInput = mFloatLayout.findViewById(R.id.etNoteInput)
ivNoteAudio = mFloatLayout.findViewById(R.id.ivNoteAudio)
tvFaultReport = mFloatLayout.findViewById(R.id.tvFaultReport)
tvFaultCancel = mFloatLayout.findViewById(R.id.tvFaultCancel)
rvFaultList = mFloatLayout.findViewById(R.id.rvFaultList)
tvUploadSuccess = mFloatLayout.findViewById(R.id.tvUploadSuccess)
faultReasonGroup = mFloatLayout.findViewById(R.id.faultReasonGroup)
}
@OptIn(DelicateCoroutinesApi::class)
@SuppressLint("SetTextI18n")
private fun initEvent(){
//弹窗展示时间
tvFaultTime.text = mActivity.resources.getString(R.string.take_over_time) +
millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
//发生时间
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
ivTimeReduce.setOnClickListener {
workOrderOccurrenceTime -= 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
ivTimeAdd.setOnClickListener {
if(workOrderOccurrenceTime + 60000 > System.currentTimeMillis()){
ToastUtils.showShort("发生时间应在当前时间之前")
return@setOnClickListener
}
workOrderOccurrenceTime += 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
//补充描述
etNoteInput.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
val edit = v as EditText
if(hasFocus){
edit.hint = ""
}else{
edit.hint = "手动输入"
}
}
etNoteInput.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?) {
}
})
//问题描述录音
ivNoteAudio.setOnClickListener {
audioStatus = !audioStatus
setAudio(audioStatus)
}
//上报
tvFaultReport.setOnClickListener{
//TODO
}
//取消
tvFaultCancel.setOnClickListener {
hideFloatWindow()
}
}
private fun setAudio(status: Boolean){
if(status){
//开始录音
mIat?.let {
//清空之前的内容
mIatResults.clear()
SpeechUtils.setParam(it)
// 不显示听写对话框
ret = it.startListening(mRecognizerListener)
if (ret != ErrorCode.SUCCESS) {
ToastUtils.showShort("听写失败,错误码:$ret,请点击网址https://www.xfyun.cn/document/error-code查询解决方案")
}
}
//开始录音,展示放大缩小动效
val scaleAnimation = ScaleAnimation(
1.0f, 0.8f, 1.0f, 0.8f,
Animation.RELATIVE_TO_SELF, 0.8f, Animation.RELATIVE_TO_SELF, 0.8f
)
scaleAnimation.duration = 1000
scaleAnimation.repeatCount = -1
ivNoteAudio.startAnimation(scaleAnimation)
}else{
//停止语音听写
mIat?.stopListening()
//结束动画
ivNoteAudio.clearAnimation()
}
}
/**
* 初始化监听器。
*/
private val mInitListener = InitListener { code ->
if (code != ErrorCode.SUCCESS) {
ToastUtils.showShort("讯飞语音听写初始化失败,错误码:$code")
}
}
/**
* 听写监听器。
*/
private val mRecognizerListener: RecognizerListener = object : RecognizerListener{
override fun onVolumeChanged(p0: Int, p1: ByteArray?) {
//showTip("当前正在说话,音量大小 = " + volume + " 返回音频数据 = " + data.length);
}
override fun onBeginOfSpeech() {
// 此回调表示sdk内部录音机已经准备好了用户可以开始语音输入
}
override fun onEndOfSpeech() {
// 此回调表示:检测到了语音的尾端点,已经进入识别过程,不再接受语音输入
}
override fun onResult(results: RecognizerResult?, isLast: Boolean) {
results?.let {
printResult(it)
}
}
override fun onError(p0: SpeechError?) {
// Tips
// 错误码10118(您没有说话),可能是录音机权限被禁,需要提示用户打开应用的录音权限。
}
override fun onEvent(p0: Int, p1: Int, p2: Int, p3: Bundle?) {
// 以下代码用于获取与云端的会话id当业务出错时将会话id提供给技术支持人员可用于查询会话日志定位出错原因
// 若使用本地能力会话id为null
// if (SpeechEvent.EVENT_SESSION_ID == eventType) {
// String sid = obj.getString(SpeechEvent.KEY_EVENT_SESSION_ID);
// Log.d(TAG, "session id =" + sid);
// }
}
}
/**
* 显示结果
*/
@SuppressLint("SetTextI18n")
private fun printResult(results: RecognizerResult) {
val text: String = JsonParser.parseIatResult(results.resultString)
Log.i(TAG, "语音内容=$text")
if(text.isNotEmpty()){
if(etNoteInput.text.toString().isEmpty()){
etNoteInput.setText(text)
etNoteInput.setSelection(text.length)
}else{
val startStr = etNoteInput.text.toString().substring(0,etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString().substring(etNoteInput.selectionEnd,etNoteInput.text.toString().length)
etNoteInput.setText(startStr+text+endStr)
etNoteInput.setSelection(startStr.length+text.length)
}
}
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouch(v: View?, motionEvent: MotionEvent?): Boolean {
when (motionEvent?.action) {
MotionEvent.ACTION_DOWN -> {
// 获取相对View的坐标即以此View左上角为原点
mInViewX = motionEvent.x
mInViewY = motionEvent.y
// 获取相对屏幕的坐标,即以屏幕左上角为原点
mInScreenX = motionEvent.rawX
mInScreenY = motionEvent.rawY
}
MotionEvent.ACTION_MOVE -> {
// 更新浮动窗口位置参数
mInScreenX = motionEvent.rawX
mInScreenY = motionEvent.rawY
if(((mInScreenX - mInViewX)-mWindowParams!!.x).absoluteValue>150 || ((mInScreenY - mInViewY)-mWindowParams!!.y).absoluteValue>150){
return true
}
mWindowParams!!.x = (mInScreenX - mInViewX).toInt()
mWindowParams!!.y = (mInScreenY - mInViewY).toInt()
// 手指移动的时候更新小悬浮窗的位置
mWindowManager!!.updateViewLayout(mFloatLayout, mWindowParams)
}
}
return true
}
fun showFloatWindow() {
if (mFloatLayout.parent == null) {
val metrics = DisplayMetrics()
// 默认固定位置,靠屏幕右边缘的中间
mWindowManager!!.defaultDisplay.getMetrics(metrics)
mWindowParams!!.x = metrics.widthPixels-890
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-1140
mWindowManager!!.addView(mFloatLayout, mWindowParams)
}
}
fun hideFloatWindow() {
if (mFloatLayout.parent != null){
mWindowManager!!.removeView(mFloatLayout)
}
CallerDevaToolsListenerManager.removeListener(TAG)
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener {
fun closeWindow()
}
}

View File

@@ -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
}
}

View File

@@ -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) {

View File

@@ -0,0 +1,39 @@
package com.zhjt.mogo_core_function_devatools.workorder.adapter;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Objects;
public class BottomDecoration extends RecyclerView.ItemDecoration {
/**
* 第一个视图和最后一个视图偏移的距离
*/
public static int distance = 0;
/**
* 设置RecyclerView子视图的边距本示例仅用于定义两个子视图之间的边距为space*2
*/
public BottomDecoration(int distance) {
BottomDecoration.distance = distance;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
int pos = parent.getChildAdapterPosition(view);
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams)view.getLayoutParams();
//通过设置Item左右边距实现第一个左侧和最后一个右侧设置边距,确保显示的视图位于屏幕中间
int itemCount = Objects.requireNonNull(parent.getAdapter()).getItemCount();
if(pos == itemCount-1){
layoutParams.setMargins(0,0,0,distance);
}else {
layoutParams.setMargins(0,0,0,0);
}
view.setLayoutParams(layoutParams);
super.getItemOffsets(outRect, view, parent, state);
}
}

View File

@@ -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: 122 KiB

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

View File

@@ -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>

View File

@@ -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>

View File

@@ -0,0 +1,363 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_844"
android:layout_height="@dimen/dp_991"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_fault_reason">
<View
android:id="@+id/viewTitleBg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_102"
android:background="@drawable/icon_work_order_title"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:id="@+id/tvFaultTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fault_reason"
android:textSize="@dimen/sp_34"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/viewTitleBg"
app:layout_constraintBottom_toBottomOf="@id/viewTitleBg"
app:layout_constraintStart_toStartOf="@id/viewTitleBg"
android:layout_marginStart="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvFaultTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fault_open_time"
android:textColor="@color/white"
android:textSize="@dimen/sp_30"
app:layout_constraintTop_toTopOf="@id/viewTitleBg"
app:layout_constraintBottom_toBottomOf="@id/viewTitleBg"
app:layout_constraintEnd_toEndOf="@id/viewTitleBg"
android:layout_marginEnd="@dimen/dp_30"
/>
<View
android:id="@+id/viewFaultTypeLabel"
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_29"
android:background="#FF0176FF"
app:layout_constraintTop_toBottomOf="@id/viewTitleBg"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_48"
/>
<TextView
android:id="@+id/tvTypeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fault_type"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/viewFaultTypeLabel"
app:layout_constraintBottom_toBottomOf="@id/viewFaultTypeLabel"
app:layout_constraintLeft_toRightOf="@id/viewFaultTypeLabel"
android:layout_marginStart="@dimen/dp_14"
/>
<View
android:id="@+id/viewFaultType"
android:layout_width="@dimen/dp_781"
android:layout_height="@dimen/dp_70"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_203"
android:background="@drawable/bg_fault_type"
/>
<TextView
android:id="@+id/tvFaultType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/viewFaultType"
app:layout_constraintBottom_toBottomOf="@id/viewFaultType"
app:layout_constraintLeft_toLeftOf="@id/viewFaultType"
android:layout_marginLeft="@dimen/dp_21"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
/>
<ImageView
android:id="@+id/ivFaultTypeSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/viewFaultType"
app:layout_constraintBottom_toBottomOf="@id/viewFaultType"
app:layout_constraintRight_toRightOf="@id/viewFaultType"
android:src="@drawable/icon_fault_expand"
android:layout_marginRight="@dimen/dp_21"
android:contentDescription="@string/fault_type_select"
/>
<View
android:id="@+id/viewFaultReasonLabel"
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_29"
android:background="#FF0176FF"
app:layout_constraintTop_toBottomOf="@id/viewFaultType"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_48"
/>
<TextView
android:id="@+id/tvFaultReasonTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fault_reason"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/viewFaultReasonLabel"
app:layout_constraintBottom_toBottomOf="@id/viewFaultReasonLabel"
app:layout_constraintLeft_toRightOf="@id/viewFaultReasonLabel"
android:layout_marginStart="@dimen/dp_14"
/>
<View
android:id="@+id/viewFaultReason"
android:layout_width="@dimen/dp_781"
android:layout_height="@dimen/dp_70"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_374"
android:background="@drawable/bg_fault_type"
/>
<TextView
android:id="@+id/tvFaultReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/viewFaultReason"
app:layout_constraintBottom_toBottomOf="@id/viewFaultReason"
app:layout_constraintLeft_toLeftOf="@id/viewFaultReason"
android:layout_marginLeft="@dimen/dp_21"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
/>
<ImageView
android:id="@+id/ivFaultReasonSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/viewFaultReason"
app:layout_constraintBottom_toBottomOf="@id/viewFaultReason"
app:layout_constraintRight_toRightOf="@id/viewFaultReason"
android:src="@drawable/icon_fault_expand"
android:layout_marginRight="@dimen/dp_21"
android:contentDescription="@string/fault_type_select"
/>
<View
android:id="@+id/viewFaultTimeLabel"
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_29"
android:background="#FF0176FF"
app:layout_constraintTop_toBottomOf="@id/viewFaultReason"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_48"
/>
<TextView
android:id="@+id/tvFaultTimeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fault_time"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/viewFaultTimeLabel"
app:layout_constraintBottom_toBottomOf="@id/viewFaultTimeLabel"
app:layout_constraintLeft_toRightOf="@id/viewFaultTimeLabel"
android:layout_marginStart="@dimen/dp_14"
/>
<ImageView
android:id="@+id/ivTimeReduce"
android:layout_width="@dimen/dp_72"
android:layout_height="@dimen/dp_72"
android:src="@drawable/icon_work_order_reduce"
app:layout_constraintLeft_toLeftOf="@id/viewFaultTimeLabel"
app:layout_constraintTop_toBottomOf="@id/tvFaultTimeTitle"
android:layout_marginTop="@dimen/dp_17"
android:contentDescription="@string/fault_time_reduce"
/>
<TextView
android:id="@+id/tvOccurrenceTime"
android:layout_width="@dimen/dp_150"
android:layout_height="@dimen/dp_72"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
android:gravity="center"
android:background="#1AA7B6F0"
app:layout_constraintTop_toTopOf="@id/ivTimeReduce"
app:layout_constraintBottom_toBottomOf="@id/ivTimeReduce"
app:layout_constraintStart_toEndOf="@id/ivTimeReduce"
/>
<ImageView
android:id="@+id/ivTimeAdd"
android:layout_width="@dimen/dp_72"
android:layout_height="@dimen/dp_72"
android:src="@drawable/icon_work_order_add"
app:layout_constraintTop_toTopOf="@id/tvOccurrenceTime"
app:layout_constraintBottom_toBottomOf="@id/tvOccurrenceTime"
app:layout_constraintStart_toEndOf="@id/tvOccurrenceTime"
android:contentDescription="@string/fault_time_add"
/>
<View
android:id="@+id/viewFaultNoteLabel"
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_29"
android:background="#FF0176FF"
app:layout_constraintTop_toBottomOf="@id/ivTimeReduce"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_47"
/>
<TextView
android:id="@+id/tvFaultNoteTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fault_note"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/viewFaultNoteLabel"
app:layout_constraintBottom_toBottomOf="@id/viewFaultNoteLabel"
app:layout_constraintLeft_toRightOf="@id/viewFaultNoteLabel"
android:layout_marginStart="@dimen/dp_14"
/>
<TextView
android:id="@+id/tvFaultNoteSupplement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvFaultNoteTitle"
app:layout_constraintBottom_toBottomOf="@id/tvFaultNoteTitle"
app:layout_constraintLeft_toRightOf="@id/tvFaultNoteTitle"
android:text="@string/fault_note_supplement"
android:textSize="@dimen/sp_30"
android:textColor="#A3ABC0"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etNoteInput"
android:layout_width="@dimen/dp_779"
android:layout_height="@dimen/dp_115"
app:layout_constraintTop_toBottomOf="@id/viewFaultNoteLabel"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:hint="@string/take_over_note_input"
android:textColorHint="#A3ABC0"
android:textCursorDrawable="@drawable/work_order_input_cursor"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
android:gravity="top|start"
android:paddingStart="@dimen/dp_28"
android:paddingTop="@dimen/dp_21"
android:paddingEnd="@dimen/dp_80"
android:layout_marginTop="@dimen/dp_25"
android:background="@drawable/bg_work_order_des_input"
/>
<ImageView
android:id="@+id/ivNoteAudio"
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_59"
android:src="@drawable/icon_work_order_audio"
app:layout_constraintTop_toTopOf="@id/etNoteInput"
app:layout_constraintBottom_toBottomOf="@id/etNoteInput"
app:layout_constraintEnd_toEndOf="@id/etNoteInput"
android:layout_marginEnd="@dimen/dp_30"
android:contentDescription="@string/take_over_note_audio"
/>
<TextView
android:id="@+id/tvFaultReport"
android:layout_width="@dimen/dp_380"
android:layout_height="@dimen/dp_80"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/report_button_bg"
android:text="@string/take_over_report"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_27"
android:textStyle="bold"
android:gravity="center"
android:layout_marginBottom="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_33"
/>
<TextView
android:id="@+id/tvFaultCancel"
android:layout_width="@dimen/dp_380"
android:layout_height="@dimen/dp_80"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:text="@string/take_over_cancel"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_27"
android:textStyle="bold"
android:gravity="center"
android:background="@drawable/icon_cancel_bg"
android:layout_marginBottom="@dimen/dp_40"
android:layout_marginRight="@dimen/dp_33"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFaultList"
android:layout_width="@dimen/dp_0"
android:layout_height="@dimen/dp_0"
app:layout_constraintLeft_toLeftOf="@id/viewFaultType"
app:layout_constraintRight_toRightOf="@id/viewFaultType"
app:layout_constraintTop_toBottomOf="@id/viewFaultType"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_39"
android:visibility="gone"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvUploadSuccess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_406"
app:drawableTopCompat="@drawable/icon_take_over_upload_success"
android:text="@string/report_success"
android:textColor="@color/white"
android:textSize="@dimen/sp_32"
android:drawablePadding="@dimen/dp_40"
android:visibility="gone"
/>
<androidx.constraintlayout.widget.Group
android:id="@+id/faultReasonGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="viewFaultTypeLabel,tvTypeTitle,viewFaultType,tvFaultType,ivFaultTypeSelect,
viewFaultReasonLabel,tvFaultReasonTitle,viewFaultReason,tvFaultReason,ivFaultReasonSelect,
viewFaultTimeLabel,tvFaultTimeTitle,ivTimeReduce,tvOccurrenceTime,ivTimeAdd,
viewFaultNoteLabel,tvFaultNoteTitle,tvFaultNoteSupplement,etNoteInput,ivNoteAudio,
tvFaultReport,tvFaultCancel,rvFaultList"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -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"

View File

@@ -55,6 +55,10 @@ public final class TimeUtils {
return getSafeDateFormat("yyyyMMdd");
}
public static SimpleDateFormat getYMDFormat(){
return getSafeDateFormat("yyyy年MM月dd日");
}
public static SimpleDateFormat getHourMinSecondFormat(){
return getSafeDateFormat("HH:mm:ss");
}