Browse Source

## [1.1.20] version 39 - 2020-08-05
### Changed
- 优化事件、语音留言和SOS的详情展示及接入

allen 3 years ago
parent
commit
c3d65e4fbc

+ 2 - 2
build.gradle

@@ -47,12 +47,12 @@ buildscript {
     /**
      * APP版本码
      */
-    ext.app_version_code = 38
+    ext.app_version_code = 39
 
     /**
      * APP版本号
      */
-    ext.app_version = "1.1.19"
+    ext.app_version = "1.1.20"
 
     /**
      * 项目依赖库

+ 1 - 0
home/src/main/AndroidManifest.xml

@@ -30,6 +30,7 @@
         <activity android:name=".activity.WebRTCVoipAudioActivity" />
         <activity android:name=".activity.WebRTCVoipAudioRingingActivity" />
         <activity android:name=".activity.AppUpdateActivity" />
+        <activity android:name=".activity.NewEventListActivity"/>
 
         <service android:name="com.wdkl.ncs.android.component.home.service.WdKeepAliveService">
             <intent-filter>

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

@@ -0,0 +1,257 @@
+package com.wdkl.ncs.android.component.home.activity
+
+import android.content.Context
+import android.os.VibrationEffect
+import android.os.Vibrator
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.android.jrouter.external.annotation.Autowired
+import com.enation.javashop.android.jrouter.external.annotation.Router
+import com.enation.javashop.net.engine.model.NetState
+import com.google.common.base.Strings
+import com.google.gson.Gson
+import com.wdkl.ncs.android.component.home.R
+import com.wdkl.ncs.android.component.home.adapter.NewEventItemAdapter
+import com.wdkl.ncs.android.component.home.databinding.ActivityEventListBinding
+import com.wdkl.ncs.android.component.home.launch.HomeLaunch
+import com.wdkl.ncs.android.component.home.service.WdKeepAliveService
+import com.wdkl.ncs.android.component.home.util.MediaPlayHelper
+import com.wdkl.ncs.android.component.home.util.SpeechUtil
+import com.wdkl.ncs.android.component.home.util.Util
+import com.wdkl.ncs.android.lib.base.BaseActivity
+import com.wdkl.ncs.android.lib.utils.AppTool
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.home.NewEventListContract
+import com.wdkl.ncs.android.middleware.logic.presenter.home.NewEventListPresenter
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.activity_event_list.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+class NewEventListActivity : BaseActivity<NewEventListPresenter,ActivityEventListBinding>(),NewEventListContract.View {
+    var TAG = NewEventListActivity::class.java.getSimpleName()
+
+    lateinit var mVibrator: Vibrator
+
+    private val adapter = NewEventItemAdapter(ArrayList(),this)
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+
+    //参数自动注入
+    @Autowired(name = "tcpModelStr", required = true)
+    @JvmField
+    var tcpModelStr:String = ""
+    @Autowired(name = "boolVibrator", required = false)
+    @JvmField
+    var boolVibrator = false
+
+    var listData = ArrayList<InteractionVO>()
+
+    override fun getLayId(): Int {
+        return R.layout.activity_event_list
+    }
+
+    override fun bindDagger() {
+        HomeLaunch.component.inject(this)
+    }
+
+    override fun init() {
+        //震动
+        mVibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
+        if (boolVibrator) {
+            handleVibrator()
+        }
+
+        val tcpModel = TcpModel.getModelByJson(tcpModelStr)
+        val interactionVO = Gson().fromJson<InteractionVO>(tcpModel.data.toString(),InteractionVO::class.java)
+        listData.add(interactionVO)
+
+        WdKeepAliveService.mNewEventListActive = true
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+        delegateAdapter.addAdapter(adapter)
+        /**配置到RecycleView*/
+        rv_event_list.layoutManager = virtualLayoutManager
+        rv_event_list.adapter = delegateAdapter
+
+        renderData(listData)
+    }
+
+    override fun bindEvent() {
+
+    }
+
+    override fun destory() {
+        MediaPlayHelper.getInstance().stopMusic()
+        mVibrator.cancel()
+        SpeechUtil.getInstance().stopSpeak()
+        WdKeepAliveService.mNewEventListActive = false
+    }
+
+    override fun renderData(data: ArrayList<InteractionVO>) {
+        Log.e(TAG,"返回的数据 "+data.size)
+        data.sortByDescending { it.id }
+        srl_event_list.finishRefresh()
+        if (data.size > 0) {
+            adapter.data.clear()
+            adapter.data.addAll(listData)
+            adapter.notifyDataSetChanged()
+        } else {
+            tv_empty_event.visibility = View.VISIBLE
+            AppTool.Time.delay(1200){
+                finish()
+            }
+        }
+    }
+
+    override fun onError(message: String, type: Int) {
+        finish()
+    }
+
+    override fun complete(message: String, type: Int) {
+
+    }
+
+    override fun start() {
+
+    }
+
+    override fun networkMonitor(state: NetState) {
+
+    }
+
+    private fun handleVibrator(){
+        mVibrator.cancel()
+        //开启振动后 等待0.1s振动 振动2s 等待1s 振动2s 等待1s
+        val pattern = longArrayOf(100, 2000, 1000, 2000)
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
+            mVibrator.vibrate(VibrationEffect.createWaveform(pattern, -1))
+        } else {
+            mVibrator.vibrate(pattern, -1)
+        }
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        if (messageEvent.tag == 2) {
+            mVibrator.cancel()
+            val resTcpModel = messageEvent.getMessage() as TcpModel
+            if (resTcpModel.action == TcpAction.VoiceAction.FAILED) {
+                showMessage("呼叫失败,可能对方不在线")
+            } else if (resTcpModel.action == TcpAction.VoiceAction.CALLING) {
+                showMessage("对方通话中")
+            }
+        } else if (messageEvent.tag == 4) {
+            val resTcpModel = messageEvent.getMessage() as TcpModel
+            if (resTcpModel.type == TcpType.DATA && resTcpModel.action == TcpAction.DataAction.INTERACTION) {
+                if (resTcpModel.data != null) {
+                    dismissDialog()
+                    mVibrator.cancel()
+                    val responseInteractionVO = Gson().fromJson<InteractionVO>(resTcpModel.data.toString(), InteractionVO::class.java)
+                    showMessage("已响应"+responseInteractionVO.fromFrameFullName + " " + responseInteractionVO.data)
+
+                    var doFinish = false
+                    for (it in listData){
+                        if (it.id == responseInteractionVO.id) {
+                            listData.remove(it)
+
+                            if (responseInteractionVO.actionType.equals(TcpType.IM.name)){
+                                AppTool.Time.delay(1000){
+                                    while (MediaPlayHelper.getInstance().isMediaPlaying){
+                                        Thread.sleep(1000)
+                                    }
+                                    adapter.data.remove(it)
+                                    adapter.notifyDataSetChanged()
+                                    if (listData.isEmpty()||listData.size==0){
+                                        AppTool.Time.delay(1200) {
+                                            finish()
+                                        }
+                                    } else {
+                                        renderData(listData)
+                                    }
+                                }
+                            } else {
+                                adapter.data.remove(it)
+                                adapter.notifyDataSetChanged()
+                                doFinish = true
+                            }
+                        }
+                    }
+                    if ((listData.isEmpty()||listData.size==0) && doFinish){
+                        AppTool.Time.delay(1200) {
+                            finish()
+                        }
+                    } else {
+                        renderData(listData)
+                    }
+                }
+            }
+        } else if (messageEvent.tag == 3){ //新事件到来
+            val tcpModel = messageEvent.getMessage() as TcpModel
+            val responseInteractionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+            SpeechUtil.getInstance().stopSpeak()
+            if (tcpModel.type == TcpType.EVENT) {
+                if (tcpModel.action == TcpAction.EventAction.KEY_CLICK) {
+                    listData.add(responseInteractionVO)
+                    renderData(listData)
+                    val eventStr = Util.appendSpace(responseInteractionVO.fromFrameFullName.replace("-", ",")) + ", " + responseInteractionVO.data
+                    SpeechUtil.getInstance().newSpeech("您有新的事件待处理, " + eventStr, false)
+                }
+            } else if (tcpModel.type == TcpType.IM){
+                if (tcpModel.action == TcpAction.IMAction.MSG) {
+                    listData.add(responseInteractionVO)
+                    renderData(listData)
+                    SpeechUtil.getInstance().newSpeech("您有新的语音留言待处理", false)
+                }
+            }
+        } else if (messageEvent.tag == 999){ //SOS
+            val tcpModel = messageEvent.getMessage() as TcpModel
+            if (tcpModel.type == TcpType.SOS) {
+                val responseInteractionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+                if (tcpModel.action === TcpAction.SOSAction.CANCEL) {
+                    MediaPlayHelper.getInstance().stopMusic()
+                    mVibrator.cancel()
+                    if (!Strings.isNullOrEmpty(responseInteractionVO.toRoleName)) {
+                        showMessage(responseInteractionVO.toRoleName + " " + responseInteractionVO.toMemberName + " 已响应")
+                    } else {
+                        showMessage("已响应")
+                    }
+
+                    for (it in listData){
+                        if (it.id == responseInteractionVO.id) {
+                            listData.remove(it)
+                            adapter.data.remove(it)
+                            adapter.notifyDataSetChanged()
+                        }
+                    }
+
+                    if (listData.isEmpty()||listData.size==0){
+                        AppTool.Time.delay(1200) {
+                            finish()
+                        }
+                    } else {
+                        renderData(listData)
+                    }
+
+                } else if (tcpModel.action === TcpAction.SOSAction.CALL) {
+                    listData.add(responseInteractionVO)
+                    renderData(listData)
+
+                    SpeechUtil.getInstance().stopSpeak()
+                    handleVibrator()
+                    MediaPlayHelper.getInstance().stopMusic()
+                    MediaPlayHelper.getInstance().playResMusic(R.raw.sos2, 1.0f, false)
+                }
+            }
+        }
+    }
+}

