|
|
|
@ -16,6 +16,7 @@ import android.view.*
|
|
|
|
|
import android.widget.*
|
|
|
|
|
import androidx.annotation.Nullable
|
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
|
import androidx.core.content.ContextCompat
|
|
|
|
|
import androidx.core.view.GestureDetectorCompat
|
|
|
|
|
import androidx.fragment.app.DialogFragment
|
|
|
|
|
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel
|
|
|
|
@ -39,6 +40,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
SubscriberKit.VideoListener, VideoCallView {
|
|
|
|
|
|
|
|
|
|
private var isFullScreen: Boolean = true
|
|
|
|
|
private var isCircle: Boolean = false
|
|
|
|
|
private var x_init_cord = 0
|
|
|
|
|
private var y_init_cord: Int = 0
|
|
|
|
|
private var x_init_margin: Int = 0
|
|
|
|
@ -78,6 +80,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
private lateinit var parentView: View
|
|
|
|
|
private lateinit var videoCallContainer: ConstraintLayout
|
|
|
|
|
private lateinit var layoutName: RelativeLayout
|
|
|
|
|
private lateinit var layoutMini: RelativeLayout
|
|
|
|
|
private lateinit var icMini: ImageButton
|
|
|
|
|
private lateinit var mCallBtn: ImageView
|
|
|
|
|
private lateinit var btnMinimize: ImageView
|
|
|
|
|
private lateinit var mCameraBtn: ImageView
|
|
|
|
@ -179,7 +183,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
requestPermissions()
|
|
|
|
|
|
|
|
|
|
handleDragDialog()
|
|
|
|
|
mDetector = GestureDetectorCompat(context, MyGestureListener { showControlPanelTemporarily() })
|
|
|
|
|
mDetector = GestureDetectorCompat(context, MyGestureListener({ showControlPanelTemporarily() }, { miniCircleDoubleTap() }))
|
|
|
|
|
|
|
|
|
|
return parentView
|
|
|
|
|
}
|
|
|
|
@ -214,6 +218,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
private fun initUI(view: View) {
|
|
|
|
|
videoCallContainer = view.findViewById(R.id.video_call_ll)
|
|
|
|
|
layoutName = view.findViewById(R.id.layout_name)
|
|
|
|
|
layoutMini = view.findViewById(R.id.layout_mini)
|
|
|
|
|
icMini = view.findViewById(R.id.ic_mini)
|
|
|
|
|
mPublisherViewContainer = view.findViewById(R.id.local_video_view_container)
|
|
|
|
|
mPublisherViewIcon = view.findViewById(R.id.local_video_view_icon)
|
|
|
|
|
mSubscriberViewIcon = view.findViewById(R.id.remote_video_view_icon)
|
|
|
|
@ -240,6 +246,10 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
Log.d(VideoCallFragment.TAG, "onChronometerTick: $minutes : $seconds")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
icMini.setOnClickListener {
|
|
|
|
|
onMiniCircleClicked()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
controlPanel = view.findViewById(R.id.control_panel)
|
|
|
|
|
videoCallPresenter = VideoCallPresenterImpl(this, baseUrl)
|
|
|
|
|
mCallBtn = view.findViewById<ImageView>(R.id.btn_call)
|
|
|
|
@ -478,6 +488,39 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
disconnectSession()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun miniCircleDoubleTap(){
|
|
|
|
|
if (isCircle){
|
|
|
|
|
onMiniCircleClicked()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun onMiniCircleClicked(){
|
|
|
|
|
if (isCircle) {
|
|
|
|
|
dialog?.window?.setLayout(
|
|
|
|
|
400,
|
|
|
|
|
600
|
|
|
|
|
)
|
|
|
|
|
videoCallContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.text_color))
|
|
|
|
|
mSubscriberViewContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.remoteBackground))
|
|
|
|
|
} else {
|
|
|
|
|
dialog?.window?.setLayout(
|
|
|
|
|
200,
|
|
|
|
|
200
|
|
|
|
|
)
|
|
|
|
|
videoCallContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape)
|
|
|
|
|
mSubscriberViewContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape)
|
|
|
|
|
}
|
|
|
|
|
isCircle = !isCircle
|
|
|
|
|
|
|
|
|
|
if(isCircle){
|
|
|
|
|
controlPanel?.visibility = View.GONE
|
|
|
|
|
layoutMini.visibility = View.GONE
|
|
|
|
|
} else {
|
|
|
|
|
controlPanel?.visibility = View.VISIBLE
|
|
|
|
|
layoutMini.visibility = View.VISIBLE
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun onMinimizedClicked(view: View?) {
|
|
|
|
|
if (isFullScreen) {
|
|
|
|
|
dialog?.window?.setLayout(
|
|
|
|
@ -522,6 +565,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
|
|
|
|
|
if (isFullScreen) {
|
|
|
|
|
layoutName.visibility = View.VISIBLE
|
|
|
|
|
layoutMini.visibility = View.GONE
|
|
|
|
|
mCameraBtn.visibility = View.VISIBLE
|
|
|
|
|
mSwitchCameraBtn.visibility = View.VISIBLE
|
|
|
|
|
// mspeckerBtn.visibility = View.VISIBLE
|
|
|
|
@ -541,6 +585,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
remotePreviewLayoutParam.height = remotePreviewIconSize
|
|
|
|
|
} else {
|
|
|
|
|
layoutName.visibility = View.GONE
|
|
|
|
|
layoutMini.visibility = View.VISIBLE
|
|
|
|
|
mCameraBtn.visibility = View.GONE
|
|
|
|
|
mSwitchCameraBtn.visibility = View.GONE
|
|
|
|
|
// mspeckerBtn.visibility = View.GONE
|
|
|
|
@ -565,6 +610,14 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
// remotePreviewLayoutParam = FrameLayout.LayoutParams(remotePreviewIconSizeSmall, remotePreviewIconSizeSmall)
|
|
|
|
|
remotePreviewLayoutParam.width = remotePreviewIconSizeSmall
|
|
|
|
|
remotePreviewLayoutParam.height = remotePreviewIconSizeSmall
|
|
|
|
|
|
|
|
|
|
if(isCircle){
|
|
|
|
|
controlPanel?.visibility = View.GONE
|
|
|
|
|
layoutMini.visibility = View.GONE
|
|
|
|
|
} else {
|
|
|
|
|
controlPanel?.visibility = View.VISIBLE
|
|
|
|
|
layoutMini.visibility = View.VISIBLE
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mPublisherViewContainer.layoutParams = localPreviewLayoutParam
|
|
|
|
@ -753,13 +806,18 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
).toInt()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class MyGestureListener(val onTabCall: () -> Unit) : GestureDetector.SimpleOnGestureListener() {
|
|
|
|
|
private class MyGestureListener(val onTabCall: () -> Unit, val miniCircleDoubleTap: () -> Unit) : GestureDetector.SimpleOnGestureListener() {
|
|
|
|
|
|
|
|
|
|
override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
|
|
|
|
|
onTabCall()
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onDoubleTap(e: MotionEvent?): Boolean {
|
|
|
|
|
miniCircleDoubleTap()
|
|
|
|
|
return super.onDoubleTap(e)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|