[6.6.0]修改故障弹窗
This commit is contained in:
@@ -24,6 +24,7 @@ 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
|
||||
@@ -97,10 +98,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
|
||||
private lateinit var tvFaultTitle: TextView
|
||||
private lateinit var tvFaultTime: TextView
|
||||
private lateinit var tbFaultType: ToggleButton
|
||||
private lateinit var tbFaultReason: ToggleButton
|
||||
private lateinit var viewFaultReason: View
|
||||
private lateinit var ivFaultReason: ImageView
|
||||
private lateinit var tvFaultType: AppCompatTextView
|
||||
private lateinit var tvFaultReason: AppCompatTextView
|
||||
private lateinit var ivTimeReduce: ImageView
|
||||
private lateinit var tvOccurrenceTime: TextView
|
||||
private lateinit var ivTimeAdd: ImageView
|
||||
@@ -126,11 +125,17 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
private val reportType: Int = 1 //上报方式:0:小程序 1:司机屏 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 val type = 1 //故障类接口请求Type值为1
|
||||
|
||||
init {
|
||||
initFloatWindow()
|
||||
}
|
||||
@@ -160,10 +165,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
private fun initView(){
|
||||
tvFaultTitle = mFloatLayout.findViewById(R.id.tvFaultTitle)
|
||||
tvFaultTime = mFloatLayout.findViewById(R.id.tvFaultTime)
|
||||
tbFaultType = mFloatLayout.findViewById(R.id.tbFaultType)
|
||||
tbFaultReason = mFloatLayout.findViewById(R.id.tbFaultReason)
|
||||
viewFaultReason = mFloatLayout.findViewById(R.id.viewFaultReason)
|
||||
ivFaultReason = mFloatLayout.findViewById(R.id.ivFaultReason)
|
||||
tvFaultType = mFloatLayout.findViewById(R.id.tvFaultType)
|
||||
tvFaultReason = mFloatLayout.findViewById(R.id.tvFaultReason)
|
||||
ivTimeReduce = mFloatLayout.findViewById(R.id.ivTimeReduce)
|
||||
tvOccurrenceTime = mFloatLayout.findViewById(R.id.tvOccurrenceTime)
|
||||
ivTimeAdd = mFloatLayout.findViewById(R.id.ivTimeAdd)
|
||||
@@ -182,30 +185,24 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
override fun onSelectReason(reason: CategoryInfo, mSource: Int) {
|
||||
if(mSource == 1){
|
||||
//类型
|
||||
tbFaultType.textOn = reason.name
|
||||
tbFaultType.textOff = reason.name
|
||||
tvFaultType.text = reason.name
|
||||
//选择了故障类型
|
||||
tbFaultReason.visibility = View.VISIBLE
|
||||
viewFaultReason.visibility = View.GONE
|
||||
ivFaultReason.visibility = View.GONE
|
||||
tbFaultType.performClick()
|
||||
tvFaultType.performClick()
|
||||
if(level2Id != 0 && level2Id == reason.id){
|
||||
//故障类型选择没有变化
|
||||
reasonList?.let { orderReasonAdapter.setData(it,2) }
|
||||
}else{
|
||||
level2Id = reason.id
|
||||
level2Name = reason.name
|
||||
tbFaultReason.textOn = ""
|
||||
tbFaultReason.textOff = ""
|
||||
|
||||
source = 2
|
||||
//获取故障三级分类即故障原因
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,1,0)
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,type,0)
|
||||
}
|
||||
}else{
|
||||
//原因
|
||||
tbFaultReason.textOn = reason.name
|
||||
tbFaultReason.textOff = reason.name
|
||||
tbFaultReason.performClick()
|
||||
tvFaultReason.text = reason.name
|
||||
tvFaultReason.performClick()
|
||||
level3Id = reason.id
|
||||
level3Name = reason.name
|
||||
}
|
||||
@@ -223,51 +220,70 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
val iconUp = ContextCompat.getDrawable(mActivity, R.drawable.icon_fault_retract)
|
||||
iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight)
|
||||
//获取一级分类
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,1,0)
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,type,0)
|
||||
//弹窗展示时间
|
||||
tvFaultTime.text = mActivity.resources.getString(R.string.take_over_time) +
|
||||
millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
|
||||
//故障类型选择
|
||||
tbFaultType.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
buttonView.setCompoundDrawables(null, null, iconUp, null)
|
||||
tvFaultType.setOnClickListener {
|
||||
if(!hasLevel2){
|
||||
ToastUtils.showShort("运营后台没有配置故障类型")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if(faultTypeSelectStatus){
|
||||
//关闭
|
||||
faultTypeSelectStatus = false
|
||||
tvFaultType.setCompoundDrawables(null, null, iconDown, null)
|
||||
//隐藏列表
|
||||
rvFaultList.visibility = View.GONE
|
||||
}else{
|
||||
//如果故障原因此时为打开状态,则关闭
|
||||
if(faultReasonSelectStatus){
|
||||
tvFaultReason.performClick()
|
||||
}
|
||||
//打开
|
||||
faultTypeSelectStatus = true
|
||||
tvFaultType.setCompoundDrawables(null, null, iconUp, null)
|
||||
//展示列表
|
||||
rvFaultList.visibility = View.VISIBLE
|
||||
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tbFaultType
|
||||
tbFaultReason.visibility = View.INVISIBLE
|
||||
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultType
|
||||
source = 1
|
||||
if(typeList.isNullOrEmpty()){
|
||||
//获取故障二级分类即故障类型
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,1,0)
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
|
||||
}else{
|
||||
orderReasonAdapter.setData(typeList!!,source)
|
||||
}
|
||||
|
||||
} else {
|
||||
buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
//隐藏列表
|
||||
rvFaultList.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
viewFaultReason.setOnClickListener {
|
||||
ToastUtils.showShort("请先选择故障类型")
|
||||
}
|
||||
ivFaultReason.setOnClickListener {
|
||||
ToastUtils.showShort("请先选择故障类型")
|
||||
}
|
||||
//故障原因选择
|
||||
tbFaultReason.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
buttonView.setCompoundDrawables(null, null, iconUp, null)
|
||||
//展示列表
|
||||
rvFaultList.visibility = View.VISIBLE
|
||||
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tbFaultReason
|
||||
} else {
|
||||
buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
tvFaultReason.setOnClickListener {
|
||||
if(tvFaultType.text.isEmpty()){
|
||||
ToastUtils.showShort("请先选择故障类型")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if(faultReasonSelectStatus){
|
||||
//关闭
|
||||
faultReasonSelectStatus = false
|
||||
tvFaultReason.setCompoundDrawables(null, null, iconDown, null)
|
||||
//隐藏列表
|
||||
rvFaultList.visibility = View.GONE
|
||||
}else{
|
||||
//打开
|
||||
faultReasonSelectStatus = true
|
||||
tvFaultReason.setCompoundDrawables(null, null, iconUp, null)
|
||||
//展示列表
|
||||
rvFaultList.visibility = View.VISIBLE
|
||||
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultReason
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//发生时间
|
||||
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
|
||||
ivTimeReduce.setOnClickListener {
|
||||
@@ -544,7 +560,6 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
rvFaultList.visibility = View.GONE
|
||||
tvUploadSuccess.visibility = View.VISIBLE
|
||||
faultReasonGroup.visibility = View.GONE
|
||||
tbFaultReason.visibility = View.GONE
|
||||
val successHandler = Handler(Looper.getMainLooper())
|
||||
successHandler.postDelayed({
|
||||
hideFloatWindow()
|
||||
@@ -567,10 +582,11 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
|
||||
source = 1
|
||||
//获取故障二级分类即故障类型
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,1,0)
|
||||
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
|
||||
}else{
|
||||
if(source == 1){
|
||||
typeList = list
|
||||
hasLevel2 = true
|
||||
}else{
|
||||
reasonList = list
|
||||
hasLevel3 = true
|
||||
@@ -581,6 +597,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
if(source == 2){
|
||||
hasLevel3 = false
|
||||
}else{
|
||||
hasLevel2 = false
|
||||
ToastUtils.showShort("故障类型列表为空")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
android:layout_marginStart="@dimen/dp_14"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbFaultType"
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tvFaultType"
|
||||
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: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/tbFaultType"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFaultType"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_48"
|
||||
@@ -110,48 +108,21 @@
|
||||
android:layout_marginStart="@dimen/dp_14"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbFaultReason"
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tvFaultReason"
|
||||
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/viewFaultReason"
|
||||
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/ivFaultReason"
|
||||
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:contentDescription="@string/fault_reason_select"
|
||||
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"
|
||||
/>
|
||||
|
||||
<View
|
||||
@@ -159,7 +130,7 @@
|
||||
android:layout_width="@dimen/dp_6"
|
||||
android:layout_height="@dimen/dp_29"
|
||||
android:background="#FF0176FF"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbFaultReason"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFaultReason"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_48"
|
||||
@@ -319,9 +290,9 @@
|
||||
android:id="@+id/rvFaultList"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tbFaultType"
|
||||
app:layout_constraintRight_toRightOf="@id/tbFaultType"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbFaultType"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvFaultType"
|
||||
app:layout_constraintRight_toRightOf="@id/tvFaultType"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFaultType"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_39"
|
||||
android:background="@drawable/bg_reason_list"
|
||||
@@ -350,12 +321,11 @@
|
||||
android:id="@+id/faultReasonGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="viewFaultTypeLabel,tvTypeTitle,tbFaultType,
|
||||
app:constraint_referenced_ids="viewFaultTypeLabel,tvTypeTitle,tvFaultType,
|
||||
viewFaultReasonLabel,tvFaultReasonTitle,viewFaultTimeLabel,
|
||||
tvFaultTimeTitle,ivTimeReduce,tvOccurrenceTime,ivTimeAdd,
|
||||
viewFaultNoteLabel,tvFaultNoteTitle,tvFaultNoteSupplement,
|
||||
etNoteInput,ivNoteAudio,tvFaultReport,tvFaultCancel,
|
||||
viewFaultReason,ivFaultReason"
|
||||
etNoteInput,ivNoteAudio,tvFaultReport,tvFaultCancel,tvFaultReason"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user