Explorar o código

所有来电呼叫加入到呼叫列表,点击对应呼叫进入来电呼叫界面,可以选择接听或挂断。

weizhengliang %!s(int64=3) %!d(string=hai) anos
pai
achega
fbf6004e94

+ 1 - 1
app/src/main/code/com/wdkl/app/ncs/application/Application.kt

@@ -71,7 +71,7 @@ class Application : BaseApplication() {
      */
     private fun initFrame() {
         //禁止滑掉退出
-        BaseConfig.getInstance().addActivity("WatchHome2Activity", "NewEventListActivity", "AppUpdateActivity")
+        BaseConfig.getInstance().addActivity("WatchHome2Activity", "NewEventListActivity", "AppUpdateActivity", "NewCallListActivity")
 
         NetEngineConfig.init(baseContext)
                 .openLogger()

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

@@ -35,6 +35,8 @@
         <activity android:screenOrientation="portrait" android:name=".activity.AppUpdateActivity" />
         <activity android:screenOrientation="portrait" android:name=".activity.NewEventListActivity"
             android:launchMode="singleTask"/>
+        <activity android:screenOrientation="portrait" android:name=".activity.NewCallListActivity"
+            android:launchMode="singleTask"/>
         <activity android:name=".activity.VoiceMsgActivity" android:screenOrientation="portrait"/>
         <activity android:name=".activity.ChannelImActivity" android:screenOrientation="portrait"/>
 

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

@@ -0,0 +1,181 @@
+package com.wdkl.ncs.android.component.home.activity
+
+import android.content.Intent
+import android.os.Bundle
+import android.support.v7.widget.RecyclerView
+import android.util.Log
+import android.view.View
+import android.widget.TextView
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.alibaba.fastjson.JSON
+import com.enation.javashop.utils.base.tool.BaseToolActivity
+import com.google.gson.Gson
+import com.scwang.smartrefresh.layout.SmartRefreshLayout
+import com.wdkl.ncs.android.component.home.R
+import com.wdkl.ncs.android.component.home.adapter.NewCallItemAdapter
+import com.wdkl.ncs.android.component.home.service.WdKeepAliveService
+import com.wdkl.ncs.android.component.home.ui.CallSingleActivity
+import com.wdkl.ncs.android.component.home.util.RingPlayHelper
+import com.wdkl.ncs.android.component.home.util.SpeechUtil
+import com.wdkl.ncs.android.lib.utils.AppTool
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.lib.vo.MessageEvent
+import com.wdkl.ncs.android.middleware.common.Constants
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.DeviceTypeEnum
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+class NewCallListActivity : BaseToolActivity(), NewCallItemAdapter.CallClickListener {
+    var TAG = WatchContactsActivity::class.java.getSimpleName()
+
+    private val adapter = NewCallItemAdapter(ArrayList(),this)
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+
+    private lateinit var recyclerView: RecyclerView
+    private lateinit var refreshView: SmartRefreshLayout
+    private lateinit var emptyView: TextView
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+
+        setContentView(R.layout.activity_call_list)
+
+        if(!EventBus.getDefault().isRegistered(this)){
+            EventBus.getDefault().register(this)
+        }
+
+        recyclerView = findViewById(R.id.rv_call_list)
+        refreshView = findViewById(R.id.srl_call_list)
+        emptyView = findViewById(R.id.tv_empty_call)
+
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+        delegateAdapter.addAdapter(adapter)
+        recyclerView.layoutManager = virtualLayoutManager
+        recyclerView.adapter = delegateAdapter
+
+        adapter.setCallClick(this)
+        adapter.setOnItemClickListener { data, position ->
+            SpeechUtil.getInstance().stopSpeak()
+
+            val interactionVO = Gson().fromJson(data.data.toString(), InteractionVO::class.java)
+            var roomId: String
+            if (interactionVO.fromDeviceType == DeviceTypeEnum.SIMULATE_BED_DEVICE.value()) {
+                //模拟分机呼叫,通话由手机端创建
+                DeviceChannel.callId = interactionVO.fromDeviceId
+                roomId = Constants.sipId!!
+            } else {
+                if (interactionVO.fromDeviceId.equals(Constants.deviceId)) {
+                    DeviceChannel.callId = interactionVO.toDeviceId
+                    roomId = interactionVO.toSipId
+                } else {
+                    DeviceChannel.callId = interactionVO.fromDeviceId
+                    roomId = interactionVO.fromSipId
+                }
+            }
+            Log.i(TAG, "来电:" + JSON.toJSONString(data))
+
+            //启动 activity
+            val intent = Intent(this, CallSingleActivity::class.java)
+            intent.putExtra(CallSingleActivity.EXTRA_ROOM_ID, roomId)
+            intent.putExtra(CallSingleActivity.EXTRA_MO, false)
+            intent.putExtra(CallSingleActivity.EXTRA_AUDIO_ONLY, true)
+            intent.putExtra(CallSingleActivity.EXTRA_TCPMODEL, data)
+            intent.putExtra(CallSingleActivity.EXTRA_RING, false)
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+            startActivity(intent)
+
+            //移除该条呼叫
+            removeCall(interactionVO)
+        }
+
+        refreshView.setOnRefreshListener {
+            AppTool.Time.delay(800) {
+                updateCallList()
+                refreshView.finishRefresh()
+            }
+        }
+
+        WdKeepAliveService.mNewCallListActive = true
+    }
+
+    override fun onResume() {
+        super.onResume()
+        updateCallList()
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+        RingPlayHelper.stopRingTone()
+        if (EventBus.getDefault().isRegistered(this)) {
+            EventBus.getDefault().unregister(this)
+        }
+        WdKeepAliveService.mNewCallListActive = false
+        Constants.newCallList.clear()
+    }
+
+    override fun onBackPressed() {
+        showMessage("您还有呼叫未处理")
+    }
+
+    private fun updateCallList() {
+        synchronized(this) {
+            if (Constants.newCallList.size > 0) {
+                adapter.data.clear()
+                adapter.data.addAll(Constants.newCallList)
+                adapter.notifyDataSetChanged()
+            } else {
+                emptyView.visibility = View.VISIBLE
+                AppTool.Time.delay(500) {
+                    finish()
+                }
+            }
+        }
+    }
+
+    private fun removeCall(item: InteractionVO) {
+        synchronized(this) {
+            val iterator = Constants.newCallList.iterator()
+            while (iterator.hasNext()) {
+                val it = iterator.next()
+                val interaction = Gson().fromJson(it.data.toString(), InteractionVO::class.java)
+                if (interaction.id.equals(item.id)) {
+                    iterator.remove()
+                }
+            }
+        }
+        updateCallList()
+    }
+
+    override fun callAccept(model: TcpModel) {
+        //接听电话,进入通话界面,并刷新呼叫列表
+    }
+
+    override fun callReject(model: TcpModel) {
+        //拒绝电话,刷新列表
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        if (messageEvent.tag == Constants.EVENT_NEW_CALL) { //新呼叫
+            updateCallList()
+        } else if (messageEvent.tag == Constants.EVENT_NEW_TCP) {
+            val tcpModel = messageEvent.getMessage() as TcpModel
+            if (tcpModel.getAction() === TcpAction.VoiceAction.CANCEL) {
+                //对方取消呼叫
+                val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+                removeCall(interactionVO)
+            }
+        }
+    }
+}

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

@@ -0,0 +1,73 @@
+package com.wdkl.ncs.android.component.home.adapter
+
+import android.app.Activity
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.google.gson.Gson
+import com.wdkl.ncs.android.component.home.R
+import com.wdkl.ncs.android.component.home.databinding.CallListItemBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+
+class NewCallItemAdapter(var data:ArrayList<TcpModel>, val activity: Activity) : BaseDelegateAdapter<BaseRecyclerViewHolder<CallListItemBinding>, TcpModel>() {
+
+    private var callListener: CallClickListener? = null
+
+    override fun dataProvider(): Any {
+        return data
+    }
+
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    override fun onCreateViewHolder(p0: ViewGroup?, p1: Int): BaseRecyclerViewHolder<CallListItemBinding> {
+        return BaseRecyclerViewHolder.build(p0, R.layout.call_list_item)
+    }
+
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        return LinearLayoutHelper(10, data.size)
+    }
+
+    override fun onBindViewHolder(p0: BaseRecyclerViewHolder<CallListItemBinding>?, p1: Int) {
+        p0?.bind { binding ->
+            val itemData = getItem(p1)
+            if (itemData.data != null) {
+                val interactionVO = Gson().fromJson(itemData.data.toString(), InteractionVO::class.java)
+
+                binding.tvCallName.text = interactionVO.fromFrameFullName + " 呼叫"
+                binding.btnCallAccept.setOnClickListener {
+                    //来电接听
+                    if (callListener != null) {
+                        callListener!!.callAccept(itemData)
+                    }
+                }
+
+                binding.btnCallReject.setOnClickListener {
+                    //来电拒绝
+                    if (callListener != null) {
+                        callListener!!.callReject(itemData)
+                    }
+                }
+            }
+        }
+
+    }
+
+    fun setCallClick(listener: CallClickListener) {
+        callListener = listener
+    }
+
+
+    interface CallClickListener{
+        fun callAccept(model: TcpModel)
+        fun callReject(model: TcpModel)
+    }
+}

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

