mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed drawer opened to latest seen contact when navigating back
This commit is contained in:
parent
84e05e9490
commit
af75f4c3a3
3 changed files with 17 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
import org.linphone.R
|
||||
|
|
@ -79,6 +80,9 @@ class CallsFragment : GenericFragment() {
|
|||
sharedViewModel.navigateToConversationsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.callsFragment) {
|
||||
// To prevent any previously seen contact to show up when navigating back to here later
|
||||
binding.callsRightNavContainer.findNavController().popBackStack()
|
||||
|
||||
val action =
|
||||
CallsFragmentDirections.actionCallsFragmentToConversationsFragment()
|
||||
findNavController().navigate(action)
|
||||
|
|
@ -89,6 +93,9 @@ class CallsFragment : GenericFragment() {
|
|||
sharedViewModel.navigateToContactsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.callsFragment) {
|
||||
// To prevent any previously seen contact to show up when navigating back to here later
|
||||
binding.callsRightNavContainer.findNavController().popBackStack()
|
||||
|
||||
val action = CallsFragmentDirections.actionCallsFragmentToContactsFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import androidx.core.view.doOnPreDraw
|
|||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import androidx.transition.ChangeBounds
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ContactFragmentBinding
|
||||
import org.linphone.ui.contacts.viewmodel.ContactViewModel
|
||||
import org.linphone.ui.fragment.GenericFragment
|
||||
|
|
@ -64,6 +65,7 @@ class ContactFragment : GenericFragment() {
|
|||
binding.viewModel = viewModel
|
||||
|
||||
val refKey = args.contactRefKey
|
||||
Log.i("[Contact Fragment] Looking up for contact with ref key [$refKey]")
|
||||
viewModel.findContactByRefKey(refKey)
|
||||
|
||||
binding.setBackClickListener {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import androidx.navigation.findNavController
|
|||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ContactsFragmentBinding
|
||||
import org.linphone.ui.fragment.GenericFragment
|
||||
import org.linphone.utils.SlidingPaneBackPressedCallback
|
||||
|
|
@ -81,6 +82,7 @@ class ContactsFragment : GenericFragment() {
|
|||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume { refKey ->
|
||||
Log.i("[Contacts Fragment] Displaying contact with ref key [$refKey]")
|
||||
val navController = binding.contactsRightNavContainer.findNavController()
|
||||
val action = ContactFragmentDirections.actionGlobalContactFragment(
|
||||
refKey
|
||||
|
|
@ -92,6 +94,9 @@ class ContactsFragment : GenericFragment() {
|
|||
sharedViewModel.navigateToConversationsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.contactsFragment) {
|
||||
// To prevent any previously seen contact to show up when navigating back to here later
|
||||
binding.contactsRightNavContainer.findNavController().popBackStack()
|
||||
|
||||
val action = ContactsFragmentDirections.actionContactsFragmentToConversationsFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
|
@ -101,6 +106,9 @@ class ContactsFragment : GenericFragment() {
|
|||
sharedViewModel.navigateToCallsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.contactsFragment) {
|
||||
// To prevent any previously seen contact to show up when navigating back to here later
|
||||
binding.contactsRightNavContainer.findNavController().popBackStack()
|
||||
|
||||
val action = ContactsFragmentDirections.actionContactsFragmentToCallsFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue