调整了餐盘柜3种情况处理
This commit is contained in:
@@ -1,16 +1,54 @@
|
||||
package com.sw.platecabinet.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import com.sw.platecabinet.Constants
|
||||
import com.sw.platecabinet.R
|
||||
import com.sw.platecabinet.databinding.FragmentPlateOpenBinding
|
||||
import com.sw.platecabinet.model.response.EquipmentUserInfo
|
||||
|
||||
/**
|
||||
* 餐盘柜打开界面
|
||||
* 餐盘柜提示界面
|
||||
*/
|
||||
class PlateOpenFragment :
|
||||
BaseFragment<FragmentPlateOpenBinding>(FragmentPlateOpenBinding::inflate) {
|
||||
private var totalTimeInMillis: Long = 5 * 1000
|
||||
private var totalTimeInMillis: Long = Constants.AUTO_CLOSE_TIME * 1000
|
||||
internal val KEY_ACTION_TYPE = "actionType"
|
||||
private var info: EquipmentUserInfo? = null
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(userInfo: EquipmentUserInfo?) =
|
||||
PlateOpenFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putParcelable(KEY_ACTION_TYPE, userInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initialize() {
|
||||
arguments?.let {
|
||||
info = it.getParcelable(KEY_ACTION_TYPE)
|
||||
info?.let {
|
||||
if (!it.isBound()) {
|
||||
binding.ivType.setImageResource(R.drawable.ic_tip_warn)
|
||||
binding.tvTitle.text = "暂无餐盘信息"
|
||||
binding.tvSubTitle.text = "请联系管理员"
|
||||
binding.tvTitle.setTextColor(requireContext().getColor(R.color.tip_title_fail))
|
||||
} else if (it.isOtherEquipment()) {
|
||||
binding.ivType.setImageResource(R.drawable.ic_tip_warn)
|
||||
binding.tvTitle.text = "暂无餐盘信息"
|
||||
binding.tvSubTitle.text = "您的餐盘绑定在${it.equipmentName ?: " "}号柜上"
|
||||
binding.tvTitle.setTextColor(requireContext().getColor(R.color.tip_title_fail))
|
||||
} else {
|
||||
binding.ivType.setImageResource(R.drawable.ic_tip_success)
|
||||
binding.tvTitle.text = "柜门开启"
|
||||
binding.tvSubTitle.text = "餐盘取出后请关闭柜门"
|
||||
binding.tvTitle.setTextColor(requireContext().getColor(R.color.tip_title_success))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initCountTime()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user