@@ -17,6 +17,7 @@ import com.google.gson.GsonBuilder
 import com.google.gson.reflect.TypeToken
 import com.wdkl.ncs.android.component.home.R
 import com.wdkl.ncs.android.component.home.activity.AppUpdateActivity
+import com.wdkl.ncs.android.component.home.activity.NewCallListActivity
 import com.wdkl.ncs.android.component.home.activity.NewEventListActivity
 import com.wdkl.ncs.android.component.home.settingconfig.SettingConfig
 import com.wdkl.ncs.android.component.home.ui.CallSingleActivity
@@ -58,6 +59,7 @@ class WdKeepAliveService : AbsWorkService() {
 
         var mNewEventListActive = false
         var instanceCreated = false
+        var mNewCallListActive = false
     }
 
 
@@ -77,6 +79,7 @@ class WdKeepAliveService : AbsWorkService() {
     //当前播放的群留言id
     private var channelImId = 0
     private var waitingLoop = false
+    private var waitingCall = false
 
     private var warningTips = false
     private val keepHandler: Handler = object : Handler(Looper.getMainLooper()) {
@@ -207,8 +210,51 @@ class WdKeepAliveService : AbsWorkService() {
                     if (tcpModel.action == TcpAction.VoiceAction.CALL) {  //有来电
                         //取消掉语音留言录音
                         RecordHelper.getInstance().stopCancelRecordByOther(true)
+                        //停止媒体播放,比如正在播放留言
+                        MediaPlayHelper.getInstance().stopMusic(true)
+                        RingPlayHelper.stopRingTone()
+                        Log.i(TAG, "来电:" + JSON.toJSONString(interactionVO))
+
+                        //加入呼叫列表
+                        Constants.newCallList.add(tcpModel)
+                        //语音播报
+                        if (!DeviceChannel.calling && !RecordHelper.getInstance().isRecording) {
+                            val frameName = interactionVO.fromFrameFullName.replace("-", "")
+                            SpeechUtil.getInstance().newSpeech(frameName + "呼叫," + frameName + "呼叫", false)
+
+                            //更新界面
+                            if (mNewCallListActive) {
+                                EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_NEW_CALL))
+                            } else {
+                                val intent = Intent()
+                                intent.setClass(this, NewCallListActivity::class.java)
+                                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                                startActivity(intent)
+                            }
+                        } else {
+                            if (!waitingCall) {
+                                Thread {
+                                    while (DeviceChannel.calling || RecordHelper.getInstance().isRecording) {
+                                        waitingCall = true
+                                        Thread.sleep(500)
+                                    }
+                                    waitingCall = false
+
+                                    //更新界面
+                                    if (mNewCallListActive) {
+                                        EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_NEW_CALL))
+                                    } else {
+                                        val intent = Intent()
+                                        intent.setClass(this, NewCallListActivity::class.java)
+                                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                                        startActivity(intent)
+                                    }
+                                }.start()
+                            }
+                        }
+
 
