diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 7d8088e7c..003dc869a 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -940,17 +940,22 @@ class CallActivity : CallBaseActivity() { } private fun initSelfVideoViewForPipMode() { - try { - binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null) - } catch (e: IllegalStateException) { - Log.d(TAG, "pipGroupVideoRenderer already initialized", e) - } - binding!!.pipSelfVideoRenderer.setZOrderMediaOverlay(true) - // disabled because it causes some devices to crash - binding!!.pipSelfVideoRenderer.setEnableHardwareScaler(false) - binding!!.pipSelfVideoRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT) + if (!isVoiceOnlyCall) { + binding!!.pipSelfVideoRenderer.visibility = View.VISIBLE + try { + binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null) + } catch (e: IllegalStateException) { + Log.d(TAG, "pipGroupVideoRenderer already initialized", e) + } + binding!!.pipSelfVideoRenderer.setZOrderMediaOverlay(true) + // disabled because it causes some devices to crash + binding!!.pipSelfVideoRenderer.setEnableHardwareScaler(false) + binding!!.pipSelfVideoRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT) - localVideoTrack!!.addSink(binding!!.pipSelfVideoRenderer) + localVideoTrack?.addSink(binding?.pipSelfVideoRenderer) + } else { + binding!!.pipSelfVideoRenderer.visibility = View.GONE + } } private fun initGrid() { @@ -2187,6 +2192,7 @@ class CallActivity : CallBaseActivity() { startVideoCapture(true) } } + in ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MIN..ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MAX, in ANGLE_LANDSCAPE_LEFT_THRESHOLD_MIN..ANGLE_LANDSCAPE_LEFT_THRESHOLD_MAX -> { if (lastAspectRatio != RATIO_16_TO_9) { @@ -2718,6 +2724,7 @@ class CallActivity : CallBaseActivity() { handler!!.postDelayed({ setCallState(CallStatus.CALLING_TIMEOUT) }, CALLING_TIMEOUT) handler!!.post { handleCallStateJoined() } } + CallStatus.IN_CONVERSATION -> handler!!.post { handleCallStateInConversation() } CallStatus.OFFLINE -> handler!!.post { handleCallStateOffline() } CallStatus.LEAVING -> handler!!.post { handleCallStateLeaving() } @@ -3241,21 +3248,30 @@ class CallActivity : CallBaseActivity() { binding!!.callInfosLinearLayout.visibility = View.GONE binding!!.selfVideoViewWrapper.visibility = View.GONE binding!!.callStates.callStateRelativeLayout.visibility = View.GONE + binding!!.pipCallConversationNameTextView.text = conversationName - binding!!.selfVideoRenderer.clearImage() - binding!!.selfVideoRenderer.release() - if (participantItems.size > 1) { - binding!!.pipCallConversationNameTextView.text = conversationName - binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE - initSelfVideoViewForPipMode() + if (isVoiceOnlyCall) { + if (participantItems.size > 1) { + binding!!.pipOverlay.visibility = View.VISIBLE + binding!!.pipSelfVideoRenderer.visibility = View.GONE + } else { + binding!!.pipOverlay.visibility = View.GONE + } } else { - binding!!.pipSelfVideoOverlay.visibility = View.GONE + binding!!.selfVideoRenderer.clearImage() + binding!!.selfVideoRenderer.release() + if (participantItems.size > 1) { + binding!!.pipOverlay.visibility = View.VISIBLE + initSelfVideoViewForPipMode() + } else { + binding!!.pipOverlay.visibility = View.GONE + } } } override fun updateUiForNormalMode() { Log.d(TAG, "updateUiForNormalMode") - binding!!.pipSelfVideoOverlay.visibility = View.GONE + binding!!.pipOverlay.visibility = View.GONE if (isVoiceOnlyCall) { binding!!.callControls.visibility = View.VISIBLE diff --git a/app/src/main/java/com/nextcloud/talk/call/components/AvatarWithFallback.kt b/app/src/main/java/com/nextcloud/talk/call/components/AvatarWithFallback.kt index 0763df116..49a09cd6c 100644 --- a/app/src/main/java/com/nextcloud/talk/call/components/AvatarWithFallback.kt +++ b/app/src/main/java/com/nextcloud/talk/call/components/AvatarWithFallback.kt @@ -55,7 +55,7 @@ fun AvatarWithFallback(participant: ParticipantUiState, modifier: Modifier = Mod contentAlignment = Alignment.Center ) { Text( - text = if (initials.isNotEmpty()) initials else "?", + text = initials.ifEmpty { "?" }, color = Color.Black, fontSize = 24.sp ) diff --git a/app/src/main/java/com/nextcloud/talk/call/components/ParticipantGrid.kt b/app/src/main/java/com/nextcloud/talk/call/components/ParticipantGrid.kt index 135f3e523..1833c448a 100644 --- a/app/src/main/java/com/nextcloud/talk/call/components/ParticipantGrid.kt +++ b/app/src/main/java/com/nextcloud/talk/call/components/ParticipantGrid.kt @@ -94,7 +94,8 @@ fun ParticipantGrid( modifier = Modifier .height(itemHeight) .fillMaxWidth(), - eglBase = eglBase + eglBase = eglBase, + isVoiceOnlyCall = isVoiceOnlyCall ) } } @@ -261,7 +262,7 @@ fun getTestParticipants(numberOfParticipants: Int): List { sessionKey = i.toString(), nick = "testuser$i Test", isConnected = true, - isAudioEnabled = if (i == 3) true else false, + isAudioEnabled = true, isStreamEnabled = true, raisedHand = true, avatarUrl = "", diff --git a/app/src/main/java/com/nextcloud/talk/call/components/ParticipantTile.kt b/app/src/main/java/com/nextcloud/talk/call/components/ParticipantTile.kt index 35b851ea0..385927f7e 100644 --- a/app/src/main/java/com/nextcloud/talk/call/components/ParticipantTile.kt +++ b/app/src/main/java/com/nextcloud/talk/call/components/ParticipantTile.kt @@ -33,13 +33,18 @@ import com.nextcloud.talk.call.ParticipantUiState import org.webrtc.EglBase @Composable -fun ParticipantTile(participant: ParticipantUiState, eglBase: EglBase?, modifier: Modifier = Modifier) { +fun ParticipantTile( + participant: ParticipantUiState, + eglBase: EglBase?, + modifier: Modifier = Modifier, + isVoiceOnlyCall: Boolean, +) { Box( modifier = modifier .clip(RoundedCornerShape(12.dp)) .background(Color.DarkGray) ) { - if (participant.isStreamEnabled && participant.mediaStream != null) { + if (!isVoiceOnlyCall && participant.isStreamEnabled && participant.mediaStream != null) { WebRTCVideoView(participant, eglBase) } else { AvatarWithFallback( @@ -113,6 +118,7 @@ fun ParticipantTilePreview() { modifier = Modifier .fillMaxWidth() .height(300.dp), - eglBase = null + eglBase = null, + isVoiceOnlyCall = false ) } diff --git a/app/src/main/res/layout/call_activity.xml b/app/src/main/res/layout/call_activity.xml index ea97114e9..ca67beaa2 100644 --- a/app/src/main/res/layout/call_activity.xml +++ b/app/src/main/res/layout/call_activity.xml @@ -322,7 +322,7 @@