Fixed devices order depending on conference layout + set/restore navigation status bar color when going/leaving waiting room

This commit is contained in:
Sylvain Berfini 2024-01-29 11:00:06 +01:00
parent 247f763c11
commit 4697af6c27
2 changed files with 26 additions and 1 deletions

View file

@ -342,7 +342,17 @@ class ConferenceModel {
}
if (meDeviceData != null) {
val index = sortedList.indexOf(meDeviceData)
val expectedIndex = sortedList.size - 1 // TODO FIXME : use different order for active speaker layout & grid layout
val expectedIndex = if (conferenceLayout.value == ACTIVE_SPEAKER_LAYOUT) {
Log.i(
"$TAG Current conference layout is [Active Speaker], expecting our device to be at the beginning of the list"
)
0
} else {
Log.i(
"$TAG Current conference layout isn't [Active Speaker], expecting our device to be at the end of the list"
)
sortedList.size - 1
}
if (index != expectedIndex) {
Log.i(
"$TAG Me device data is at index $index, moving it to index $expectedIndex"

View file

@ -33,6 +33,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.MeetingWaitingRoomFragmentBinding
import org.linphone.ui.main.fragment.GenericFragment
@ -62,6 +63,8 @@ class MeetingWaitingRoomFragment : GenericFragment() {
}
}
private var navBarDefaultColor: Int = -1
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@ -79,6 +82,8 @@ class MeetingWaitingRoomFragment : GenericFragment() {
postponeEnterTransition()
super.onViewCreated(view, savedInstanceState)
navBarDefaultColor = requireActivity().window.navigationBarColor
binding.lifecycleOwner = viewLifecycleOwner
viewModel = ViewModelProvider(this)[MeetingWaitingRoomViewModel::class.java]
@ -124,6 +129,9 @@ class MeetingWaitingRoomFragment : GenericFragment() {
}
override fun onResume() {
// Force this navigation bar color
requireActivity().window.navigationBarColor = requireContext().getColor(R.color.gray_900)
super.onResume()
if (isCameraPermissionGranted()) {
@ -144,6 +152,13 @@ class MeetingWaitingRoomFragment : GenericFragment() {
super.onPause()
}
override fun onDestroy() {
// Reset default navigation bar color
requireActivity().window.navigationBarColor = navBarDefaultColor
super.onDestroy()
}
private fun isCameraPermissionGranted(): Boolean {
val granted = ContextCompat.checkSelfPermission(
requireContext(),