[6.6.0]接管弹窗修改

This commit is contained in:
xuxinchao
2024-08-29 16:50:25 +08:00
parent a4bdb31dc8
commit 7821a5bc41
2 changed files with 73 additions and 127 deletions

View File

@@ -19,11 +19,9 @@ import android.view.animation.ScaleAnimation
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import android.widget.ToggleButton
import androidx.appcompat.widget.AppCompatEditText
import androidx.appcompat.widget.AppCompatTextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.Group
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -82,28 +80,28 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
private var clickListener: ClickListener? = null
private lateinit var tvTakeOverTime: TextView
private lateinit var tbTakeOverType: ToggleButton
private lateinit var tbTakeOverReason: ToggleButton
private lateinit var viewTakeOverReason: View
private lateinit var ivTakeOverReason: ImageView
private lateinit var tvTakeOverType: AppCompatTextView
private lateinit var tvTakeOverReason: AppCompatTextView
private lateinit var etNoteInput: AppCompatEditText
private lateinit var ivNoteAudio: ImageView
private lateinit var tvTakeOverSave: TextView
private lateinit var tvTakeOverCancel: TextView
private lateinit var rvTakeOverList: RecyclerView
private lateinit var tvUploadSuccess: AppCompatTextView
private lateinit var takeOverReasonGroup: Group
private lateinit var orderReasonAdapter: OrderReasonAdapter
private lateinit var mTakeOverRecordInfo: TakeOverRecordInfo
private val type = 2 //接管类接口请求Type值为2
private var source: Int = 0 //操作源0:默认,一级分类 1:类型二级分类2:原因,三级分类
private var hasLevel2: Boolean = false //是否有二级分类
private var hasLevel3: Boolean = false //是否有三级分类
private var typeList: List<CategoryInfo> ?= null //故障类型列表
private var reasonList: List<CategoryInfo> ?= null //故障原因列表
private var faultTypeSelectStatus: Boolean = false //故障类型选择状态
private var faultReasonSelectStatus: Boolean = false //故障原因选择状态
private var level1Id: Int = 0 //一级分类ID
private var level2Id: Int = 0 //二级分类ID
private var level3Id: Int = 0 //三级分类ID
@@ -139,17 +137,13 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
private fun initView(){
tvTakeOverTime = mFloatLayout.findViewById(R.id.tvTakeOverTime)
tbTakeOverType = mFloatLayout.findViewById(R.id.tbTakeOverType)
tbTakeOverReason = mFloatLayout.findViewById(R.id.tbTakeOverReason)
viewTakeOverReason = mFloatLayout.findViewById(R.id.viewTakeOverReason)
ivTakeOverReason = mFloatLayout.findViewById(R.id.ivTakeOverReason)
tvTakeOverType = mFloatLayout.findViewById(R.id.tvTakeOverType)
tvTakeOverReason = mFloatLayout.findViewById(R.id.tvTakeOverReason)
etNoteInput = mFloatLayout.findViewById(R.id.etNoteInput)
ivNoteAudio = mFloatLayout.findViewById(R.id.ivNoteAudio)
tvTakeOverSave = mFloatLayout.findViewById(R.id.tvTakeOverSave)
tvTakeOverCancel = mFloatLayout.findViewById(R.id.tvTakeOverCancel)
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
@@ -158,30 +152,23 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
override fun onSelectReason(reason: CategoryInfo, mSource: Int) {
if(mSource == 1){
//类型
tbTakeOverType.textOn = reason.name
tbTakeOverType.textOff = reason.name
//选择了故障类型
tbTakeOverReason.visibility = View.VISIBLE
viewTakeOverReason.visibility = View.GONE
ivTakeOverReason.visibility = View.GONE
tbTakeOverType.performClick()
tvTakeOverType.text = reason.name
//选择了接管类型
tvTakeOverType.performClick()
if(level2Id != 0 && level2Id == reason.id){
//故障类型选择没有变化
reasonList?.let { orderReasonAdapter.setData(it,2) }
}else{
level2Id = reason.id
level2Name = reason.name
tbTakeOverReason.textOn = ""
tbTakeOverReason.textOff = ""
source = 2
//获取故障三级分类即故障原因
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,type,0)
}
}else{
//原因
tbTakeOverReason.textOn = reason.name
tbTakeOverReason.textOff = reason.name
tbTakeOverReason.performClick()
tvTakeOverReason.text = reason.name
tvTakeOverReason.performClick()
level3Id = reason.id
level3Name = reason.name
}
@@ -200,47 +187,60 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
//获取一级分类
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,type,0)
//接管类型选择
tbTakeOverType.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconUp, null)
tvTakeOverType.setOnClickListener {
if(!hasLevel2){
ToastUtils.showShort("运营后台没有配置接管类型")
return@setOnClickListener
}
if(faultTypeSelectStatus){
//关闭
faultTypeSelectStatus = false
tvTakeOverType.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvTakeOverList.visibility = View.GONE
}else{
//如果故障原因此时为打开状态,则关闭
if(faultReasonSelectStatus){
tvTakeOverReason.performClick()
}
//打开
faultTypeSelectStatus = true
tvTakeOverType.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvTakeOverList.visibility = View.VISIBLE
(rvTakeOverList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tbTakeOverType
tbTakeOverReason.visibility = View.INVISIBLE
(rvTakeOverList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvTakeOverType
source = 1
if(typeList.isNullOrEmpty()){
//获取故障二级分类即故障类型
//获取故障二级分类即接管类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
orderReasonAdapter.setData(typeList!!,source)
}
} else {
buttonView.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvTakeOverList.visibility = View.GONE
}
}
viewTakeOverReason.setOnClickListener {
ToastUtils.showShort("请先选择接管类型")
}
ivTakeOverReason.setOnClickListener {
ToastUtils.showShort("请先选择接管类型")
}
//接管原因选择
tbTakeOverReason.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvTakeOverList.visibility = View.VISIBLE
(rvTakeOverList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tbTakeOverReason
} else {
buttonView.setCompoundDrawables(null, null, iconDown, null)
tvTakeOverReason.setOnClickListener {
if(tvTakeOverType.text.isEmpty()){
ToastUtils.showShort("请先选择接管类型")
return@setOnClickListener
}
if(faultReasonSelectStatus){
//关闭
faultReasonSelectStatus = false
tvTakeOverReason.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvTakeOverList.visibility = View.GONE
}else{
//打开
faultReasonSelectStatus = true
tvTakeOverReason.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvTakeOverList.visibility = View.VISIBLE
(rvTakeOverList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvTakeOverReason
}
}
//补充描述
etNoteInput.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
val edit = v as EditText
@@ -477,11 +477,12 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
level1Name = list[0].name
source = 1
//获取故障二级分类即故障类型
//获取故障二级分类即接管类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
if(source == 1){
typeList = list
hasLevel2 = true
}else{
reasonList = list
hasLevel3 = true
@@ -492,6 +493,7 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
if(source == 2){
hasLevel3 = false
}else{
hasLevel2 = false
ToastUtils.showShort("接管类型列表为空")
}
}

View File

@@ -65,8 +65,8 @@
android:layout_marginStart="@dimen/dp_14"
/>
<ToggleButton
android:id="@+id/tbTakeOverType"
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvTakeOverType"
android:layout_width="@dimen/dp_781"
android:layout_height="@dimen/dp_70"
app:layout_constraintLeft_toLeftOf="parent"
@@ -74,15 +74,13 @@
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_203"
android:background="@drawable/bg_fault_type"
android:drawableEnd="@drawable/icon_fault_expand"
android:textOff=""
android:textOn=""
android:gravity="start|center_vertical"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
android:elevation="@dimen/dp_10"
android:textSize="@dimen/sp_30"
android:gravity="start|center_vertical"
android:textColor="@color/white"
android:paddingStart="@dimen/dp_21"
android:paddingEnd="@dimen/dp_21"
app:drawableEndCompat="@drawable/icon_fault_expand"
/>
<View
@@ -90,7 +88,7 @@
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_29"
android:background="#FF0176FF"
app:layout_constraintTop_toBottomOf="@id/tbTakeOverType"
app:layout_constraintTop_toBottomOf="@id/tvTakeOverType"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_48"
@@ -110,48 +108,22 @@
android:layout_marginStart="@dimen/dp_14"
/>
<ToggleButton
android:id="@+id/tbTakeOverReason"
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvTakeOverReason"
android:layout_width="@dimen/dp_781"
android:layout_height="@dimen/dp_70"
android:background="@drawable/bg_fault_type"
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"
android:drawableEnd="@drawable/icon_fault_expand"
android:textOff=""
android:textOn=""
android:gravity="start|center_vertical"
android:elevation="@dimen/dp_10"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
android:paddingStart="@dimen/dp_21"
android:paddingEnd="@dimen/dp_21"
android:visibility="invisible"
/>
<View
android:id="@+id/viewTakeOverReason"
android:layout_width="@dimen/dp_781"
android:layout_height="@dimen/dp_70"
android:background="@drawable/bg_fault_type"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_374"
/>
<ImageView
android:id="@+id/ivTakeOverReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/viewTakeOverReason"
app:layout_constraintBottom_toBottomOf="@id/viewTakeOverReason"
app:layout_constraintRight_toRightOf="@id/viewTakeOverReason"
android:src="@drawable/icon_fault_expand"
android:contentDescription="@string/take_over_reason"
android:layout_marginRight="@dimen/dp_21"
app:drawableEndCompat="@drawable/icon_fault_expand"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
android:gravity="center_vertical"
/>
@@ -160,7 +132,7 @@
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_29"
android:background="#FF0176FF"
app:layout_constraintTop_toBottomOf="@id/tbTakeOverReason"
app:layout_constraintTop_toBottomOf="@id/tvTakeOverReason"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_47"
@@ -260,9 +232,9 @@
android:id="@+id/rvTakeOverList"
android:layout_width="@dimen/dp_0"
android:layout_height="@dimen/dp_0"
app:layout_constraintLeft_toLeftOf="@id/tbTakeOverType"
app:layout_constraintRight_toRightOf="@id/tbTakeOverType"
app:layout_constraintTop_toBottomOf="@id/tbTakeOverType"
app:layout_constraintLeft_toLeftOf="@id/tvTakeOverType"
app:layout_constraintRight_toRightOf="@id/tvTakeOverType"
app:layout_constraintTop_toBottomOf="@id/tvTakeOverType"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_39"
android:background="@drawable/bg_reason_list"
@@ -271,32 +243,4 @@
android:paddingTop="@dimen/dp_5"
/>
<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/takeOverReasonGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="viewTakeOverTypeLabel,tvTypeTitle,
tbTakeOverType,viewTakeOverReasonLabel,tvTakeOverReasonTitle,
viewTakeOverReason,ivTakeOverReason,viewTakeOverNoteLabel,tvTakeOverNoteTitle,
tvTakeOverNoteSupplement,etNoteInput,ivNoteAudio,
tvTakeOverReport,tvTakeOverCancel"
/>
</androidx.constraintlayout.widget.ConstraintLayout>