fix draggable bugs

merge-requests/745/head
mosazaid 3 years ago
parent 550b4a848d
commit 259a63384e

@ -20,7 +20,6 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel;
import com.hmg.hmgDr.Model.GetSessionStatusModel;
@ -63,7 +62,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
private Runnable mVolRunnable, mConnectedRunnable;
private FrameLayout mPublisherViewContainer;
private RelativeLayout mSubscriberViewContainer;
private FrameLayout mSubscriberViewContainer;
private RelativeLayout controlPanel;
private String apiKey;
@ -432,7 +431,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
if (mPublisher != null) {
isCameraClicked = !isCameraClicked;
mPublisher.setPublishVideo(!isCameraClicked);
int res = isCameraClicked ? R.drawable.video_disanabled : R.drawable.video_enabled;
int res = isCameraClicked ? R.drawable.video_disabled : R.drawable.video_enabled;
mCameraBtn.setImageResource(res);
}
}

@ -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) =

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

Loading…
Cancel
Save