Fixed call overlay sending to call view even if call is in incoming/outgoing state
This commit is contained in:
parent
9d4ebdb960
commit
66f86c278e
3 changed files with 23 additions and 5 deletions
|
@ -52,6 +52,7 @@ import org.linphone.activities.main.viewmodels.SharedMainViewModel
|
|||
import org.linphone.activities.navigateToDialer
|
||||
import org.linphone.compatibility.Compatibility
|
||||
import org.linphone.contact.ContactsUpdatedListenerStub
|
||||
import org.linphone.core.CorePreferences
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.MainActivityBinding
|
||||
import org.linphone.utils.AppUtils
|
||||
|
@ -447,7 +448,8 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
.start()
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if (abs(initPosX - view.x) < 5 && abs(initPosY - view.y) < 5) {
|
||||
if (abs(initPosX - view.x) < CorePreferences.OVERLAY_CLICK_SENSITIVITY &&
|
||||
abs(initPosY - view.y) < CorePreferences.OVERLAY_CLICK_SENSITIVITY) {
|
||||
view.performClick()
|
||||
}
|
||||
}
|
||||
|
@ -457,7 +459,7 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
}
|
||||
|
||||
callOverlay.setOnClickListener {
|
||||
coreContext.onCallStarted()
|
||||
coreContext.onCallOverlayClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -584,7 +584,8 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
windowManager.updateViewLayout(overlay, params)
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if (abs(overlayX - params.x) < 5 && abs(overlayY - params.y) < 5) {
|
||||
if (abs(overlayX - params.x) < CorePreferences.OVERLAY_CLICK_SENSITIVITY &&
|
||||
abs(overlayY - params.y) < CorePreferences.OVERLAY_CLICK_SENSITIVITY) {
|
||||
view.performClick()
|
||||
}
|
||||
overlayX = params.x.toFloat()
|
||||
|
@ -595,14 +596,27 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
true
|
||||
}
|
||||
overlay.setOnClickListener {
|
||||
Log.i("[Context] Overlay clicked, go back to call view")
|
||||
onCallStarted()
|
||||
onCallOverlayClick()
|
||||
}
|
||||
|
||||
callOverlay = overlay
|
||||
windowManager.addView(overlay, params)
|
||||
}
|
||||
|
||||
fun onCallOverlayClick() {
|
||||
val call = core.currentCall ?: core.calls.firstOrNull()
|
||||
if (call != null) {
|
||||
Log.i("[Context] Overlay clicked, go back to call view")
|
||||
when (call.state) {
|
||||
Call.State.IncomingReceived, Call.State.IncomingEarlyMedia -> onIncomingReceived()
|
||||
Call.State.OutgoingInit, Call.State.OutgoingProgress, Call.State.OutgoingRinging, Call.State.OutgoingEarlyMedia -> onOutgoingStarted()
|
||||
else -> onCallStarted()
|
||||
}
|
||||
} else {
|
||||
Log.e("[Context] Couldn't find call, why is the overlay clicked?!")
|
||||
}
|
||||
}
|
||||
|
||||
fun removeCallOverlay() {
|
||||
if (callOverlay != null) {
|
||||
val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
|
|
|
@ -41,6 +41,8 @@ class CorePreferences constructor(private val context: Context) {
|
|||
/* VFS encryption */
|
||||
|
||||
companion object {
|
||||
const val OVERLAY_CLICK_SENSITIVITY = 10
|
||||
|
||||
private const val encryptedSharedPreferencesFile = "encrypted.pref"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue