mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Automatically enable full-screen mode when enabling video during a call
This commit is contained in:
parent
245b848c91
commit
1f604d54f2
2 changed files with 36 additions and 20 deletions
|
|
@ -326,12 +326,6 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
|||
isVideoEnabled.postValue(videoEnabled)
|
||||
updateVideoDirection(call.currentParams.videoDirection)
|
||||
|
||||
// Toggle full screen OFF when remote disables video
|
||||
if (!videoEnabled && fullScreenMode.value == true) {
|
||||
Log.w("$TAG Video is not longer enabled, leaving full screen mode")
|
||||
fullScreenMode.postValue(false)
|
||||
}
|
||||
|
||||
if (call.state == Call.State.Connected) {
|
||||
if (call.conference != null) {
|
||||
Log.i(
|
||||
|
|
@ -1194,14 +1188,34 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
|||
@WorkerThread
|
||||
private fun updateVideoDirection(direction: MediaDirection) {
|
||||
val isSending = direction == MediaDirection.SendRecv || direction == MediaDirection.SendOnly
|
||||
val isReceived = direction == MediaDirection.SendRecv || direction == MediaDirection.RecvOnly
|
||||
isSendingVideo.postValue(
|
||||
isSending
|
||||
)
|
||||
isReceivingVideo.postValue(
|
||||
isReceived
|
||||
)
|
||||
Log.d("$TAG Is video being sent? [$isSending] Is video being received? [$isReceived]")
|
||||
val isReceiving = direction == MediaDirection.SendRecv || direction == MediaDirection.RecvOnly
|
||||
|
||||
val wasSending = isSendingVideo.value == true
|
||||
val wasReceiving = isReceivingVideo.value == true
|
||||
|
||||
if (isReceiving != wasReceiving || isSending != wasSending) {
|
||||
Log.i(
|
||||
"$TAG Video is enabled in ${if (isSending && isReceiving) "both ways" else if (isSending) "upload" else "download"}"
|
||||
)
|
||||
isSendingVideo.postValue(isSending)
|
||||
isReceivingVideo.postValue(isReceiving)
|
||||
}
|
||||
|
||||
if (((isSending || isReceiving) && !wasSending && !wasReceiving)) {
|
||||
if (fullScreenMode.value != true) {
|
||||
Log.i("$TAG Video is enabled (it wasn't before), switching to full-screen mode")
|
||||
fullScreenMode.postValue(true)
|
||||
} else {
|
||||
Log.w(
|
||||
"$TAG Full-screen mode is already enabled but call wasn't using video, unexpected..."
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if (!isSending && !isReceiving && fullScreenMode.value == true) {
|
||||
Log.w("$TAG Video is no longer enabled, leaving full screen mode")
|
||||
fullScreenMode.postValue(false)
|
||||
}
|
||||
}
|
||||
|
||||
updateProximitySensor()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,12 +403,14 @@ class LinphoneUtils {
|
|||
val builder = SpannableStringBuilder(
|
||||
"${pair.first} ${pair.second}".trim()
|
||||
)
|
||||
builder.setSpan(
|
||||
StyleSpan(Typeface.ITALIC),
|
||||
0,
|
||||
pair.first.length,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
if (pair.first.isNotEmpty()) { // prevent error log due to zero length exclusive span
|
||||
builder.setSpan(
|
||||
StyleSpan(Typeface.ITALIC),
|
||||
0,
|
||||
pair.first.length,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
}
|
||||
return builder.toSpannable()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue