mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Fixed contac/call log showing when going back from account profile + added logs
This commit is contained in:
parent
395e43a3e6
commit
bb55246197
4 changed files with 35 additions and 9 deletions
|
|
@ -32,6 +32,7 @@ import androidx.annotation.UiThread
|
|||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
|
|
@ -44,6 +45,10 @@ import org.linphone.utils.Event
|
|||
|
||||
@UiThread
|
||||
class CallFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Call Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: CallFragmentBinding
|
||||
|
||||
private lateinit var viewModel: CallLogViewModel
|
||||
|
|
@ -61,6 +66,8 @@ class CallFragment : GenericFragment() {
|
|||
|
||||
override fun goBack() {
|
||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||
// If not done, when going back to CallsFragment this fragment will be created again
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
@ -74,7 +81,7 @@ class CallFragment : GenericFragment() {
|
|||
binding.viewModel = viewModel
|
||||
|
||||
val callId = args.callId
|
||||
Log.i("[Call Fragment] Looking up for call log with call id [$callId]")
|
||||
Log.i("$TAG Looking up for call log with call id [$callId]")
|
||||
viewModel.findCallLogByCallId(callId)
|
||||
|
||||
binding.setBackClickListener {
|
||||
|
|
@ -90,10 +97,14 @@ class CallFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
viewModel.callLogFoundEvent.observe(viewLifecycleOwner) {
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
it.consume {
|
||||
Log.i("$TAG Call log has been found, start postponed enter transition")
|
||||
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
sharedViewModel.openSlidingPaneEvent.value = Event(true)
|
||||
}
|
||||
sharedViewModel.openSlidingPaneEvent.value = Event(true)
|
||||
}
|
||||
|
||||
viewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class ContactFragment : GenericFragment() {
|
|||
|
||||
override fun goBack() {
|
||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||
// If not done, when going back to ContactsFragment this fragment will be created again
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
@ -83,7 +85,7 @@ class ContactFragment : GenericFragment() {
|
|||
binding.viewModel = viewModel
|
||||
|
||||
val refKey = args.contactRefKey
|
||||
Log.i("[Contact Fragment] Looking up for contact with ref key [$refKey]")
|
||||
Log.i("$TAG Looking up for contact with ref key [$refKey]")
|
||||
viewModel.findContactByRefKey(refKey)
|
||||
|
||||
binding.setBackClickListener {
|
||||
|
|
@ -105,10 +107,13 @@ class ContactFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
viewModel.contactFoundEvent.observe(viewLifecycleOwner) {
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
it.consume {
|
||||
Log.i("$TAG Contact has been found, start postponed enter transition")
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
sharedViewModel.openSlidingPaneEvent.value = Event(true)
|
||||
}
|
||||
sharedViewModel.openSlidingPaneEvent.value = Event(true)
|
||||
}
|
||||
|
||||
viewModel.showLongPressMenuForNumberOrAddressEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ import org.linphone.utils.SlidingPaneBackPressedCallback
|
|||
|
||||
@UiThread
|
||||
class ContactsFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Contacts Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: ContactsFragmentBinding
|
||||
|
||||
override fun onCreateView(
|
||||
|
|
@ -56,12 +60,14 @@ class ContactsFragment : GenericFragment() {
|
|||
|
||||
sharedViewModel.contactsListReadyToBeDisplayedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Contacts list is ready, starting postponed enter transition")
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.contactEditorReadyToBeDisplayedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Contact editor is ready, starting postponed enter transition")
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
}
|
||||
|
|
@ -82,6 +88,7 @@ class ContactsFragment : GenericFragment() {
|
|||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume {
|
||||
Log.i("$TAG Closing sliding pane")
|
||||
binding.slidingPaneLayout.closePane()
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +97,7 @@ class ContactsFragment : GenericFragment() {
|
|||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume {
|
||||
Log.i("$TAG Opening sliding pane")
|
||||
binding.slidingPaneLayout.openPane()
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +106,7 @@ class ContactsFragment : GenericFragment() {
|
|||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume { refKey ->
|
||||
Log.i("[Contacts Fragment] Displaying contact with ref key [$refKey]")
|
||||
Log.i("$TAG Displaying contact with ref key [$refKey]")
|
||||
val navController = binding.contactsRightNavContainer.findNavController()
|
||||
val action = ContactFragmentDirections.actionGlobalContactFragment(
|
||||
refKey
|
||||
|
|
@ -111,6 +119,7 @@ class ContactsFragment : GenericFragment() {
|
|||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume {
|
||||
Log.i("$TAG Opening contact editor for creating new contact")
|
||||
val navController = binding.contactsLeftNavContainer.findNavController()
|
||||
navController.navigate(R.id.action_global_newContactFragment)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue