Show camera icon instead of phone icon when incoming call is video

This commit is contained in:
Sylvain Berfini 2024-03-20 09:51:12 +01:00
parent 3b12128953
commit 29a4607bdc
3 changed files with 12 additions and 1 deletions

View file

@ -57,6 +57,8 @@ class ControlsViewModel : ViewModel() {
val isIncomingEarlyMediaVideo = MutableLiveData<Boolean>()
val isIncomingCallVideo = MutableLiveData<Boolean>()
val showExtras = MutableLiveData<Boolean>()
val fullScreenMode = MutableLiveData<Boolean>()
@ -123,6 +125,7 @@ class ControlsViewModel : ViewModel() {
Log.i("[Call Controls] State changed: $state")
isOutgoingEarlyMedia.value = state == Call.State.OutgoingEarlyMedia
isIncomingEarlyMediaVideo.value = state == Call.State.IncomingEarlyMedia && call.remoteParams?.isVideoEnabled == true
isIncomingCallVideo.value = call.remoteParams?.isVideoEnabled == true
attendedTransfer.value = core.callsNb > 1
if (state == Call.State.StreamsRunning) {
@ -237,6 +240,7 @@ class ControlsViewModel : ViewModel() {
Log.i("[Call Controls] Current state is: $state")
isOutgoingEarlyMedia.value = state == Call.State.OutgoingEarlyMedia
isIncomingEarlyMediaVideo.value = state == Call.State.IncomingEarlyMedia && currentCall?.remoteParams?.isVideoEnabled == true
isIncomingCallVideo.value = currentCall?.remoteParams?.isVideoEnabled == true
updateUI()

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:src="@drawable/voip_camera_on"
android:tint="@color/white_color"/>
</item>
</selector>

View file

@ -40,7 +40,7 @@
android:contentDescription="@string/content_description_answer_call"
android:onClick="@{() -> viewModel.answer()}"
android:padding="5dp"
android:src="@drawable/icon_call_answer"
android:src="@{viewModel.isIncomingCallVideo ? @drawable/icon_call_answer_video : @drawable/icon_call_answer, default=@drawable/icon_call_answer_video}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="W,1.26:1"
app:layout_constraintEnd_toEndOf="parent"