Fixed issue with switch from grid to active speaker conference layout when 6 participants are reached

This commit is contained in:
Sylvain Berfini 2022-06-27 11:22:23 +02:00
parent 219cfed4ce
commit f3419951f8
4 changed files with 4 additions and 8 deletions

View file

@ -84,6 +84,7 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
viewLifecycleOwner
) { displayMode ->
startTimer(R.id.active_conference_timer)
if (displayMode == ConferenceDisplayMode.ACTIVE_SPEAKER) {
if (conferenceViewModel.conferenceExists.value == true) {
Log.i("[Conference Call] Local participant is in conference and current layout is active speaker, updating Core's native window id")
@ -107,6 +108,8 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
it.size > conferenceViewModel.maxParticipantsForMosaicLayout
) {
showSnackBar(R.string.conference_too_many_participants_for_mosaic_layout)
Log.w("[Conference Call] More than ${conferenceViewModel.maxParticipantsForMosaicLayout} participants (${it.size}), forcing active speaker layout")
conferenceViewModel.conferenceDisplayMode.value = ConferenceDisplayMode.ACTIVE_SPEAKER
}
}

View file

@ -49,7 +49,7 @@ class ConferenceLayoutFragment : GenericFragment<VoipConferenceLayoutFragmentBin
conferenceViewModel.conferenceParticipantDevices.observe(
viewLifecycleOwner
) {
if (it.size > conferenceViewModel.maxParticipantsForMosaicLayout) {
if (it.size > conferenceViewModel.maxParticipantsForMosaicLayout && conferenceViewModel.conferenceDisplayMode.value == ConferenceDisplayMode.GRID) {
showTooManyParticipantsForMosaicLayoutDialog()
}
}

View file

@ -69,12 +69,6 @@ class ConferenceViewModel : ViewModel() {
override fun onParticipantAdded(conference: Conference, participant: Participant) {
Log.i("[Conference] Participant added: ${participant.address.asStringUriOnly()}")
updateParticipantsList(conference)
val count = conferenceParticipants.value.orEmpty().size
if (count > maxParticipantsForMosaicLayout && conferenceDisplayMode.value == ConferenceDisplayMode.GRID) {
Log.w("[Conference] More than $maxParticipantsForMosaicLayout participants ($count), forcing active speaker layout")
conferenceDisplayMode.value = ConferenceDisplayMode.ACTIVE_SPEAKER
}
}
override fun onParticipantRemoved(conference: Conference, participant: Participant) {

View file

@ -93,7 +93,6 @@
android:checked="@{conferenceViewModel.conferenceDisplayMode == ConferenceDisplayMode.ACTIVE_SPEAKER}"
android:drawableEnd="@drawable/icon_conference_layout_active_speaker"
android:drawableTint="?attr/voipDrawableColor"
android:enabled="@{conferenceViewModel.conferenceParticipantDevices.size() > conferenceViewModel.maxParticipantsForMosaicLayout ? false : true}"
android:onClickListener="@{() -> conferenceViewModel.changeLayout(ConferenceDisplayMode.ACTIVE_SPEAKER)}"
android:text="@string/conference_display_mode_active_speaker" />