mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
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:
parent
1136508ba2
commit
257dc2af54
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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 = "",
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user