-                        DeviceChannel.calling = true
+                        /*DeviceChannel.calling = true
                         var roomId: String
                         if (interactionVO.fromDeviceType == DeviceTypeEnum.SIMULATE_BED_DEVICE.value()) {
                             //模拟分机呼叫,通话由手机端创建
@@ -223,11 +269,6 @@ class WdKeepAliveService : AbsWorkService() {
                                 roomId = interactionVO.fromSipId
                             }
                         }
-                        Log.i(TAG, "来电:" + JSON.toJSONString(interactionVO))
-
-                        //停止媒体播放,比如正在播放留言
-                        MediaPlayHelper.getInstance().stopMusic(true)
-                        RingPlayHelper.stopRingTone()
 
                         //启动 activity
                         val intent = Intent(this, CallSingleActivity::class.java)
@@ -236,7 +277,7 @@ class WdKeepAliveService : AbsWorkService() {
                         intent.putExtra(CallSingleActivity.EXTRA_AUDIO_ONLY, true)
                         intent.putExtra(CallSingleActivity.EXTRA_TCPMODEL, tcpModel)
                         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-                        startActivity(intent)
+                        startActivity(intent)*/
                     }
                 }
             }
@@ -427,34 +468,38 @@ class WdKeepAliveService : AbsWorkService() {
 
             4 -> { //更新通讯录,更新通话白名单列表
                 Thread(Runnable {
-                    var jsonStr = ""
-                    val contactVos = ApiManager.API_WatchManageDevice.getWatchContactList(Constants.deviceId).map {
-                        jsonStr = it.getJsonString()
-                        val gson = GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create()
-                        val contactList: List<WatchContactVO> = gson.fromJson(jsonStr, object : TypeToken<List<WatchContactVO>>() {}.type)
-                        return@map contactList
-                    }.blockingSingle()
-
-                    if (contactVos != null && contactVos.size > 0) {
-                        for (contactVO in contactVos) {
-                            if (!Strings.isNullOrEmpty(contactVO.name) && !Strings.isNullOrEmpty(contactVO.phoneNumber)) {
-                                ContactHelper.setContact(this, contactVO.name, contactVO.phoneNumber)
+                    try {
+                        var jsonStr = ""
+                        val contactVos = ApiManager.API_WatchManageDevice.getWatchContactList(Constants.deviceId).map {
+                            jsonStr = it.getJsonString()
+                            val gson = GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create()
+                            val contactList: List<WatchContactVO> = gson.fromJson(jsonStr, object : TypeToken<List<WatchContactVO>>() {}.type)
+                            return@map contactList
+                        }.blockingSingle()
+
+                        if (contactVos != null && contactVos.size > 0) {
+                            for (contactVO in contactVos) {
+                                if (!Strings.isNullOrEmpty(contactVO.name) && !Strings.isNullOrEmpty(contactVO.phoneNumber)) {
+                                    ContactHelper.setContact(this, contactVO.name, contactVO.phoneNumber)
+                                }
                             }
                         }
-                    }
 
-                    //更新白名单列表
-                    val whiteList = ApiManager.API_WatchManageDevice.getPhoneWhiteList(Constants.deviceId).map {
-                        jsonStr = it.getJsonString()
-                        val gson = GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create()
-                        val whiteList: List<String> = gson.fromJson(jsonStr, object : TypeToken<List<String>>() {}.type)
-                        return@map whiteList
-                    }.blockingSingle()
+                        //更新白名单列表
+                        val whiteList = ApiManager.API_WatchManageDevice.getPhoneWhiteList(Constants.deviceId).map {
+                            jsonStr = it.getJsonString()
+                            val gson = GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create()
+                            val whiteList: List<String> = gson.fromJson(jsonStr, object : TypeToken<List<String>>() {}.type)
+                            return@map whiteList
+                        }.blockingSingle()
 
 
-                    if (whiteList != null && whiteList.size > 0) {
-                        Constants.phoneWhiteList.clear()
-                        Constants.phoneWhiteList.addAll(whiteList)
+                        if (whiteList != null && whiteList.size > 0) {
+                            Constants.phoneWhiteList.clear()
+                            Constants.phoneWhiteList.addAll(whiteList)
+                        }
+                    } catch (ex: Exception) {
+                        ex.printStackTrace()
                     }
 
                 }).start()
@@ -496,6 +541,13 @@ class WdKeepAliveService : AbsWorkService() {
                     //取消掉语音留言录音
                     RecordHelper.getInstance().stopCancelRecordByOther(true)
 
+                    //紧急呼叫去重
+                    for (e in Constants.eventList) {
+                        if (e.id == sosInteractionVO.id) {
+                            return
+                        }
+                    }
+
                     if (Constants.oldEvent) {
                         Constants.eventList.clear()
                     }

+ 3 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/ui/CallSingleActivity.java

@@ -67,6 +67,7 @@ public class CallSingleActivity extends AppCompatActivity {
     public static final String EXTRA_AUDIO_ONLY = "audioOnly";
     public static final String EXTRA_TCPMODEL = "tcpModel";
     public static final String EXTRA_SHOWNAME = "showName";
+    public static final String EXTRA_RING = "ring";
     private static final String TAG = "CallSingleActivity";
 
     private boolean isOutgoing;
@@ -81,6 +82,7 @@ public class CallSingleActivity extends AppCompatActivity {
     ILogUpload iLogUpload = new LogUpload();
     VideoRoomCallback videoRoomCallback;
     boolean isSimulateBed = false;
+    boolean ringUp = true;
 
     private SingleCallFragment currentFragment;
     //振动
@@ -122,6 +124,7 @@ public class CallSingleActivity extends AppCompatActivity {
         isAudioOnly = intent.getBooleanExtra(EXTRA_AUDIO_ONLY,true);
         recTcpModel = (TcpModel) intent.getSerializableExtra(EXTRA_TCPMODEL);
         showName = intent.getStringExtra(EXTRA_SHOWNAME);
+        ringUp = intent.getBooleanExtra(EXTRA_RING, true);
 
         if (recTcpModel !=null && recTcpModel.getData() != null) {
             Log.d(TAG, recTcpModel.toJson());

+ 1 - 1
home/src/main/code/com/wdkl/ncs/android/component/home/ui/FragmentAudio.java

@@ -84,7 +84,7 @@ public class FragmentAudio extends SingleCallFragment implements View.OnClickLis
         }
         transHandler = new TransHandler();
         //是来电,且是客户来电进入延时转接
-        if (!isOutgoing && interactionVO.getFromClerkId()==null) {
+        if (!isOutgoing && !callSingleActivity.ringUp && interactionVO != null && interactionVO.getFromClerkId()==null) {
             int transSeconds = SettingConfig.getCountdownTime(this.getContext());
             transHandler.sendEmptyMessageDelayed(TRANS, transSeconds * 1000);
         }

+ 8 - 4
home/src/main/code/com/wdkl/ncs/android/component/home/ui/SingleCallFragment.java

@@ -111,10 +111,14 @@ public abstract class SingleCallFragment extends Fragment {
     public void onViewCreated(View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
-        if (isOutgoing) {
-            RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_back2, true);
-        } else {
-            RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_tone, true);
+        if (callSingleActivity != null) {
+            if (isOutgoing) {
+                RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_back2, true);
+            } else {
+                if (callSingleActivity.ringUp) {
+                    RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_tone, true);
+                }
+            }
         }
     }
 

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

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:bind="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="#FFBDC3">
+
+    <com.scwang.smartrefresh.layout.SmartRefreshLayout
+        android:id="@+id/srl_call_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_call_list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="#FFBDC3" />
+    </com.scwang.smartrefresh.layout.SmartRefreshLayout>
+
+    <TextView
+        android:id="@+id/tv_empty_call"
+        android:layout_width="match_parent"
+        android:layout_height="80dp"
+        android:gravity="center"
+        android:textSize="24sp"
+        android:textColor="@color/warn_orange"
+        android:text="@string/data_empty"
+        android:background="@color/color_white"
+        android:visibility="gone"/>
+</FrameLayout>

+ 35 - 0
home/src/main/res/layout/call_list_item.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="60dp"
+    android:gravity="center_vertical"
+    android:paddingLeft="10dp"
+    android:paddingRight="10dp"
+    android:background="@color/color_white">
+
+    <TextView
+        android:id="@+id/tv_call_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_weight="6"
+        android:textSize="24sp"/>
+
+    <ImageView
+        android:id="@+id/btn_call_accept"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_weight="1"
+        android:src="@drawable/av_audio_answer_selector"
+        android:visibility="gone"/>
+
+    <ImageView
+        android:id="@+id/btn_call_reject"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_weight="1"
+        android:src="@drawable/av_hangup_selector"
+        android:visibility="gone"/>
+
+</LinearLayout>
+</layout>

+ 4 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constants.kt

@@ -1,6 +1,7 @@
 package com.wdkl.ncs.android.middleware.common
 
 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.CommunicationEnum
 
 class Constants {
@@ -40,6 +41,8 @@ class Constants {
         var phoneState = PHONE_IDLE
         //手机白名单
         var phoneWhiteList = ArrayList<String>()
+        //来电呼叫列表
+        var newCallList = ArrayList<TcpModel>()
 
 
         //手机通话方式: 默认网络
@@ -79,5 +82,6 @@ class Constants {
         const val EVENT_NEW_TCP = 0x48
         const val EVENT_HEADSET_HOOK = 0x49
         const val EVENT_CLEAR_IM = 0x50
+        const val EVENT_NEW_CALL = 0x51
     }
 }

+ 4 - 2
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/channel/DeviceChannel.java

@@ -52,7 +52,9 @@ public class DeviceChannel {
                     EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_NEW_TCP));
                     //EventBus.getDefault().post(new MessageEvent(tcpModel, 1));
                 } else if(tcpModel.getAction() == TcpAction.VoiceAction.CALL){
-                    if (calling) {
+                    EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_NEW_TCP));
+
+                    /*if (calling) {
                         Log.d(TAG,"通话中,来电 " + tcpModel.getFromId() + "<>" + callId);
                         //相同来源,重新建立通话
                         if (tcpModel.getFromId().equals(callId)){
@@ -67,7 +69,7 @@ public class DeviceChannel {
                     } else { //得到通话
                         EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_NEW_TCP));
                         //EventBus.getDefault().post(new MessageEvent(tcpModel, 1));
-                    }
+                    }*/
                 } else if ((tcpModel.getAction() == TcpAction.VoiceAction.ACCEPT)  //我方呼出,对方接受
                         || (tcpModel.getAction() == TcpAction.VoiceAction.REJECT) //我方呼出,对方拒绝
                         || (tcpModel.getAction() == TcpAction.VoiceAction.CALLING) //我方呼出,对方通话中