mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +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() {
|
private fun initSelfVideoViewForPipMode() {
|
||||||
try {
|
if (!isVoiceOnlyCall) {
|
||||||
binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null)
|
binding!!.pipSelfVideoRenderer.visibility = View.VISIBLE
|
||||||
} catch (e: IllegalStateException) {
|
try {
|
||||||
Log.d(TAG, "pipGroupVideoRenderer already initialized", e)
|
binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null)
|
||||||
}
|
} catch (e: IllegalStateException) {
|
||||||
binding!!.pipSelfVideoRenderer.setZOrderMediaOverlay(true)
|
Log.d(TAG, "pipGroupVideoRenderer already initialized", e)
|
||||||
// disabled because it causes some devices to crash
|
}
|
||||||
binding!!.pipSelfVideoRenderer.setEnableHardwareScaler(false)
|
binding!!.pipSelfVideoRenderer.setZOrderMediaOverlay(true)
|
||||||
binding!!.pipSelfVideoRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT)
|
// 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() {
|
private fun initGrid() {
|
||||||
@ -2187,6 +2192,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
startVideoCapture(true)
|
startVideoCapture(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
in ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MIN..ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MAX,
|
in ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MIN..ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MAX,
|
||||||
in ANGLE_LANDSCAPE_LEFT_THRESHOLD_MIN..ANGLE_LANDSCAPE_LEFT_THRESHOLD_MAX -> {
|
in ANGLE_LANDSCAPE_LEFT_THRESHOLD_MIN..ANGLE_LANDSCAPE_LEFT_THRESHOLD_MAX -> {
|
||||||
if (lastAspectRatio != RATIO_16_TO_9) {
|
if (lastAspectRatio != RATIO_16_TO_9) {
|
||||||
@ -2718,6 +2724,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
handler!!.postDelayed({ setCallState(CallStatus.CALLING_TIMEOUT) }, CALLING_TIMEOUT)
|
handler!!.postDelayed({ setCallState(CallStatus.CALLING_TIMEOUT) }, CALLING_TIMEOUT)
|
||||||
handler!!.post { handleCallStateJoined() }
|
handler!!.post { handleCallStateJoined() }
|
||||||
}
|
}
|
||||||
|
|
||||||
CallStatus.IN_CONVERSATION -> handler!!.post { handleCallStateInConversation() }
|
CallStatus.IN_CONVERSATION -> handler!!.post { handleCallStateInConversation() }
|
||||||
CallStatus.OFFLINE -> handler!!.post { handleCallStateOffline() }
|
CallStatus.OFFLINE -> handler!!.post { handleCallStateOffline() }
|
||||||
CallStatus.LEAVING -> handler!!.post { handleCallStateLeaving() }
|
CallStatus.LEAVING -> handler!!.post { handleCallStateLeaving() }
|
||||||
@ -3241,21 +3248,30 @@ class CallActivity : CallBaseActivity() {
|
|||||||
binding!!.callInfosLinearLayout.visibility = View.GONE
|
binding!!.callInfosLinearLayout.visibility = View.GONE
|
||||||
binding!!.selfVideoViewWrapper.visibility = View.GONE
|
binding!!.selfVideoViewWrapper.visibility = View.GONE
|
||||||
binding!!.callStates.callStateRelativeLayout.visibility = View.GONE
|
binding!!.callStates.callStateRelativeLayout.visibility = View.GONE
|
||||||
|
binding!!.pipCallConversationNameTextView.text = conversationName
|
||||||
|
|
||||||
binding!!.selfVideoRenderer.clearImage()
|
if (isVoiceOnlyCall) {
|
||||||
binding!!.selfVideoRenderer.release()
|
if (participantItems.size > 1) {
|
||||||
if (participantItems.size > 1) {
|
binding!!.pipOverlay.visibility = View.VISIBLE
|
||||||
binding!!.pipCallConversationNameTextView.text = conversationName
|
binding!!.pipSelfVideoRenderer.visibility = View.GONE
|
||||||
binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE
|
} else {
|
||||||
initSelfVideoViewForPipMode()
|
binding!!.pipOverlay.visibility = View.GONE
|
||||||
|
}
|
||||||
} else {
|
} 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() {
|
override fun updateUiForNormalMode() {
|
||||||
Log.d(TAG, "updateUiForNormalMode")
|
Log.d(TAG, "updateUiForNormalMode")
|
||||||
binding!!.pipSelfVideoOverlay.visibility = View.GONE
|
binding!!.pipOverlay.visibility = View.GONE
|
||||||
|
|
||||||
if (isVoiceOnlyCall) {
|
if (isVoiceOnlyCall) {
|
||||||
binding!!.callControls.visibility = View.VISIBLE
|
binding!!.callControls.visibility = View.VISIBLE
|
||||||
|
@ -55,7 +55,7 @@ fun AvatarWithFallback(participant: ParticipantUiState, modifier: Modifier = Mod
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = if (initials.isNotEmpty()) initials else "?",
|
text = initials.ifEmpty { "?" },
|
||||||
color = Color.Black,
|
color = Color.Black,
|
||||||
fontSize = 24.sp
|
fontSize = 24.sp
|
||||||
)
|
)
|
||||||
|
@ -94,7 +94,8 @@ fun ParticipantGrid(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(itemHeight)
|
.height(itemHeight)
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
eglBase = eglBase
|
eglBase = eglBase,
|
||||||
|
isVoiceOnlyCall = isVoiceOnlyCall
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,7 +262,7 @@ fun getTestParticipants(numberOfParticipants: Int): List<ParticipantUiState> {
|
|||||||
sessionKey = i.toString(),
|
sessionKey = i.toString(),
|
||||||
nick = "testuser$i Test",
|
nick = "testuser$i Test",
|
||||||
isConnected = true,
|
isConnected = true,
|
||||||
isAudioEnabled = if (i == 3) true else false,
|
isAudioEnabled = true,
|
||||||
isStreamEnabled = true,
|
isStreamEnabled = true,
|
||||||
raisedHand = true,
|
raisedHand = true,
|
||||||
avatarUrl = "",
|
avatarUrl = "",
|
||||||
|
@ -33,13 +33,18 @@ import com.nextcloud.talk.call.ParticipantUiState
|
|||||||
import org.webrtc.EglBase
|
import org.webrtc.EglBase
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ParticipantTile(participant: ParticipantUiState, eglBase: EglBase?, modifier: Modifier = Modifier) {
|
fun ParticipantTile(
|
||||||
|
participant: ParticipantUiState,
|
||||||
|
eglBase: EglBase?,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
isVoiceOnlyCall: Boolean,
|
||||||
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.clip(RoundedCornerShape(12.dp))
|
||||||
.background(Color.DarkGray)
|
.background(Color.DarkGray)
|
||||||
) {
|
) {
|
||||||
if (participant.isStreamEnabled && participant.mediaStream != null) {
|
if (!isVoiceOnlyCall && participant.isStreamEnabled && participant.mediaStream != null) {
|
||||||
WebRTCVideoView(participant, eglBase)
|
WebRTCVideoView(participant, eglBase)
|
||||||
} else {
|
} else {
|
||||||
AvatarWithFallback(
|
AvatarWithFallback(
|
||||||
@ -113,6 +118,7 @@ fun ParticipantTilePreview() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(300.dp),
|
.height(300.dp),
|
||||||
eglBase = null
|
eglBase = null,
|
||||||
|
isVoiceOnlyCall = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/pipSelfVideoOverlay"
|
android:id="@+id/pipOverlay"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/black"
|
android:background="@color/black"
|
||||||
@ -336,9 +336,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="5dp"
|
||||||
android:layout_marginBottom="-30dp"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="3"
|
android:maxLines="3"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
Loading…
Reference in New Issue
Block a user