From 30f7cac82f831dede704813bc752db0410745118 Mon Sep 17 00:00:00 2001 From: Oussama Hassine Date: Fri, 29 Sep 2023 17:58:34 +0200 Subject: [PATCH] chore: use the new CameraPreviewBuilder to get CameraPreview (#2291) --- .../android/ui/calling/common/CallVideoPreview.kt | 9 ++++++--- .../ongoing/participantsview/ParticipantTile.kt | 11 ++++++----- kalium | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/common/CallVideoPreview.kt b/app/src/main/kotlin/com/wire/android/ui/calling/common/CallVideoPreview.kt index 66fc455efe8..e25ba328af1 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/common/CallVideoPreview.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/common/CallVideoPreview.kt @@ -25,9 +25,10 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.viewinterop.AndroidView -import com.waz.avs.VideoPreview +import com.waz.avs.CameraPreviewBuilder @Composable fun CallVideoPreview( @@ -37,11 +38,13 @@ fun CallVideoPreview( ) { if (isCameraOn) { Box { + val context = LocalContext.current AndroidView( modifier = Modifier.fillMaxSize(), factory = { - val videoPreview = VideoPreview(it) - videoPreview.setShouldFill(true) + val videoPreview = CameraPreviewBuilder(context) + .shouldFill(true) + .build() onVideoPreviewCreated(videoPreview) videoPreview } diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantTile.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantTile.kt index 043e97630be..8380100303f 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantTile.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantTile.kt @@ -68,7 +68,7 @@ import androidx.constraintlayout.compose.ConstraintLayout import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleOwner -import com.waz.avs.VideoPreview +import com.waz.avs.CameraPreviewBuilder import com.waz.avs.VideoRenderer import com.wire.android.R import com.wire.android.model.UserAvatarData @@ -214,11 +214,12 @@ private fun CameraPreview( ) { if (isCameraOn) { val context = LocalContext.current + val backgroundColor = colorsScheme().callingParticipantTileBackgroundColor.value.toInt() val videoPreview = remember { - VideoPreview(context).apply { - layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) - setShouldFill(false) - } + CameraPreviewBuilder(context) + .setBackgroundColor(backgroundColor) + .shouldFill(false) + .build() } AndroidView( factory = { diff --git a/kalium b/kalium index 91c2b37c5b8..a79402cba15 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 91c2b37c5b86662f875e91aebf60f799baf7dfac +Subproject commit a79402cba1502482301703597720153b17134ce7