From d82eac61751ede786e9c8d39b635f1bdd3423d34 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 8 Jan 2024 11:27:43 +0100 Subject: [PATCH] Fixed numpad bottom sheet visible after switching fullscreen mode in video call --- .../ui/call/fragment/ActiveCallFragment.kt | 16 +++++++++++++++- app/src/main/res/layout/call_active_fragment.xml | 1 - 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt b/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt index c22464810..20b48aecf 100644 --- a/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt @@ -90,6 +90,18 @@ class ActiveCallFragment : GenericCallFragment() { } } + private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() { + override fun onStateChanged(bottomSheet: View, newState: Int) { + Log.i("$TAG Bottom sheet state is [$newState]") + if (newState == BottomSheetBehavior.STATE_COLLAPSED) { + val numpadBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet) + numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN + } + } + + override fun onSlide(bottomSheet: View, slideOffset: Float) { } + } + override fun onCreateAnimation(transit: Int, enter: Boolean, nextAnim: Int): Animation? { if (findNavController().currentDestination?.id == R.id.newCallFragment || findNavController().currentDestination?.id == R.id.callsListFragment) { // Holds fragment in place while new fragment slides over it @@ -127,7 +139,8 @@ class ActiveCallFragment : GenericCallFragment() { actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED val numpadBottomSheetBehavior = BottomSheetBehavior.from(binding.callNumpad.root) - numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED + numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN + numpadBottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback) binding.setNewCallClickListener { val action = ActiveCallFragmentDirections.actionActiveCallFragmentToNewCallFragment() @@ -157,6 +170,7 @@ class ActiveCallFragment : GenericCallFragment() { callViewModel.fullScreenMode.observe(viewLifecycleOwner) { hide -> Log.i("$TAG Switching full screen mode to ${if (hide) "ON" else "OFF"}") sharedViewModel.toggleFullScreenEvent.value = Event(hide) + numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN } callViewModel.isRemoteDeviceTrusted.observe(viewLifecycleOwner) { trusted -> diff --git a/app/src/main/res/layout/call_active_fragment.xml b/app/src/main/res/layout/call_active_fragment.xml index 68ba6b761..ca2e583f8 100644 --- a/app/src/main/res/layout/call_active_fragment.xml +++ b/app/src/main/res/layout/call_active_fragment.xml @@ -257,7 +257,6 @@