|
@@ -0,0 +1,219 @@
|
|
|
+package com.wdkl.ncs.android.component.home.activity
|
|
|
+
|
|
|
+import android.util.Log
|
|
|
+import android.view.View
|
|
|
+import com.enation.javashop.net.engine.model.NetState
|
|
|
+import com.google.gson.Gson
|
|
|
+import com.wdkl.ncs.android.component.home.R
|
|
|
+import com.wdkl.ncs.android.component.home.databinding.WatchActivityEventBinding
|
|
|
+import com.wdkl.ncs.android.component.home.databinding.WatchActivityHomeBinding
|
|
|
+import com.wdkl.ncs.android.component.home.launch.HomeLaunch
|
|
|
+import com.wdkl.ncs.android.component.nursehome.common.Constants
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.MediaPlayer
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.TimeTransition
|
|
|
+import com.wdkl.ncs.android.lib.base.BaseActivity
|
|
|
+import com.wdkl.ncs.android.lib.utils.showMessage
|
|
|
+import com.wdkl.ncs.android.middleware.logic.contract.home.WatchHomeActivityContract
|
|
|
+import com.wdkl.ncs.android.middleware.logic.presenter.home.WatchHomeActivityPresenter
|
|
|
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
|
|
|
+import com.wdkl.ncs.android.middleware.tcp.TcpClient
|
|
|
+import com.wdkl.ncs.android.middleware.tcp.channel.EventUtil
|
|
|
+import com.wdkl.ncs.android.middleware.tcp.channel.ImUtil
|
|
|
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
|
|
|
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
|
|
|
+import kotlinx.android.synthetic.main.watch_activity_event.*
|
|
|
+
|
|
|
+class EventActivity : BaseActivity<WatchHomeActivityPresenter, WatchActivityEventBinding>(), WatchHomeActivityContract.View, View.OnClickListener {
|
|
|
+
|
|
|
+ var TAG = EventActivity::class.java.simpleName
|
|
|
+
|
|
|
+ var tcpModel = TcpModel()
|
|
|
+ var interactionVO: InteractionVO? = null
|
|
|
+
|
|
|
+
|
|
|
+ override fun getLayId(): Int {
|
|
|
+ return R.layout.watch_activity_event
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun bindDagger() {
|
|
|
+ HomeLaunch.component.inject(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun init() {
|
|
|
+ tcpModel = intent.getSerializableExtra("TcpModel") as TcpModel
|
|
|
+ interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
|
+
|
|
|
+ //是否已播放 已响应
|
|
|
+// if (interactionVO.actionEnd != null) {
|
|
|
+ Log.e(TAG, "" + (interactionVO!!.actionEnd) + " ")
|
|
|
+ Log.e(TAG, "" + interactionVO!!.actionType + " ")
|
|
|
+ Log.e(TAG, "" + interactionVO!!.data + " ")
|
|
|
+
|
|
|
+ Log.e(TAG, "" + interactionVO!!.actionType + " ")
|
|
|
+ Log.e(TAG, "" + TcpType.IM.name + " ")
|
|
|
+
|
|
|
+
|
|
|
+// //判断是呼入还是呼出 1 分机到主机 2主机到分机
|
|
|
+// if(interactionVO.actionDirectionType == 1){
|
|
|
+// interactionVO.sickbedTv.text = itemData.fromFrameFullName
|
|
|
+// interactionVO.nameTv.text = itemData.fromMemberName
|
|
|
+// //TODO 图标显示不正常 暂时没放完整图标
|
|
|
+// binding.callStatusImagev.setImageResource(R.drawable.hu_ru_yi_jie)
|
|
|
+// }else if(interactionVO.actionDirectionType == 2 || itemData.actionDirectionType == 3){
|
|
|
+// binding.sickbedTv.text = interactionVO.toFrameFullName
|
|
|
+// binding.nameTv.text = interactionVO.toMemberName
|
|
|
+// binding.callStatusImagev.setImageResource(R.drawable.hu_chu_yi_jie)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(itemData.actionType == TcpType.EVENT.name){//事件已经响应 相应的数据
|
|
|
+// binding.playTv.visibility = View.GONE
|
|
|
+// binding.projectTv.visibility = View.VISIBLE
|
|
|
+// binding.conductorNameTv.visibility = View.VISIBLE
|
|
|
+// binding.projectTv.text = interactionVO.data
|
|
|
+// binding.conductorNameTv.text = interactionVO.toMemberName
|
|
|
+// binding.processingTimeTv.text = TimeTransition().stampToDate(interactionVO.actionEnd*1000)
|
|
|
+// binding.projectTv.setBackgroundResource(R.drawable.sp_event_handled)
|
|
|
+// }else if (interactionVO.actionType == TcpType.IM.name){//语音已播放
|
|
|
+//
|
|
|
+// binding.projectTv.visibility = View.GONE
|
|
|
+// binding.playTv.visibility = View.VISIBLE
|
|
|
+// binding.conductorNameTv.visibility = View.GONE
|
|
|
+// binding.playTv.setBackgroundResource(R.drawable.yi_bo_fang)
|
|
|
+// binding.processingTimeTv.text = "已播放"
|
|
|
+//
|
|
|
+// }else if(interactionVO.actionType == TcpType.VOICE.name){ //语音呼叫已接听
|
|
|
+// binding.projectTv.visibility = View.GONE
|
|
|
+// binding.playTv.visibility = View.VISIBLE
|
|
|
+// binding.treatmentStateImagev.visibility = View.GONE
|
|
|
+// binding.processingTimeTv.visibility = View.GONE
|
|
|
+//
|
|
|
+// }else if(interactionVO.actionType == TcpType.VIDEO.name){ //视频呼叫已接听
|
|
|
+//
|
|
|
+// binding.projectTv.visibility = View.GONE
|
|
|
+// binding.playTv.visibility = View.VISIBLE
|
|
|
+// binding.treatmentStateImagev.visibility = View.GONE
|
|
|
+// binding.processingTimeTv.visibility = View.GONE
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// Log.e(TAG, "" + interactionVO.actionEnd+" ")
|
|
|
+// Log.e(TAG, "" + interactionVO.actionType+" ")
|
|
|
+// Log.e(TAG, "" + interactionVO.data+" ")
|
|
|
+// Log.e(TAG, "" + interactionVO.actionDirectionType+" ")
|
|
|
+// //判断是呼入还是呼出 1 分机到主机 2主机到分机
|
|
|
+// if(interactionVO.actionDirectionType == 1){
|
|
|
+// Log.e(TAG, "进入。。。。" )
|
|
|
+// binding.sickbedTv.text = interactionVO.fromFrameFullName
|
|
|
+// binding.nameTv.text = interactionVO.fromMemberName
|
|
|
+// // 图标显示不正常 暂时没放完整图标
|
|
|
+// binding.callStatusImagev.setImageResource(R.drawable.hu_ru_wei_jie)
|
|
|
+// }else if(interactionVO.actionDirectionType == 2 || interactionVO.actionDirectionType == 3){
|
|
|
+// binding.sickbedTv.text = interactionVO.toFrameFullName
|
|
|
+// binding.nameTv.text = interactionVO.toMemberName
|
|
|
+// binding.callStatusImagev.setImageResource(R.drawable.hu_chu_wei_jie)
|
|
|
+// }
|
|
|
+//
|
|
|
+// binding.treatmentStateImagev.setImageResource(R.drawable.wei_chu_li)
|
|
|
+//// binding.callStatusImagev.setImageResource(R.drawable.wei_jie)
|
|
|
+// binding.conductorNameTv.visibility = View.GONE
|
|
|
+// binding.treatmentStateImagev.visibility = View.VISIBLE
|
|
|
+// binding.processingTimeTv.visibility = View.VISIBLE
|
|
|
+// if(itemData.actionType == TcpType.EVENT.name){//事件未处理
|
|
|
+// binding.playTv.visibility = View.GONE
|
|
|
+// binding.projectTv.visibility = View.VISIBLE
|
|
|
+// binding.projectTv.text = interactionVO.data
|
|
|
+// binding.projectTv.setBackgroundResource(R.drawable.sp_event_unhandled_bg)
|
|
|
+// binding.processingTimeTv.text = "未处理"
|
|
|
+// }else if (interactionVO.actionType == TcpType.IM.name){//语音未播放
|
|
|
+// binding.projectTv.visibility = View.GONE
|
|
|
+// binding.playTv.visibility = View.VISIBLE
|
|
|
+// binding.playTv.setBackgroundResource(R.drawable.bo_fang)
|
|
|
+// binding.processingTimeTv.text = "未播放"
|
|
|
+// }else if(interactionVO.actionType == TcpType.VOICE.name){ //语音呼叫未接听
|
|
|
+// binding.projectTv.visibility = View.GONE
|
|
|
+// binding.playTv.visibility = View.GONE
|
|
|
+// binding.treatmentStateImagev.visibility = View.GONE
|
|
|
+// binding.processingTimeTv.visibility = View.GONE
|
|
|
+// }else if(interactionVO.actionType == TcpType.VIDEO.name){ //视频呼叫未接听
|
|
|
+// binding.projectTv.visibility = View.GONE
|
|
|
+// binding.playTv.visibility = View.GONE
|
|
|
+// binding.treatmentStateImagev.visibility = View.GONE
|
|
|
+// binding.processingTimeTv.visibility = View.GONE
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if (interactionVO!!.createDate != null) {
|
|
|
+ call_time_tv.text = TimeTransition().stampToDate(interactionVO!!.createDate * 1000)
|
|
|
+ }
|
|
|
+ sickbed_tv.text = interactionVO!!.fromFrameFullName
|
|
|
+ name_tv.text = interactionVO!!.fromMemberName
|
|
|
+
|
|
|
+ if (interactionVO!!.actionType == TcpType.EVENT.name) {
|
|
|
+ project_tv.visibility = View.VISIBLE
|
|
|
+ play_tv.visibility = View.GONE
|
|
|
+ processing_time_tv.text = "未处理"
|
|
|
+ event_state_tv.text = "未处理"
|
|
|
+ } else if (interactionVO!!.actionType == TcpType.IM.name) {
|
|
|
+ play_tv.visibility = View.VISIBLE
|
|
|
+ project_tv.visibility = View.GONE
|
|
|
+ processing_time_tv.text = "未播放"
|
|
|
+ event_state_tv.text = "未播放"
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ event_button_relyout.setOnClickListener(this)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun bindEvent() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun destory() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun render() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onError(message: String, type: Int) {
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun complete(message: String, type: Int) {
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun start() {
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun networkMonitor(state: NetState) {
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onClick(p0: View?) {
|
|
|
+ if (interactionVO!!.actionType == TcpType.EVENT.name) {
|
|
|
+ if (!Constants.ids.equals("")) {
|
|
|
+ var eventTcpModel = EventUtil.eventResponse(Constants.ids.toInt(), interactionVO!!.fromDeviceId, interactionVO!!.id)
|
|
|
+ TcpClient.getInstance().sendMsg(eventTcpModel.toJson())
|
|
|
+ } else {
|
|
|
+ showMessage("获取不到当给前设备id")
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (interactionVO!!.actionType == TcpType.IM.name) {
|
|
|
+ if (!Constants.ids.equals("")) {
|
|
|
+ var imUtilTcpModel = ImUtil.imRead(Constants.ids.toInt(), interactionVO!!.fromDeviceId, interactionVO!!.id)
|
|
|
+ TcpClient.getInstance().sendMsg(imUtilTcpModel.toJson())
|
|
|
+ var mediaPlayer = MediaPlayer()
|
|
|
+ mediaPlayer.startMediaPlayer(Constants.eth_ip + interactionVO!!.data)
|
|
|
+ mediaPlayer.setVolume(0.3f)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ showMessage("获取不到当给前设备id")
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|