+ 19 - 2
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchCallRecordsActivity.kt

@@ -157,7 +157,7 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
         watchCallRecordsItemAdapter.setOnItemClickListener { data, position ->
 
             var intent = Intent()
-            intent.setClass(this, WatchEventDetailActivity::class.java)
+            intent.setClass(this, NewEventListActivity::class.java)
             //todo: 不优雅的传输,应该直接传递对象
             var tcpModel = TcpModel()
             if (data.actionType.equals(TcpType.VOICE.name)) {
@@ -172,8 +172,9 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
             tcpModel.action = TcpAction.VoiceAction.SUCCESS
             tcpModel.setData(data)
             intent.putExtra("tcpModelStr", tcpModel.toJson())
+            intent.putExtra("boolVibrator", false)
             startActivity(intent)
-            finish()
+            //finish()
         }
     }
 
@@ -238,6 +239,22 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
     override fun networkMonitor(state: NetState) {
     }
 
+    override fun onResume() {
+        super.onResume()
+        page = 1
+        when(action){
+            all->{
+                presenter.loadPage(all, 1, 30, Constants.deviceId, 0, 0)
+            }
+            unread->{
+                presenter.loadPage(all, 1, 30, Constants.deviceId, 0, 1)
+            }
+            customerRecords->{
+                presenter.loadPage(customerRecords, 1, 30, Constants.deviceId, customerId.toInt(), -1)
+            }
+        }
+    }
+
     fun initCountDownTimer() {
         countDownTimer = object : CountDownTimer(CALL_TIMEOUT * 3000L, 1000) {
             override fun onTick(millisUntilFinished: Long) {

+ 1 - 1
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchEventDetailActivity.kt

@@ -118,7 +118,7 @@ class WatchEventDetailActivity : BaseActivity<WatchHomeActivityPresenter, WatchA
             countDownTimer.start()
             if (tcpModel?.type == TcpType.EVENT) {
                 loadingDialog.show()
-                var tcpModel = EventUtil.eventResponse(Constants.deviceId, interactionVO!!.fromDeviceId, interactionVO!!.id)
+                val tcpModel = EventUtil.eventResponse(Constants.deviceId, interactionVO!!.fromDeviceId, interactionVO!!.id)
                 TcpClient.getInstance().sendMsg(tcpModel.toJson())
             } else if (tcpModel?.type == TcpType.IM) {
                 //todo: 语音播放

+ 151 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/adapter/NewEventItemAdapter.kt

@@ -0,0 +1,151 @@
+package com.wdkl.ncs.android.component.home.adapter
+
+import android.content.Context
+import android.graphics.Color
+import android.os.Handler
+import android.view.View
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.enation.javashop.utils.base.tool.CommonTool
+import com.enation.javashop.utils.base.widget.LoadingDialog
+import com.google.gson.Gson
+import com.umeng.socialize.a.b.d.l
+import com.umeng.weixin.handler.r
+import com.wdkl.ncs.android.component.home.R
+import com.wdkl.ncs.android.component.home.databinding.EventListItemBinding
+import com.wdkl.ncs.android.component.home.util.MediaPlayHelper
+import com.wdkl.ncs.android.component.home.util.Util
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.util.TimeTransition
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.api.ApiManager
+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.channel.OtherUtil
+import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import org.greenrobot.eventbus.EventBus
+
+
+class NewEventItemAdapter(var data:ArrayList<InteractionVO>, val context: Context) : BaseDelegateAdapter<BaseRecyclerViewHolder<EventListItemBinding>, InteractionVO>() {
+
+    private lateinit var loadingDialog: LoadingDialog
+
+    override fun dataProvider(): Any {
+        return data
+    }
+
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<EventListItemBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.event_list_item)
+    }
+
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        loadingDialog = CommonTool.createLoadingDialog(context, R.layout.custom_loading, R.id.loadding_image)
+        return LinearLayoutHelper(0,data.size)
+    }
+
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<EventListItemBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+
+            binding.eliEventTime.text = TimeTransition().stampToDate(itemData.createDate*1000)
+            binding.eliRoomName.text = itemData.fromFrameFullName
+            binding.eliMemberName.text = itemData.fromMemberName
+
+            when (itemData.actionType){
+                TcpType.EVENT.name->{
+                    binding.eliImRead.visibility = View.GONE
+                    binding.eliEventResponse.visibility = View.VISIBLE
+                    binding.eliEventName.text = itemData.data
+                    if (itemData.actionEnd!=null){
+                        binding.eliEventResponse.visibility = View.GONE
+                        binding.eliEventName.setTextColor(Color.GREEN)
+                    } else {
+                        binding.eliEventName.setTextColor(context.resources.getColor(R.color.warn_orange))
+                        binding.eliEventResponse.setOnClickListener {
+                            loadingDialog.show()
+                            val tcpModel = EventUtil.eventResponse(Constants.deviceId, itemData.fromDeviceId, itemData.id)
+                            TcpClient.getInstance().sendMsg(tcpModel.toJson())
+                            Handler().postDelayed({
+                                loadingDialog.dismiss()
+                            }, 1000)
+                        }
+                    }
+                }
+                TcpType.IM.name->{
+                    binding.eliEventName.text = "语音留言"
+                    binding.eliEventResponse.visibility = View.GONE
+                    if (itemData.actionEnd!=null){
+                        binding.eliEventResponse.visibility = View.GONE
+                        binding.eliImRead.visibility = View.VISIBLE
+                        binding.eliEventName.setTextColor(Color.GREEN)
+
+                        binding.eliImRead.setOnClickListener {
+                            MediaPlayHelper.getInstance().playUrlMusic(ApiManager.urlManager.device_url + itemData.data, 1f, false)
+                        }
+                    } else {
+                        binding.eliEventName.setTextColor(context.resources.getColor(R.color.warn_orange))
+                        binding.eliImRead.visibility = View.VISIBLE
+
+                        binding.eliImRead.setOnClickListener {
+                            MediaPlayHelper.getInstance().playUrlMusic(ApiManager.urlManager.device_url + itemData.data, 1f, false)
+                            val tcpModel = ImUtil.imRead(Constants.deviceId, itemData.fromDeviceId, itemData.id)
+                            TcpClient.getInstance().sendMsg(tcpModel.toJson())
+                        }
+                    }
+                }
+                TcpType.SOS.name->{
+                    binding.eliEventName.setTextColor(context.resources.getColor(R.color.warn_orange))
+                    binding.eliImRead.visibility = View.GONE
+                    binding.eliEventResponse.visibility = View.VISIBLE
+                    binding.eliEventName.text = "SOS"
+//                    binding.eliEventName.setBackgroundResource(R.drawable.sos_96)
+                    if (itemData.actionEnd!=null){
+                        binding.eliEventResponse.visibility = View.GONE
+                        binding.eliEventName.setTextColor(Color.GREEN)
+                    } else {
+                        binding.eliEventResponse.setOnClickListener {
+                            loadingDialog.show()
+                            val tcpModel = OtherUtil.SOSCancel(Constants.deviceId, itemData.fromDeviceId, itemData.id)
+                            TcpClient.getInstance().sendMsg(tcpModel.toJson())
+
+                            tcpModel.data = Gson().toJson(itemData)
+                            EventBus.getDefault().post(MessageEvent(tcpModel,999))
+
+                            Handler().postDelayed({
+                                loadingDialog.dismiss()
+                            }, 1000)
+                        }
+                    }
+                }
+                TcpType.VOICE.name->{
+                    binding.eliEventName.text = "通话"
+                    binding.eliEventResponse.visibility = View.GONE
+                }
+            }
+
+            binding.eliCallout.setOnClickListener {
+                loadingDialog.show()
+                val tcpModel = VoiceUtil.voiceCall(Constants.deviceId, itemData.fromDeviceId)
+                TcpClient.getInstance().sendMsg(tcpModel.toJson())
+                Handler().postDelayed({
+                    loadingDialog.dismiss()
+                },2000)
+            }
+        }
+    }
+
+}

