mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Fix for empty fragment still opened after device rotation if user clicked on the empty part
This commit is contained in:
parent
5f17dd8534
commit
9d3ef9e8a5
1 changed files with 13 additions and 0 deletions
|
|
@ -24,14 +24,19 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.databinding.EmptyFragmentBinding
|
||||
import org.linphone.ui.GenericFragment
|
||||
import org.linphone.ui.main.viewmodel.SharedMainViewModel
|
||||
import org.linphone.utils.Event
|
||||
|
||||
@UiThread
|
||||
class EmptyFragment : GenericFragment() {
|
||||
private lateinit var binding: EmptyFragmentBinding
|
||||
|
||||
protected lateinit var sharedViewModel: SharedMainViewModel
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
|
@ -45,11 +50,19 @@ class EmptyFragment : GenericFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this)[SharedMainViewModel::class.java]
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
findNavController().popBackStack()
|
||||
|
||||
// This should prevent empty fragment from staying visible
|
||||
// after the device rotated if user touched the empty fragment on the right
|
||||
sharedViewModel.closeSlidingPaneEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue