Quellcode durchsuchen

添加事件界面

wangjk vor 4 Jahren
Ursprung
Commit
1fa9112c22

+ 219 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/activity/EventActivity.kt

@@ -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")
+            }
+
+        }
+
+    }
+
+
+}

+ 2 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/di/HomeComponent.kt

@@ -30,4 +30,6 @@ interface HomeComponent {
 
     fun inject(activity: WatchRegisterActivity)
 
+    fun inject(activity: EventActivity)
+
 }

BIN
home/src/main/res/drawable-hdpi/wei_chu_li_bg.png


BIN
home/src/main/res/drawable-hdpi/yi_chu_li_bg.png


BIN
home/src/main/res/drawable-hdpi/yu_yin_wei_chu_li.png


BIN
home/src/main/res/drawable-mdpi/wei_chu_li_bg.png


BIN
home/src/main/res/drawable-mdpi/yi_chu_li_bg.png


BIN
home/src/main/res/drawable-mdpi/yu_yin_wei_chu_li.png


+ 160 - 0
home/src/main/res/layout/watch_activity_event.xml

@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#FBE5E8">
+
+        <LinearLayout
+            android:id="@+id/tab_linyout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="9px"
+            android:orientation="vertical">
+
+            <ImageView
+                android:id="@+id/tab_imagev"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/bao_ma_tou_xiang" />
+
+            <ImageView
+                android:id="@+id/call_status_imagev"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="2px"
+                android:visibility="gone" />
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginTop="4px"
+            android:layout_marginRight="9px"
+            android:layout_toRightOf="@+id/tab_linyout">
+
+            <RelativeLayout
+                android:id="@+id/room_name_linlyout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="6px">
+
+                <TextView
+                    android:id="@+id/sickbed_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="05房01床"
+                    android:textSize="14px" />
+
+                <TextView
+                    android:id="@+id/call_time_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentRight="true"
+                    android:text="12:00:00"
+                    android:textSize="12px" />
+
+            </RelativeLayout>
+
+            <RelativeLayout
+                android:id="@+id/nursing_project_relalyout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_below="@+id/room_name_linlyout"
+                android:layout_marginLeft="6px"
+                android:layout_marginTop="4px"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/name_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="zhangx"
+                    android:textSize="14px" />
+
+                <LinearLayout
+                    android:id="@+id/incident_linlyou"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentRight="true"
+                    android:orientation="horizontal">
+
+                    <ImageView
+                        android:id="@+id/treatment_state_imagev"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center"
+                        android:layout_marginRight="6px"
+                        android:src="@drawable/yi_chu_li"
+                        android:visibility="gone" />
+
+
+                    <TextView
+                        android:id="@+id/project_tv"
+                        android:layout_width="59px"
+                        android:layout_height="20px"
+                        android:background="@drawable/sp_event_handled"
+                        android:gravity="center"
+                        android:text="啊哈哈"
+                        android:textSize="12px" />
+
+                    <ImageView
+                        android:id="@+id/play_tv"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:background="@drawable/wei_bo_fang"
+                        android:gravity="center"
+                        android:visibility="gone" />
+
+                </LinearLayout>
+            </RelativeLayout>
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@+id/nursing_project_relalyout"
+                android:layout_alignParentRight="true"
+                android:layout_marginTop="4px"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:id="@+id/conductor_name_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginRight="10px"
+                    android:text="处理人"
+                    android:textSize="12px"
+                    android:visibility="gone" />
+
+                <TextView
+                    android:id="@+id/processing_time_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="12:00:00"
+                    android:textSize="12px" />
+            </LinearLayout>
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/event_button_relyout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_centerHorizontal="true"
+            android:background="@drawable/wei_chu_li_bg">
+
+            <TextView
+                android:id="@+id/event_state_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerInParent="true"
+                android:text="未处理"
+                android:textSize="8sp" />
+
+
+        </RelativeLayout>
+
+    </RelativeLayout>
+</layout>