Merge remote-tracking branch 'origin/video-streaming-android' into video-streaming-android

# Conflicts:
#	lib/core/service/VideoCallService.dart
merge-requests/745/head
Mohammad Aljammal 3 years ago
commit b66b624f14

@ -151,7 +151,11 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
} else if (resultCode == Activity.RESULT_CANCELED) {
val callResponse: HashMap<String, String> = HashMap()
callResponse["callResponse"] = "CallEnd"
result?.success(callResponse)
try {
result?.success(callResponse)
} catch (e : Exception){
Log.e("onVideoCallFinished", "${e.message}.")
}
}
}

@ -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
@ -62,7 +64,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
private lateinit var mPublisherViewIcon: View
private lateinit var mSubscriberViewContainer: FrameLayout
private lateinit var mSubscriberViewIcon: ImageView
private var controlPanel: ConstraintLayout? = null
private lateinit var controlPanel: ConstraintLayout
private var apiKey: String? = null
private var sessionId: String? = null
@ -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)
@ -290,7 +300,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
private fun hiddenButtons() {
mVolHandler = Handler()
mVolRunnable = Runnable { controlPanel!!.visibility = View.GONE }
mVolRunnable = Runnable { controlPanel.visibility = View.GONE }
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
}
@ -478,6 +488,39 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
disconnectSession()
}
private fun miniCircleDoubleTap(){
if (isCircle){
onMiniCircleClicked()
}
}
private fun onMiniCircleClicked(){
if (isCircle) {
videoCallContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.text_color))
mSubscriberViewContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.remoteBackground))
dialog?.window?.setLayout(
400,
600
)
} else {
videoCallContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape)
mSubscriberViewContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape)
dialog?.window?.setLayout(
200,
200
)
}
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
@ -669,9 +722,11 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
}
private fun showControlPanelTemporarily() {
controlPanel!!.visibility = View.VISIBLE
mVolHandler!!.removeCallbacks(mVolRunnable!!)
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
if (!isCircle){
controlPanel.visibility = View.VISIBLE
mVolHandler!!.removeCallbacks(mVolRunnable!!)
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
}
}
/* Reset position of Floating Widget view on dragging */
@ -753,13 +808,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 {

@ -3,10 +3,10 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!-- <solid-->
<!-- android:color="#666666"/>-->
<solid
android:color="@color/remoteBackground"/>
<stroke android:width="2dp" android:color="@color/white" />
<stroke android:width="2dp" android:color="@color/text_color" />
<size
android:width="120dp"

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,13H5v-2h14v2z"/>
</vector>

@ -37,9 +37,9 @@
android:id="@+id/cmTimer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:textColor="@color/white"
android:textSize="16sp"
android:padding="4dp"
android:textStyle="bold"
tools:text="25:45" />
@ -52,14 +52,33 @@
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/control_panel"
app:layout_constraintTop_toBottomOf="@+id/layout_name"
tools:context=".ui.VideoCallActivity">
app:layout_constraintTop_toBottomOf="@+id/layout_name">
<RelativeLayout
android:id="@+id/layout_mini"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/remoteBackground"
android:alpha="0.5"
android:visibility="gone">
<ImageButton
android:id="@+id/ic_mini"
style="@style/Widget.MaterialComponents.Button.Icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_margin="@dimen/padding_space_medium"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@null"
android:src="@drawable/ic_mini" />
</RelativeLayout>
<FrameLayout
android:id="@+id/remote_video_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/layout_mini"
android:background="@color/remoteBackground">
<ImageView
@ -145,12 +164,12 @@
android:id="@+id/btn_switch_camera"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_mic"
android:layout_marginStart="@dimen/padding_space_medium"
app:layout_constraintTop_toTopOf="parent"
android:scaleType="centerCrop"
android:src="@drawable/camera_back" />
android:src="@drawable/camera_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_mic"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/btn_specker"

@ -5,6 +5,10 @@
<color name="colorAccent">#fc3850</color>
<color name="colorProgressBarBackground">#e4e9f2</color>
<color name="transparent">#80757575</color>
<color name="transparent_full_opacity">#00ffffff</color>
<!-- Chat Activity -->
<color name="localBackground">#827b92</color>
<color name="remoteBackground">#484258</color>

Loading…
Cancel
Save