|
@@ -12,6 +12,7 @@ import android.os.Handler
|
|
|
import android.os.Looper
|
|
|
import android.util.Log
|
|
|
import android.view.View
|
|
|
+import android.widget.Button
|
|
|
import android.widget.ImageView
|
|
|
import android.widget.TextView
|
|
|
import androidx.annotation.RequiresApi
|
|
@@ -20,6 +21,7 @@ import com.google.common.base.Strings
|
|
|
import com.szeasco.facesdk.helper.GpioHelper
|
|
|
import com.wdkl.ncs.entraceguard.contracts.MainActivityContract
|
|
|
import com.wdkl.ncs.entraceguard.di.DaggerApplicationComponent
|
|
|
+import com.wdkl.ncs.entraceguard.helper.ServerConfigDialogHelper
|
|
|
import com.wdkl.ncs.entraceguard.model.dos.DeviceDO
|
|
|
import com.wdkl.ncs.entraceguard.model.dto.TcpSeverDTO
|
|
|
import com.wdkl.ncs.entraceguard.model.vo.InteractionVO
|
|
@@ -31,6 +33,7 @@ import com.wdkl.ncs.entraceguard.tcp.enums.TcpAction
|
|
|
import com.wdkl.ncs.entraceguard.tcp.enums.TcpType
|
|
|
import com.wdkl.ncs.entraceguard.utils.LocaleMangerUtils
|
|
|
import com.wdkl.ncs.framework.base.BaseActivity
|
|
|
+import com.wdkl.ncs.framework.beans.ServerInfo
|
|
|
import com.wdkl.ncs.framework.common.Constants
|
|
|
import com.wdkl.ncs.framework.di.ApiProviders
|
|
|
import com.wdkl.ncs.framework.di.DaggerFrameWorkComponent
|
|
@@ -45,6 +48,7 @@ import com.wdkl.ncs.janus.entity.Room
|
|
|
import com.wdkl.ncs.janus.rtc.WebRTCEngine
|
|
|
import com.wdkl.ncs.janus.util.Constant
|
|
|
import com.wdkl.ncs.janus.util.EnumType
|
|
|
+import iot.facereco.smart.terminal.BuildConfig
|
|
|
import iot.facereco.smart.terminal.R
|
|
|
import iot.facereco.smart.terminal.databinding.ActivityMainBinding
|
|
|
import kotlinx.android.synthetic.main.activity_main.*
|
|
@@ -66,27 +70,21 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
.setAudioAttributes(audioAttributes.build())
|
|
|
.build()
|
|
|
}
|
|
|
-// private var gEngineKit: SkyEngineKit? = null
|
|
|
- private var gpioHelper: GpioHelper? = null
|
|
|
|
|
|
+ private var gpioHelper: GpioHelper? = null
|
|
|
private var interactionVO: InteractionVO? = null
|
|
|
|
|
|
//呼叫倒计时
|
|
|
lateinit var countDownTimer: CountDownTimer
|
|
|
-
|
|
|
//呼叫倒计时
|
|
|
lateinit var responseCountDownTimer: CountDownTimer
|
|
|
|
|
|
// 识别通过的语音 ,这里只是 demo 所以在这里加载,实际场景可以缓存起来
|
|
|
var passSoundID: Int? = null
|
|
|
-
|
|
|
// 陌生人
|
|
|
var strangerSoundID: Int? = null
|
|
|
-
|
|
|
var janusClient: JanusClient? = null
|
|
|
-
|
|
|
var videoRoomCallback: VideoRoomCallback? = null
|
|
|
-
|
|
|
var room: Room? = null
|
|
|
|
|
|
private var language = "zh"
|
|
@@ -106,35 +104,21 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
override fun init() {
|
|
|
|
|
|
if(!NetHelper.getInstance().netAvailable){
|
|
|
- showTipView(R.drawable.net_inavailable,R.string.no_network)
|
|
|
- exitApp(5000)
|
|
|
+ showTipView(R.drawable.net_inavailable,R.string.no_network, true, 5000)
|
|
|
+ //exitApp(5000)
|
|
|
}else {
|
|
|
-
|
|
|
- Constants.imei = android.os.Build.SERIAL
|
|
|
+ Constants.imei = Build.SERIAL
|
|
|
passSoundID = mSoundPool.load(this, R.raw.pass, 1)
|
|
|
strangerSoundID = mSoundPool.load(this, R.raw.not_allow, 1)
|
|
|
// 门禁SDK
|
|
|
gpioHelper = GpioHelper.getInstance()
|
|
|
//获取tcp服务器信息
|
|
|
- presenter.getTcpServerInfo()
|
|
|
-
|
|
|
-// try {
|
|
|
-// SkyEngineKit.init(VoipEvent()) //重新初始化
|
|
|
-// gEngineKit = SkyEngineKit.Instance()
|
|
|
-// } catch (e: NotInitializedException) {
|
|
|
-// SkyEngineKit.init(VoipEvent()) //重新初始化
|
|
|
-// try {
|
|
|
-// gEngineKit = SkyEngineKit.Instance()
|
|
|
-// } catch (ex: NotInitializedException) {
|
|
|
-//// finish()
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
+ //presenter.getTcpServerInfo()
|
|
|
+ presenter.getServerInfo()
|
|
|
+
|
|
|
initResponseCountDownTimer()
|
|
|
responseCountDownTimer.start() //开始计时,正常呼叫tcp发出,服务器立即响应成功或失败,如果超过8秒没响应,退出程序
|
|
|
Log.i("WDKL", "IMEI=" + Util.IMEI)
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
language = LocaleMangerUtils.getApplicationLocale().language
|
|
@@ -149,13 +133,23 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
}
|
|
|
|
|
|
override fun showTcpServerInfo(tcpSeverDTO: TcpSeverDTO) {
|
|
|
- Thread {
|
|
|
+ /*Thread {
|
|
|
TcpClient.getInstance().init(tcpSeverDTO.publicIp, tcpSeverDTO.tcpPort, tcpSeverDTO.readerIdleTime)
|
|
|
- }.start()
|
|
|
+ }.start()*/
|
|
|
+ }
|
|
|
|
|
|
+ override fun setServerInfo(serverInfo: ServerInfo) {
|
|
|
+ Constant.JANUS_URL = "ws://" + serverInfo.rtcLocalIp + ":" + serverInfo.rtcPort
|
|
|
+ Constant.STUN_SERVER = arrayOf<String>(serverInfo.stunServer)
|
|
|
+
|
|
|
+ Thread {
|
|
|
+ TcpClient.getInstance().init(serverInfo.tcpLocalIp, serverInfo.tcpPort, serverInfo.tcpIdleSeconds)
|
|
|
+ }.start()
|
|
|
}
|
|
|
|
|
|
override fun initDevice(deviceDO: DeviceDO) {
|
|
|
+ responseCountDownTimer.cancel()
|
|
|
+
|
|
|
Log.i("设备信息:", JSON.toJSONString(deviceDO))
|
|
|
if (!Strings.isNullOrEmpty(deviceDO.sipId)&&deviceDO.status.equals(1)) {
|
|
|
Constants.sipId = deviceDO.sipId
|
|
@@ -166,6 +160,7 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
|
|
|
|
|
|
//初始化 janusClient
|
|
|
+ Log.d("janus", "janus url: " + Constant.JANUS_URL + ", id: " + Constants.sipId)
|
|
|
janusClient = JanusClient(Constant.JANUS_URL, Constants.sipId!!.toBigInteger())
|
|
|
janusClient!!.callState = EnumType.CallState.Outgoing
|
|
|
room = Room(Constants.sipId!!.toBigInteger())
|
|
@@ -174,23 +169,17 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
janusClient!!.setJanusCallback(videoRoomCallback)
|
|
|
janusClient!!.connect()
|
|
|
initCountDownTimer()
|
|
|
-// SocketManager.getInstance().addUserStateCallback(this)
|
|
|
- //初始化webrtc
|
|
|
-// SocketManager.getInstance().connect(Urls.WS, Constants.sipId, 0)
|
|
|
+
|
|
|
TcpClient.getInstance().sendMsg(EntraceGuardUtil.startVisit(Constants.deviceId).toJson())
|
|
|
}else{
|
|
|
- showTipView(R.drawable.unregister,R.string.device_unregister)
|
|
|
- exitApp(3000)
|
|
|
+ showTipView(R.drawable.unregister,R.string.device_unregister, true, 3000)
|
|
|
+ //exitApp(3000)
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
override fun onError(message: String, type: Int) {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
override fun complete(message: String, type: Int) {
|
|
@@ -203,30 +192,26 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
fun onMoonEvent(messageEvent: MessageEvent) {
|
|
|
-
|
|
|
when (messageEvent.tag) {
|
|
|
Constants.ENTRACEGUARD -> {
|
|
|
Log.i("收到tcp消息:", JSON.toJSONString(messageEvent.tcpModel))
|
|
|
- var tcpModel = messageEvent.tcpModel as TcpModel
|
|
|
+ val tcpModel = messageEvent.tcpModel as TcpModel
|
|
|
if (tcpModel.type.equals(TcpType.ENTRACEGUARD)) {
|
|
|
when (tcpModel.action) {
|
|
|
TcpAction.EntraceGuardAction.ACCEPT -> { //接通视频
|
|
|
//取消响应计时
|
|
|
- responseCountDownTimer?.cancel()
|
|
|
+ responseCountDownTimer.cancel()
|
|
|
interactionVO = JSON.parseObject(tcpModel.data.toString(), InteractionVO::class.java)
|
|
|
- //janusClient!!.connect()
|
|
|
|
|
|
countDownTimer.start()
|
|
|
RingPlayHelper.playRingTone(this, R.raw.alice, true)
|
|
|
-// WebRTCEngine.getInstance().switchCamera()
|
|
|
-// startCall(interactionVO!!.toSipId, false)
|
|
|
}
|
|
|
|
|
|
TcpAction.EntraceGuardAction.FAILED ->{ //护士主机不在线
|
|
|
//取消响应计时
|
|
|
- responseCountDownTimer?.cancel()
|
|
|
- showTipView(R.drawable.host_offline,R.string.call_failed)
|
|
|
- exitApp(3000)
|
|
|
+ responseCountDownTimer.cancel()
|
|
|
+ showTipView(R.drawable.host_offline,R.string.call_failed, false, 3000)
|
|
|
+ //exitApp(3000)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -240,41 +225,31 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
janusClient!!.destroyRoom(janusClient!!.currentHandleId, null)
|
|
|
janusClient!!.disConnect()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //处理界面
|
|
|
-
|
|
|
- showTipView(R.drawable.allow_in,R.string.door_opened)
|
|
|
-// if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
+ showTipView(R.drawable.allow_in,R.string.door_opened, false, 10000)
|
|
|
play(passSoundID!!)
|
|
|
-// }
|
|
|
+
|
|
|
//10秒后退出程序,调起门禁默认应用
|
|
|
- exitApp(10000)
|
|
|
+ //exitApp(10000)
|
|
|
|
|
|
}
|
|
|
|
|
|
TcpAction.EntraceGuardAction.REJECT ->{
|
|
|
//停止等待音乐,停止倒计时
|
|
|
cancelCountDownTimer()
|
|
|
-// if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
- play(strangerSoundID!!)
|
|
|
-// }
|
|
|
- showTipView(R.drawable.busyline,R.string.call_busy)
|
|
|
+
|
|
|
+ play(strangerSoundID!!)
|
|
|
+ showTipView(R.drawable.busyline,R.string.call_busy, false, 3000)
|
|
|
|
|
|
janusClient!!.destroyRoom(janusClient!!.currentHandleId, null)
|
|
|
janusClient!!.disConnect()
|
|
|
//3秒后退出程序
|
|
|
- exitApp(3000)
|
|
|
+ //exitApp(3000)
|
|
|
|
|
|
}
|
|
|
TcpAction.EntraceGuardAction.LOCKDOOR -> {
|
|
|
// 陌生人,亮起红外灯光
|
|
|
gpioHelper!!.setPassStatus(false)
|
|
|
-// if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
- play(strangerSoundID!!)
|
|
|
-// }
|
|
|
+ play(strangerSoundID!!)
|
|
|
}
|
|
|
|
|
|
TcpAction.EntraceGuardAction.OPENSPEAKER -> { //打开音频
|
|
@@ -283,12 +258,6 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
|
|
|
WebRTCEngine.getInstance().toggleSpeaker(true)
|
|
|
WebRTCEngine.getInstance().muteAudio(false)
|
|
|
-// var session = gEngineKit?.currentSession
|
|
|
-// Log.i("session", session?.roomId)
|
|
|
-// if (session != null) {
|
|
|
-// session.toggleSpeaker(true)
|
|
|
-// session.toggleMuteAudio(false)
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
TcpAction.EntraceGuardAction.CLOSESPEAKER -> { //关闭音频
|
|
@@ -296,25 +265,18 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
cancelCountDownTimer()
|
|
|
WebRTCEngine.getInstance().toggleSpeaker(false)
|
|
|
WebRTCEngine.getInstance().muteAudio(true)
|
|
|
-// var session = gEngineKit?.currentSession
|
|
|
-// if (session != null) {
|
|
|
-// session.toggleSpeaker(false)
|
|
|
-// session.toggleMuteAudio(true)
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
TcpAction.EntraceGuardAction.HANGUP -> { //主机直接挂断,不开门显示
|
|
|
//停止等待音乐,停止倒计时
|
|
|
cancelCountDownTimer()
|
|
|
-// if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
- play(strangerSoundID!!)
|
|
|
-// }
|
|
|
- showTipView(R.drawable.not_allow,R.string.not_allowed)
|
|
|
+ play(strangerSoundID!!)
|
|
|
+ showTipView(R.drawable.not_allow,R.string.not_allowed, false, 3000)
|
|
|
janusClient!!.destroyRoom(janusClient!!.currentHandleId, null)
|
|
|
janusClient!!.disConnect()
|
|
|
-// SkyEngineKit.Instance().endCall()
|
|
|
+
|
|
|
//3秒后退出程序
|
|
|
- exitApp(3000)
|
|
|
+ //exitApp(3000)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -359,106 +321,23 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
return result
|
|
|
}
|
|
|
|
|
|
-// override fun userLogout() {
|
|
|
-// Log.i("webrtc", "用户退出登录")
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun userLogin() {
|
|
|
-// Log.i("webrtc", "用户登录成功")
|
|
|
-// //发送视频请求
|
|
|
-// TcpClient.getInstance().sendMsg(EntraceGuardUtil.startVisit(Constants.deviceId).toJson())
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-// //创建会话
|
|
|
-// private fun startCall(targetId: String, audioOnly: Boolean): Boolean {
|
|
|
-// val room = UUID.randomUUID().toString() + System.currentTimeMillis()
|
|
|
-// val b = gEngineKit!!.startOutCall(this, room, targetId, audioOnly)
|
|
|
-// Log.i("wdlk", "发送通话邀请")
|
|
|
-// if (b) {
|
|
|
-// val session = gEngineKit?.currentSession
|
|
|
-// if (session == null) {
|
|
|
-// return false
|
|
|
-// } else {
|
|
|
-//// Constants.CALL_STATE = Constants.CALL_CALLING
|
|
|
-//// DeviceChannel.calling = true
|
|
|
-//
|
|
|
-// initCountDownTimer()
|
|
|
-// countDownTimer.start()
|
|
|
-// RingPlayHelper.playRingTone(this, R.raw.alice, true)
|
|
|
-// session.setSessionCallback(this)
|
|
|
-// session.switchCamera()
|
|
|
-//
|
|
|
-// session.toggleSpeaker(false)
|
|
|
-// session.toggleMuteAudio(true)
|
|
|
-//
|
|
|
-//// 3s还未连接上则判定为通话失败
|
|
|
-// Handler().postDelayed({
|
|
|
-// if (session.state == EnumType.CallState.Connected) {
|
|
|
-// //showCalling(onlyAudio)
|
|
|
-// } else {
|
|
|
-//
|
|
|
-// }
|
|
|
-// Log.i("创建通话,session state=", session.state.name)
|
|
|
-// }, 3000)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return b
|
|
|
-// }
|
|
|
-
|
|
|
-// override fun didChangeState(var1: EnumType.CallState?) {
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun didDisconnected(userId: String?) {
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-// override fun didCreateLocalVideoTrack() {
|
|
|
-// Log.d("wzlll", "didCreateLocalVideoTrack")
|
|
|
-// handler.post {
|
|
|
-// if (localSurfaceView == null) {
|
|
|
-// val surfaceView = gEngineKit!!.currentSession.setupLocalVideo(true)
|
|
|
-// if (surfaceView != null) {
|
|
|
-// localSurfaceView = surfaceView as SurfaceViewRenderer
|
|
|
-// } else {
|
|
|
-// EventBus.getDefault().post(MessageEvent("back_to_main", Constants.BACK_TO_MAIN_MSG))
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// localSurfaceView!!.setZOrderMediaOverlay(true)
|
|
|
-// }
|
|
|
-// surface_view!!.addView(localSurfaceView)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// override fun didError(error: String?) {
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun didReceiveRemoteVideoTrack(userId: String?) {
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun didCallEndWithReason(var1: EnumType.CallEndReason?) {
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun didChangeMode(isAudioOnly: Boolean) {
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun didUserLeave(userId: String?) {
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
|
|
|
private fun play(soundID: Int) {
|
|
|
mSoundPool.play(soundID, 1.0f, 1.0f, 1, 0, 1.0f)
|
|
|
}
|
|
|
|
|
|
private fun exitApp(delay: Long) {
|
|
|
- handler.postDelayed({
|
|
|
+ if (delay > 0) {
|
|
|
+ handler.postDelayed({
|
|
|
+ //关闭灯光,闭合继电器
|
|
|
+ gpioHelper!!.ledDismiss(false);
|
|
|
+
|
|
|
+ val packageManager: PackageManager = packageManager
|
|
|
+ val intent: Intent = packageManager.getLaunchIntentForPackage("com.rlapk")
|
|
|
+ startActivity(intent)
|
|
|
+ System.exit(0)
|
|
|
+ }, delay)
|
|
|
+ } else {
|
|
|
//关闭灯光,闭合继电器
|
|
|
gpioHelper!!.ledDismiss(false);
|
|
|
|
|
@@ -466,25 +345,26 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
val intent: Intent = packageManager.getLaunchIntentForPackage("com.rlapk")
|
|
|
startActivity(intent)
|
|
|
System.exit(0)
|
|
|
- }, delay)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
fun initCountDownTimer() {
|
|
|
countDownTimer = object : CountDownTimer(100 * 1000L, 1000) {
|
|
|
+
|
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
|
val time = millisUntilFinished / 1000
|
|
|
val text = getString(R.string.call_timeout, time)
|
|
|
counter_down.setText(text)
|
|
|
}
|
|
|
+
|
|
|
override fun onFinish() {
|
|
|
//呼叫超时,返回到主界面
|
|
|
-// SkyEngineKit.Instance().endCall()
|
|
|
janusClient!!.destroyRoom(janusClient!!.currentHandleId, null)
|
|
|
janusClient!!.disConnect()
|
|
|
RingPlayHelper.stopRingTone()
|
|
|
TcpClient.getInstance().sendMsg(EntraceGuardUtil.timeOut(interactionVO).toJson())
|
|
|
- showTipView(R.drawable.no_reponse,R.string.call_no_response)
|
|
|
- exitApp(3000)
|
|
|
+ showTipView(R.drawable.no_reponse,R.string.call_no_response, false, 3000)
|
|
|
+ //exitApp(3000)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -494,32 +374,56 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
counter_down_wrap.visibility=View.GONE
|
|
|
RingPlayHelper.stopRingTone()
|
|
|
}
|
|
|
- //等待响应倒计时 8秒内未响应呼叫请求回复,结束界面
|
|
|
+
|
|
|
+ //等待响应倒计时 8秒内未响应呼叫请求回复,结束界面
|
|
|
fun initResponseCountDownTimer() {
|
|
|
responseCountDownTimer = object : CountDownTimer(5 * 1000L, 1000) {
|
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
|
|
|
|
}
|
|
|
override fun onFinish() {
|
|
|
- showTipView(R.drawable.no_reponse,R.string.call_no_response)
|
|
|
- exitApp(3000)
|
|
|
+ showTipView(R.drawable.no_reponse,R.string.call_no_response, true, 3000)
|
|
|
+ //exitApp(3000)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun showTipView(imageId: Int, resId: Int) {
|
|
|
- showTipView(imageId, getString(resId))
|
|
|
+ fun showTipView(imageId: Int, resId: Int, serverConfig: Boolean, delayExit: Long) {
|
|
|
+ showTipView(imageId, getString(resId), serverConfig, delayExit)
|
|
|
}
|
|
|
|
|
|
- fun showTipView(imageId :Int, message:String){
|
|
|
+ fun showTipView(imageId: Int, message: String, serverConfig: Boolean, delayExit: Long){
|
|
|
counter_down_wrap.visibility=View.GONE
|
|
|
surface_view.removeAllViews()
|
|
|
- var view = layoutInflater.inflate(R.layout.view_tips_layout, null)
|
|
|
- var imageView = view.findViewById<ImageView>(R.id.tips_image)
|
|
|
+ val view = layoutInflater.inflate(R.layout.view_tips_layout, null)
|
|
|
+ val imageView = view.findViewById<ImageView>(R.id.tips_image)
|
|
|
imageView.setImageResource(imageId)
|
|
|
- var messageView = view.findViewById<TextView>(R.id.tips_message)
|
|
|
+ val messageView = view.findViewById<TextView>(R.id.tips_message)
|
|
|
+ val serverBtn = view.findViewById<Button>(R.id.btn_server_config)
|
|
|
+ val exitBtn = view.findViewById<Button>(R.id.btn_exit)
|
|
|
+ val tvVersion = view.findViewById<TextView>(R.id.tv_version)
|
|
|
+ tvVersion.setText("V" + BuildConfig.VERSION_NAME)
|
|
|
messageView.setText(message)
|
|
|
surface_view.addView(view)
|
|
|
+
|
|
|
+ if (serverConfig) {
|
|
|
+ exitApp(60000)
|
|
|
+
|
|
|
+ tvVersion.visibility = View.VISIBLE
|
|
|
+ serverBtn.visibility = View.VISIBLE
|
|
|
+ serverBtn.setOnClickListener {
|
|
|
+ //服务器IP配置
|
|
|
+ ServerConfigDialogHelper.showPasswordDialog(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ exitBtn.visibility = View.VISIBLE
|
|
|
+ exitBtn.setOnClickListener {
|
|
|
+ handler.removeCallbacksAndMessages(null)
|
|
|
+ exitApp(0)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ exitApp(delayExit)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun didChangeState(var1: EnumType.CallState?) {
|
|
@@ -538,7 +442,7 @@ class MainActivity : BaseActivity<MainActivityPresenter, ActivityMainBinding>(),
|
|
|
}
|
|
|
|
|
|
override fun didCreateLocalVideoTrack() {
|
|
|
- handler.post {
|
|
|
+ runOnUiThread {
|
|
|
if (localSurfaceView == null) {
|
|
|
|
|
|
val surfaceView = WebRTCEngine.getInstance().startPreview(true)
|