Fixed crash when animations are disabled + crash when creating 1-1 encrypted chat room
This commit is contained in:
parent
1d0cbbcc69
commit
2dd034cfbd
2 changed files with 15 additions and 8 deletions
|
@ -91,7 +91,9 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelI
|
||||||
get() = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
|
get() = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
|
||||||
|
|
||||||
val peerSipUri: String
|
val peerSipUri: String
|
||||||
get() = if (oneToOneChatRoom && !basicChatRoom) chatRoom.participants.first().address.asStringUriOnly()
|
get() = if (oneToOneChatRoom && !basicChatRoom)
|
||||||
|
chatRoom.participants.firstOrNull()?.address?.asStringUriOnly()
|
||||||
|
?: chatRoom.peerAddress.asStringUriOnly()
|
||||||
else chatRoom.peerAddress.asStringUriOnly()
|
else chatRoom.peerAddress.asStringUriOnly()
|
||||||
|
|
||||||
val oneParticipantOneDevice: Boolean
|
val oneParticipantOneDevice: Boolean
|
||||||
|
|
|
@ -26,6 +26,7 @@ import androidx.core.view.doOnPreDraw
|
||||||
import androidx.databinding.ViewDataBinding
|
import androidx.databinding.ViewDataBinding
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import org.linphone.LinphoneApplication
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.activities.main.viewmodels.DialogViewModel
|
import org.linphone.activities.main.viewmodels.DialogViewModel
|
||||||
import org.linphone.activities.main.viewmodels.ListTopBarViewModel
|
import org.linphone.activities.main.viewmodels.ListTopBarViewModel
|
||||||
|
@ -91,13 +92,17 @@ abstract class MasterFragment<T : ViewDataBinding, U : SelectionListAdapter<*, *
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
// Do not use postponeEnterTransition when fragment is recreated from the back stack,
|
// Do not use postponeEnterTransition when fragment is recreated from the back stack,
|
||||||
// otherwise the previous fragment will be visible until the animation starts
|
// otherwise the previous fragment will be visible until the animation starts
|
||||||
val resume = findNavController().currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>("resume")?.value ?: false
|
if (LinphoneApplication.corePreferences.enableAnimations) {
|
||||||
if (!resume) {
|
val resume =
|
||||||
findNavController().currentBackStackEntry?.savedStateHandle?.set("resume", true)
|
findNavController().currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>("resume")?.value
|
||||||
// To ensure animation will be smooth,
|
?: false
|
||||||
// wait until the adapter is loaded to display the fragment
|
if (!resume) {
|
||||||
postponeEnterTransition()
|
findNavController().currentBackStackEntry?.savedStateHandle?.set("resume", true)
|
||||||
view.doOnPreDraw { startPostponedEnterTransition() }
|
// To ensure animation will be smooth,
|
||||||
|
// wait until the adapter is loaded to display the fragment
|
||||||
|
postponeEnterTransition()
|
||||||
|
view.doOnPreDraw { startPostponedEnterTransition() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
Loading…
Reference in a new issue