+ 1 - 1
home/src/main/code/com/wdkl/ncs/android/component/home/adapter/TakeoverItemAdapter.kt

@@ -75,7 +75,7 @@ class TakeoverItemAdapter(var data:ArrayList<JsonObject>, val context: Context)
                 binding.btnUserChange.visibility = View.GONE
                 binding.btnCallOut.setOnClickListener {
                     loadingDialog.show()
-                    var tcpModel = VoiceUtil.voiceCall(Constants.deviceId, itemData.get("id").asInt)
+                    val tcpModel = VoiceUtil.voiceCall(Constants.deviceId, itemData.get("id").asInt)
                     TcpClient.getInstance().sendMsg(tcpModel.toJson())
                     Handler().postDelayed({
                         loadingDialog.dismiss()

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

@@ -29,4 +29,6 @@ interface HomeComponent {
     fun inject(activity: TakeoverActivity)
 
     fun inject(service: WdKeepAliveService)
+
+    fun inject(activity: NewEventListActivity)
 }

+ 33 - 43
home/src/main/code/com/wdkl/ncs/android/component/home/service/WdKeepAliveService.kt

@@ -45,6 +45,8 @@ class WdKeepAliveService : AbsWorkService() {
     companion object instance {
         var updateLastTime : Long = System.currentTimeMillis() / 1000
         var sosQueue : ConcurrentLinkedQueue<TcpModel> = ConcurrentLinkedQueue<TcpModel>()
+
+        var mNewEventListActive = false
     }
 
     private var mIsRunning = false
@@ -122,7 +124,29 @@ class WdKeepAliveService : AbsWorkService() {
             }
             //事件与语音留言通道
             3->{
-                Thread(Runnable {
+                if (!mNewEventListActive) {
+                    Thread(Runnable {
+                        while (DeviceChannel.calling) {
+                            Thread.sleep(400)
+                        }
+
+                        SpeechUtil.getInstance().stopSpeak()
+
+                        Util.wakeUpAndUnlock(this)
+
+                        val tcpModel = messageEvent.getMessage() as TcpModel
+                        val intent = Intent()
+                        intent.setClass(this, NewEventListActivity::class.java)
+                        intent.putExtra("tcpModelStr", tcpModel.toJson())
+                        intent.putExtra("boolVibrator", true)
+                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                        startActivity(intent)
+                    }).start()
+                }
+            }
+            //SOS通道
+            999->{
+                if (!mNewEventListActive) {
                     while (DeviceChannel.calling) {
                         Thread.sleep(400)
                     }
@@ -131,48 +155,14 @@ class WdKeepAliveService : AbsWorkService() {
 
                     Util.wakeUpAndUnlock(this)
 
-                    val tcpModel = messageEvent.getMessage() as TcpModel
-                    val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
-                    if (tcpModel.type == TcpType.IM) {
-                        SpeechUtil.getInstance().newSpeech("您有新的语音留言待处理", false)
-                    } else if (tcpModel.type == TcpType.EVENT) {
-                        var eventStr = ""
-                        if (interactionVO != null) {
-                            eventStr = Util.appendSpace(interactionVO.fromFrameFullName.replace("-", "")) + ", " + interactionVO.data
-                        }
-                        SpeechUtil.getInstance().newSpeech("您有新的事件待处理, " + eventStr, false)
-                    }
-                    tcpModel.data = interactionVO
-
-                    val intent = Intent()
-                    intent.setClass(this, WatchEventDetailActivity::class.java)
-                    intent.putExtra("tcpModelStr", tcpModel.toJson())
-                    intent.putExtra("boolVibrator", true)
-                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-                    startActivity(intent)
-                }).start()
-            }
-            //SOS通道
-            999->{
-                val tcpModelIn = messageEvent.getMessage() as TcpModel
-                if (tcpModelIn.action == TcpAction.SOSAction.CALL) {
-                    sosQueue.offer(tcpModelIn)
-                    if (!Constants.sosActive) {
-                        val tcpModel = sosQueue.poll()
-                        openSos(tcpModel)
-                    }
-                } else {
-                    var tcpModelRm:TcpModel? = null
-                    val interactionVoIn = Gson().fromJson(tcpModelIn.data.toString(), InteractionVO::class.java)
-                    sosQueue.forEach {
-                        val interactionVO = Gson().fromJson(it.data.toString(), InteractionVO::class.java)
-                        if (interactionVO.id == interactionVoIn.id){
-                            tcpModelRm = it
-                            return
-                        }
-                    }
-                    if (tcpModelRm!=null){
-                        sosQueue.remove(tcpModelRm)
+                    val tcpModelIn = messageEvent.getMessage() as TcpModel
+                    if (tcpModelIn.action == TcpAction.SOSAction.CALL) {
+                        val intent = Intent()
+                        intent.setClass(this, NewEventListActivity::class.java)
+                        intent.putExtra("tcpModelStr", tcpModelIn.toJson())
+                        intent.putExtra("boolVibrator", true)
+                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                        startActivity(intent)
                     }
                 }
             }

+ 9 - 3
home/src/main/code/com/wdkl/ncs/android/component/home/util/Util.kt

@@ -1,16 +1,15 @@
 package com.wdkl.ncs.android.component.home.util
 
-import android.Manifest
 import android.annotation.SuppressLint
 import android.app.KeyguardManager
 import android.content.Context
 import android.content.Context.KEYGUARD_SERVICE
-import android.content.pm.PackageManager
 import android.os.Build
 import android.os.Environment
 import android.os.PowerManager
-import android.support.v4.app.ActivityCompat
 import android.telephony.TelephonyManager
+import android.util.DisplayMetrics
+import android.view.WindowManager
 import com.enation.javashop.utils.base.tool.SystemTool
 import com.google.common.base.Strings
 import java.io.File
@@ -158,4 +157,11 @@ object Util {
             }
         }
     }
+
+    fun getPixelsFromDp(context: Context, size: Int): Int {
+        val metrics = DisplayMetrics()
+        val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
+        wm.getDefaultDisplay().getMetrics(metrics)
+        return size * metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT
+    }
 }

+ 34 - 0
home/src/main/res/layout/activity_event_list.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:bind="http://schemas.android.com/apk/res-auto">
+    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#FFBDC3">
+        <TextView
+            android:id="@+id/tv_empty_event"
+            android:textAlignment="center"
+            android:layout_marginTop="50dp"
+            android:textSize="20sp"
+            android:textColor="@color/warn_orange"
+            android:text="@string/data_empty"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
+        <com.scwang.smartrefresh.layout.SmartRefreshLayout
+            android:id="@+id/srl_event_list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginLeft="3sp"
+            android:layout_marginRight="3sp"
+            bind:srlEnableLoadMore="true"
+            bind:srlEnableRefresh="true">
+            <android.support.v7.widget.RecyclerView
+                android:id="@+id/rv_event_list"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="#FFBDC3">
+            </android.support.v7.widget.RecyclerView>
+        </com.scwang.smartrefresh.layout.SmartRefreshLayout>
+
+    </RelativeLayout>
+</layout>

+ 115 - 0
home/src/main/res/layout/event_list_item.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dp"
+        android:paddingBottom="5dp"
+        android:orientation="vertical"
+        android:background="@color/color_white"
+        android:gravity="center_vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="3dp"
+                android:layout_marginStart="10dp"
+                android:orientation="vertical">
+                <LinearLayout
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+                    <ImageView
+                        android:src="@drawable/home_100"
+                        android:layout_gravity="center_vertical"
+                        android:layout_width="15dp"
+                        android:layout_height="15dp"/>
+                    <TextView
+                        android:id="@+id/eli_room_name"
+                        android:layout_marginStart="3dp"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="房号"
+                        android:textSize="14sp"/>
+
+                </LinearLayout>
+
+                <TextView
+                    android:id="@+id/eli_member_name"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="5dp"
+                    android:text="客户姓名"
+                    android:textSize="12sp"/>
+                <TextView
+                    android:id="@+id/eli_event_time"
+                    android:layout_marginTop="5dp"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="事件时间"
+                    android:textSize="12sp"/>
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:orientation="horizontal"
+                android:layout_marginEnd="10dp"
+                android:gravity="right"
+                android:layout_weight="1">
+
+                <TextView
+                    android:layout_gravity="center_vertical"
+                    android:id="@+id/eli_event_name"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="5dp"
+                    android:textColor="@color/warn_orange"
+                    android:text="事件名称"
+                    android:textSize="20sp"/>
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:layout_marginEnd="5dp"
+                android:gravity="right"
+                android:layout_weight="1">
+
+                <ImageView
+                    android:id="@+id/eli_callout"
+                    android:src="@drawable/yu_yin_jie_ting"
+                    android:layout_width="35dp"
+                    android:layout_height="35dp"/>
+                <ImageView
+                    android:id="@+id/eli_event_response"
+                    android:src="@drawable/icon_switch_off"
+                    android:layout_width="wrap_content"
+                    android:layout_height="35dp"/>
+
+                <ImageView
+                    android:visibility="gone"
+                    android:id="@+id/eli_im_read"
+                    android:layout_marginStart="15dp"
+                    android:src="@drawable/wei_bo_fang"
+                    android:layout_width="35dp"
+                    android:layout_height="35dp"/>
+
+            </LinearLayout>
+        </LinearLayout>
+    </LinearLayout>
+</layout>

+ 2 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/di/PresenterComponent.kt

@@ -62,4 +62,6 @@ interface PresenterComponent {
     fun inject(presenter: WatchDevicePresenter)
 
     fun inject(presenter: TakeoverPresenter)
+
+    fun inject(presenter: NewEventListPresenter)
 }

+ 16 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/logic/contract/home/NewEventListContract.kt

@@ -0,0 +1,16 @@
+package com.wdkl.ncs.android.middleware.logic.contract.home
+
+import com.google.gson.JsonArray
+import com.wdkl.ncs.android.lib.base.BaseContract
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+
+interface NewEventListContract {
+    interface View : BaseContract.BaseView{
+        fun renderData(data : ArrayList<InteractionVO>)
+
+    }
+
+    interface Presenter : BaseContract.BasePresenter{
+        fun loadList()
+    }
+}

+ 18 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/logic/presenter/home/NewEventListPresenter.kt

@@ -0,0 +1,18 @@
+package com.wdkl.ncs.android.middleware.logic.presenter.home
+
+import com.wdkl.ncs.android.lib.base.RxPresenter
+import com.wdkl.ncs.android.middleware.di.MiddlewareDaggerComponent
+import com.wdkl.ncs.android.middleware.logic.contract.home.NewEventListContract
+import javax.inject.Inject
+
+class NewEventListPresenter@Inject constructor() : RxPresenter<NewEventListContract.View>(), NewEventListContract.Presenter {
+    /**
+     *依赖注入初始化
+     */
+    override fun bindDagger() {
+        MiddlewareDaggerComponent.component.inject(this)
+    }
+
+    override fun loadList() {
+    }
+}

+ 6 - 0
readme.md

@@ -26,6 +26,12 @@
 
 ---
 
+## [1.1.20] version 39 - 2020-08-05
+### Changed
+- 优化事件、语音留言和SOS的详情展示及接入
+
+---
+
 ## [1.1.19] version 38 - 2020-08-05
 ### Fixed
 - 修复信号强度显示

BIN
resource/src/main/res/drawable/home_100.png