|
@@ -108,7 +108,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
private var initialized :Boolean = false
|
|
|
private var loaded: Boolean = false
|
|
|
|
|
|
- private var nursingInteId: Int? = null
|
|
|
+ private var nursingInteId: Int = -1
|
|
|
|
|
|
private var clickTime : Long = 0
|
|
|
private var clickSosTime : Long = 0
|
|
@@ -465,6 +465,31 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun enterNursing() {
|
|
|
+ if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
|
+ SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
|
|
|
+ }
|
|
|
+ //room_action_nurse.text = "退出护理"
|
|
|
+ room_action_nurse.setBackgroundResource(R.mipmap.ic_bottom_btn_bg)
|
|
|
+ if (TextUtils.isEmpty(Constant.NursingTitle)) {
|
|
|
+ tv_room_name.text = Constant.ROOM_NAME + StringUtil.getResString(R.string.nursing_title)
|
|
|
+ } else {
|
|
|
+ tv_room_name.text = Constant.ROOM_NAME + " " + Constant.NursingTitle + "..."
|
|
|
+ }
|
|
|
+ tv_room_name.setTextColor(resources.getColor(R.color.nursing_color))
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun exitNursing() {
|
|
|
+ if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
|
+ //SerialPortHelper.setDoorLight(1, "111") //白色
|
|
|
+ DoorLightHelper.resetDoorLight()
|
|
|
+ }
|
|
|
+ //room_action_nurse.text = "进入护理"
|
|
|
+ room_action_nurse.setBackgroundResource(R.mipmap.bg_bottom_btn)
|
|
|
+ tv_room_name.text = Constant.ROOM_NAME
|
|
|
+ tv_room_name.setTextColor(resources.getColor(R.color.main_color))
|
|
|
+ }
|
|
|
+
|
|
|
override fun bindEvent() {
|
|
|
//护理按钮
|
|
|
room_action_nurse.setOnLongClickListener {
|
|
@@ -480,30 +505,17 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
if (Constant.inNursing) {
|
|
|
Constant.inNursing = false
|
|
|
- if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
|
- //SerialPortHelper.setDoorLight(1, "111") //白色
|
|
|
- DoorLightHelper.resetDoorLight()
|
|
|
- }
|
|
|
- //room_action_nurse.text = "进入护理"
|
|
|
- room_action_nurse.setBackgroundResource(R.mipmap.bg_bottom_btn)
|
|
|
- tv_room_name.text = Constant.ROOM_NAME
|
|
|
- tv_room_name.setTextColor(resources.getColor(R.color.main_color))
|
|
|
- if (Constant.DEVICE_ID != -1 && nursingInteId != null) {
|
|
|
+ SettingConfig.setInNursing(activity, false)
|
|
|
+ exitNursing()
|
|
|
+
|
|
|
+ if (Constant.DEVICE_ID != -1 && nursingInteId != -1) {
|
|
|
OtherUtil.sendNursingEnd(Constant.DEVICE_ID, nursingInteId)
|
|
|
}
|
|
|
} else {
|
|
|
Constant.inNursing = true
|
|
|
- if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
|
- SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
|
|
|
- }
|
|
|
- //room_action_nurse.text = "退出护理"
|
|
|
- room_action_nurse.setBackgroundResource(R.mipmap.ic_bottom_btn_bg)
|
|
|
- if (TextUtils.isEmpty(Constant.NursingTitle)) {
|
|
|
- tv_room_name.text = Constant.ROOM_NAME + StringUtil.getResString(R.string.nursing_title)
|
|
|
- } else {
|
|
|
- tv_room_name.text = Constant.ROOM_NAME + " " + Constant.NursingTitle + "..."
|
|
|
- }
|
|
|
- tv_room_name.setTextColor(resources.getColor(R.color.nursing_color))
|
|
|
+ SettingConfig.setInNursing(activity, true)
|
|
|
+ enterNursing()
|
|
|
+
|
|
|
if (Constant.DEVICE_ID != -1) {
|
|
|
OtherUtil.sendNursing(Constant.DEVICE_ID)
|
|
|
}
|
|
@@ -948,6 +960,12 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
ex.printStackTrace()
|
|
|
}
|
|
|
|
|
|
+ Constant.inNursing = SettingConfig.getInNursing(activity)
|
|
|
+ if (Constant.inNursing) {
|
|
|
+ nursingInteId = SettingConfig.getNursingId(activity)
|
|
|
+ enterNursing()
|
|
|
+ }
|
|
|
+
|
|
|
updateSettings(true)
|
|
|
|
|
|
EventBus.getDefault().post(MessageEvent("updateCustom", Constant.EVENT_UPDATE_CUSTOM))
|
|
@@ -1196,6 +1214,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
if (tcpModel.action == TcpAction.SideAction.NURSING) {
|
|
|
val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
|
nursingInteId = interactionVO.id
|
|
|
+ SettingConfig.setNursingId(activity, nursingInteId)
|
|
|
} else {
|
|
|
/*if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
|
DoorLightHelper.handleDoorLight(tcpModel)
|