|
|
|
|
@ -182,8 +182,13 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onDestroy() {
|
|
|
|
|
mWindowManager?.removeView(floatingWidgetView)
|
|
|
|
|
// disconnectSession()
|
|
|
|
|
try {
|
|
|
|
|
mWindowManager?.removeView(floatingWidgetView)
|
|
|
|
|
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
Log.e("onDestroyService", "${e.localizedMessage}.")
|
|
|
|
|
}
|
|
|
|
|
// disconnectSession()
|
|
|
|
|
super.onDestroy()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -193,7 +198,12 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
cmTimer.stop()
|
|
|
|
|
stopForeground(true)
|
|
|
|
|
stopSelf()
|
|
|
|
|
|
|
|
|
|
videoCallResponseListener?.minimizeVideoEvent(false)
|
|
|
|
|
try {
|
|
|
|
|
mWindowManager?.removeView(floatingWidgetView)
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
Log.e("stopService", "${e.localizedMessage}.")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add Floating Widget View to Window Manager */
|
|
|
|
|
@ -291,9 +301,20 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
arg0?.text = formattedCallTime
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
notificationCompatBuilder.contentView.setChronometer(R.id.notify_timer, cmTimer.base, null, true)
|
|
|
|
|
notificationCompatBuilder.bigContentView.setChronometer(R.id.notify_timer, cmTimer.base, null, true)
|
|
|
|
|
} catch (e : Exception){}
|
|
|
|
|
notificationCompatBuilder.contentView.setChronometer(
|
|
|
|
|
R.id.notify_timer,
|
|
|
|
|
cmTimer.base,
|
|
|
|
|
null,
|
|
|
|
|
true
|
|
|
|
|
)
|
|
|
|
|
notificationCompatBuilder.bigContentView.setChronometer(
|
|
|
|
|
R.id.notify_timer,
|
|
|
|
|
cmTimer.base,
|
|
|
|
|
null,
|
|
|
|
|
true
|
|
|
|
|
)
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// for change notification timer
|
|
|
|
|
if (mNotificationManagerCompat != null) {
|
|
|
|
|
@ -321,6 +342,17 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
mSession = Session.Builder(this, apiKey, sessionId).build()
|
|
|
|
|
mSession!!.setSessionListener(this)
|
|
|
|
|
mSession!!.connect(token)
|
|
|
|
|
|
|
|
|
|
mSession!!.setReconnectionListener(object : Session.ReconnectionListener {
|
|
|
|
|
override fun onReconnecting(session: Session?) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onReconnected(session: Session?) {
|
|
|
|
|
session?.connect(token)
|
|
|
|
|
session?.onResume()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
e.printStackTrace()
|
|
|
|
|
}
|
|
|
|
|
@ -558,20 +590,26 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun onMinimizedClicked() {
|
|
|
|
|
if (isCircle){
|
|
|
|
|
if (isCircle) {
|
|
|
|
|
onMiniCircleClicked()
|
|
|
|
|
}
|
|
|
|
|
if (isFullScreen) {
|
|
|
|
|
windowManagerParams.width = 400
|
|
|
|
|
windowManagerParams.height = 600
|
|
|
|
|
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
try {
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
}
|
|
|
|
|
recordContainer.visibility = View.GONE
|
|
|
|
|
} else {
|
|
|
|
|
windowManagerParams.width = WindowManager.LayoutParams.MATCH_PARENT
|
|
|
|
|
windowManagerParams.height = WindowManager.LayoutParams.MATCH_PARENT
|
|
|
|
|
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
try {
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isRecording) {
|
|
|
|
|
recordContainer.visibility = View.VISIBLE
|
|
|
|
|
@ -637,12 +675,18 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
windowManagerParams.width = 400
|
|
|
|
|
windowManagerParams.height = 600
|
|
|
|
|
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
try {
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
windowManagerParams.width = 300
|
|
|
|
|
windowManagerParams.height = 300
|
|
|
|
|
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
try {
|
|
|
|
|
mWindowManager?.updateViewLayout(floatingWidgetView, windowManagerParams)
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isCircle = !isCircle
|
|
|
|
|
|
|
|
|
|
@ -728,10 +772,10 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
|
|
|
|
|
override fun onDisconnected(session: Session) {
|
|
|
|
|
Log.d(TAG, "onDisconnected: disconnected from session " + session.sessionId)
|
|
|
|
|
mSession = null
|
|
|
|
|
cmTimer.stop()
|
|
|
|
|
disconnectSession()
|
|
|
|
|
videoCallResponseListener?.minimizeVideoEvent(false)
|
|
|
|
|
// mSession = null
|
|
|
|
|
// cmTimer.stop()
|
|
|
|
|
// disconnectSession()
|
|
|
|
|
// videoCallResponseListener?.minimizeVideoEvent(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onError(session: Session, opentokError: OpentokError) {
|
|
|
|
|
@ -1035,7 +1079,12 @@ class VideoStreamFloatingWidgetService : Service(), Session.SessionListener,
|
|
|
|
|
mRemoteViewsExpand.setTextViewText(R.id.notify_title, notificationData.mContentTitle)
|
|
|
|
|
mRemoteViewsExpand.setTextViewText(R.id.notify_content, notificationData.mContentText)
|
|
|
|
|
mRemoteViewsExpand.setOnClickPendingIntent(R.id.btn_end, endCallPendingIntent)
|
|
|
|
|
mRemoteViewsExpand.setChronometer(R.id.notify_timer, SystemClock.elapsedRealtime(), null, false)
|
|
|
|
|
mRemoteViewsExpand.setChronometer(
|
|
|
|
|
R.id.notify_timer,
|
|
|
|
|
SystemClock.elapsedRealtime(),
|
|
|
|
|
null,
|
|
|
|
|
false
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
notificationCompatBuilder
|
|
|
|
|
// BIG_TEXT_STYLE sets title and content for API 16 (4.1 and after).
|
|
|
|
|
|