only show avatars for voiceonly calls

improve pip handling a bit

minor changes

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-05-07 13:10:50 +02:00
parent 1136508ba2
commit 257dc2af54
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
5 changed files with 49 additions and 27 deletions

View File

@ -940,6 +940,8 @@ class CallActivity : CallBaseActivity() {
}
private fun initSelfVideoViewForPipMode() {
if (!isVoiceOnlyCall) {
binding!!.pipSelfVideoRenderer.visibility = View.VISIBLE
try {
binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null)
} catch (e: IllegalStateException) {
@ -950,7 +952,10 @@ class CallActivity : CallBaseActivity() {
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
if (isVoiceOnlyCall) {
if (participantItems.size > 1) {
binding!!.pipOverlay.visibility = View.VISIBLE
binding!!.pipSelfVideoRenderer.visibility = View.GONE
} else {
binding!!.pipOverlay.visibility = View.GONE
}
} else {
binding!!.selfVideoRenderer.clearImage()
binding!!.selfVideoRenderer.release()
if (participantItems.size > 1) {
binding!!.pipCallConversationNameTextView.text = conversationName
binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE
binding!!.pipOverlay.visibility = View.VISIBLE
initSelfVideoViewForPipMode()
} else {
binding!!.pipSelfVideoOverlay.visibility = View.GONE
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

View File

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

View File

@ -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<ParticipantUiState> {
sessionKey = i.toString(),
nick = "testuser$i Test",
isConnected = true,
isAudioEnabled = if (i == 3) true else false,
isAudioEnabled = true,
isStreamEnabled = true,
raisedHand = true,
avatarUrl = "",

View File

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

View File

@ -322,7 +322,7 @@
</LinearLayout>
<RelativeLayout
android:id="@+id/pipSelfVideoOverlay"
android:id="@+id/pipOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
@ -336,9 +336,8 @@
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginStart="5dp"
android:layout_marginTop="40dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="-30dp"
android:ellipsize="end"
android:maxLines="3"
android:textAlignment="center"