|
|
|
@ -17,6 +17,7 @@ import android.widget.*
|
|
|
|
|
import androidx.annotation.Nullable
|
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
|
import androidx.constraintlayout.widget.ConstraintSet
|
|
|
|
|
import androidx.core.view.GestureDetectorCompat
|
|
|
|
|
import androidx.fragment.app.DialogFragment
|
|
|
|
|
import com.hmg.hmgDr.Model.GetSessionStatusModel
|
|
|
|
|
import com.hmg.hmgDr.Model.SessionStatusModel
|
|
|
|
@ -98,7 +99,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
|
|
|
|
|
private var sessionStatusModel: GetSessionStatusModel? = null
|
|
|
|
|
private var videoCallResponseListener: VideoCallResponseListener? = null
|
|
|
|
|
|
|
|
|
|
private lateinit var mDetector: GestureDetectorCompat
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
requireActivity().setTheme(R.style.AppTheme)
|
|
|
|
@ -149,7 +150,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
|
|
|
|
savedInstanceState: Bundle?): View? {
|
|
|
|
|
savedInstanceState: Bundle?): View {
|
|
|
|
|
|
|
|
|
|
parentView = inflater.inflate(R.layout.activity_video_call, container, false)
|
|
|
|
|
|
|
|
|
@ -166,10 +167,12 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
requestPermissions()
|
|
|
|
|
|
|
|
|
|
handleDragDialog()
|
|
|
|
|
mDetector = GestureDetectorCompat(context, MyGestureListener { showControlPanelTemporarily() })
|
|
|
|
|
|
|
|
|
|
return parentView
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onPause() {
|
|
|
|
|
super.onPause()
|
|
|
|
|
if (mSession == null) {
|
|
|
|
@ -258,18 +261,6 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
hiddenButtons()
|
|
|
|
|
checkClientConnected()
|
|
|
|
|
|
|
|
|
|
mSubscriberViewContainer.setOnClickListener {
|
|
|
|
|
controlPanel!!.visibility = View.VISIBLE
|
|
|
|
|
mVolHandler!!.removeCallbacks(mVolRunnable!!)
|
|
|
|
|
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// mSubscriberViewContainer!!.setOnTouchListener { v: View?, event: MotionEvent? ->
|
|
|
|
|
// controlPanel!!.visibility = View.VISIBLE
|
|
|
|
|
// mVolHandler!!.removeCallbacks(mVolRunnable!!)
|
|
|
|
|
// mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
|
|
|
|
|
// true
|
|
|
|
|
// }
|
|
|
|
|
if (appLang == "ar") {
|
|
|
|
|
progressBarLayout!!.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
|
|
|
|
}
|
|
|
|
@ -574,7 +565,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
if (mPublisher != null) {
|
|
|
|
|
isCameraClicked = !isCameraClicked
|
|
|
|
|
mPublisher!!.publishVideo = !isCameraClicked
|
|
|
|
|
val res = if (isCameraClicked) R.drawable.video_disanabled else R.drawable.video_enabled
|
|
|
|
|
val res = if (isCameraClicked) R.drawable.video_disabled else R.drawable.video_enabled
|
|
|
|
|
mCameraBtn!!.setImageResource(res)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -604,12 +595,13 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
getWindowManagerDefaultDisplay()
|
|
|
|
|
|
|
|
|
|
videoCallContainer.setOnTouchListener(dragListener)
|
|
|
|
|
// mSubscriberViewContainer.setOnTouchListener(dragListener)
|
|
|
|
|
mSubscriberViewContainer.setOnTouchListener(dragListener)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
|
|
val dragListener: View.OnTouchListener = View.OnTouchListener { _, event ->
|
|
|
|
|
//Get Floating widget view params
|
|
|
|
|
mDetector.onTouchEvent(event)
|
|
|
|
|
|
|
|
|
|
//Get Floating widget view params
|
|
|
|
|
val layoutParams: WindowManager.LayoutParams = dialog!!.window!!.attributes
|
|
|
|
|
//get the touch location coordinates
|
|
|
|
@ -636,11 +628,12 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
val barHeight: Int = getStatusBarHeight()
|
|
|
|
|
if (y_cord_Destination < 0) {
|
|
|
|
|
// y_cord_Destination = 0
|
|
|
|
|
y_cord_Destination =
|
|
|
|
|
-(szWindow.y - (videoCallContainer.height /*+ barHeight*/))
|
|
|
|
|
// y_cord_Destination =
|
|
|
|
|
// -(szWindow.y - (videoCallContainer.height /*+ barHeight*/))
|
|
|
|
|
y_cord_Destination = - (szWindow.y/2)
|
|
|
|
|
} else if (y_cord_Destination + (videoCallContainer.height + barHeight) > szWindow.y) {
|
|
|
|
|
y_cord_Destination =
|
|
|
|
|
szWindow.y - (videoCallContainer.height + barHeight)
|
|
|
|
|
// y_cord_Destination = szWindow.y - (videoCallContainer.height + barHeight)
|
|
|
|
|
y_cord_Destination = (szWindow.y/2)
|
|
|
|
|
}
|
|
|
|
|
layoutParams.y = y_cord_Destination
|
|
|
|
|
|
|
|
|
@ -662,6 +655,12 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun showControlPanelTemporarily() {
|
|
|
|
|
controlPanel!!.visibility = View.VISIBLE
|
|
|
|
|
mVolHandler!!.removeCallbacks(mVolRunnable!!)
|
|
|
|
|
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Reset position of Floating Widget view on dragging */
|
|
|
|
|
private fun resetPosition(x_cord_now: Int) {
|
|
|
|
|
if (x_cord_now <= szWindow.x / 2) {
|
|
|
|
@ -741,6 +740,15 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
|
|
|
|
|
).toInt()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class MyGestureListener(val onTabCall: () -> Unit) : GestureDetector.SimpleOnGestureListener() {
|
|
|
|
|
|
|
|
|
|
override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
|
|
|
|
|
onTabCall()
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
@JvmStatic
|
|
|
|
|
fun newInstance(args: Bundle) =
|
|
|
|
|