diff --git a/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt b/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt index be868a14e..bee37298d 100644 --- a/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt @@ -68,6 +68,8 @@ class ConferenceViewModel val conferenceLayout = MutableLiveData() + val screenSharingParticipantName = MutableLiveData() + val isScreenSharing = MutableLiveData() val isPaused = MutableLiveData() @@ -240,7 +242,17 @@ class ConferenceViewModel "$TAG Participant device [${device.address.asStringUriOnly()}] is ${if (enabled) "sharing it's screen" else "no longer sharing it's screen"}" ) isScreenSharing.postValue(enabled) + if (enabled) { + val deviceModel = participantDevices.value.orEmpty().find { + it.device == device || device.address.weakEqual(it.device.address) + } + if (deviceModel != null) { + screenSharingParticipantName.postValue(deviceModel.name) + } else { + Log.w("$TAG Failed to find screen sharing participant device model!") + } + val call = conference.call if (call != null) { val currentLayout = getCurrentLayout(call) @@ -253,6 +265,8 @@ class ConferenceViewModel } else { Log.e("$TAG Screen sharing was enabled but conference's call is null!") } + } else { + screenSharingParticipantName.postValue("") } } @@ -577,6 +591,10 @@ class ConferenceViewModel activeSpeaker.postValue(model) activeSpeakerParticipantDeviceFound = true } + if (device == conference.screenSharingParticipantDevice) { + Log.i("$TAG Using participant is [${model.name}] as current screen sharing sender") + screenSharingParticipantName.postValue(model.name) + } } } } diff --git a/app/src/main/res/layout-land/call_conference_active_speaker_fragment.xml b/app/src/main/res/layout-land/call_conference_active_speaker_fragment.xml index 0744c8de8..04aca49bc 100644 --- a/app/src/main/res/layout-land/call_conference_active_speaker_fragment.xml +++ b/app/src/main/res/layout-land/call_conference_active_speaker_fragment.xml @@ -110,7 +110,7 @@ android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginBottom="10dp" - android:text="@{conferenceViewModel.activeSpeaker.name, default=`John Doe`}" + android:text="@{conferenceViewModel.isScreenSharing ? conferenceViewModel.screenSharingParticipantName : conferenceViewModel.activeSpeaker.name, default=`John Doe`}" android:textColor="@color/bc_white" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/call_conference_active_speaker_fragment.xml b/app/src/main/res/layout/call_conference_active_speaker_fragment.xml index 3d25fa6a0..2eff85894 100644 --- a/app/src/main/res/layout/call_conference_active_speaker_fragment.xml +++ b/app/src/main/res/layout/call_conference_active_speaker_fragment.xml @@ -109,7 +109,7 @@ android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_marginBottom="10dp" - android:text="@{conferenceViewModel.activeSpeaker.name, default=`John Doe`}" + android:text="@{conferenceViewModel.isScreenSharing ? conferenceViewModel.screenSharingParticipantName : conferenceViewModel.activeSpeaker.name, default=`John Doe`}" android:textColor="@color/bc_white" android:textSize="20sp" app:layout_constraintBottom_toTopOf="@id/active_speaker_miniatures_horizontal_layout"