From 4536f917f64a98f2f844ad0da489057e8b07f394 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 26 Feb 2024 12:30:51 +0100 Subject: [PATCH] Added statistics bottom sheet to conference --- .../ui/call/fragment/ActiveCallFragment.kt | 1 - .../fragment/ActiveConferenceCallFragment.kt | 23 +++++++++++++++---- .../call_active_conference_fragment.xml | 5 ++++ .../main/res/layout/call_active_fragment.xml | 5 +--- 4 files changed, 24 insertions(+), 10 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 70a35499f..f1aa36402 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 @@ -170,7 +170,6 @@ class ActiveCallFragment : GenericCallFragment() { binding.viewModel = callViewModel binding.callsViewModel = callsViewModel binding.numpadModel = callViewModel.numpadModel - binding.callStatsModel = callViewModel.callStatsModel val actionsBottomSheetBehavior = BottomSheetBehavior.from(binding.bottomBar.root) actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED diff --git a/app/src/main/java/org/linphone/ui/call/fragment/ActiveConferenceCallFragment.kt b/app/src/main/java/org/linphone/ui/call/fragment/ActiveConferenceCallFragment.kt index d034af915..2c47830fd 100644 --- a/app/src/main/java/org/linphone/ui/call/fragment/ActiveConferenceCallFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/fragment/ActiveConferenceCallFragment.kt @@ -73,6 +73,17 @@ class ActiveConferenceCallFragment : GenericCallFragment() { override fun onSlide(bottomSheet: View, slideOffset: Float) { } } + private val callStatsBottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() { + override fun onStateChanged(bottomSheet: View, newState: Int) { + if (newState == BottomSheetBehavior.STATE_COLLAPSED) { + val callStatsBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet) + callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN + } + } + + override fun onSlide(bottomSheet: View, slideOffset: Float) { } + } + private var bottomSheetDialog: BottomSheetDialogFragment? = null override fun onCreateView( @@ -105,6 +116,10 @@ class ActiveConferenceCallFragment : GenericCallFragment() { actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED actionsBottomSheetBehavior.addBottomSheetCallback(actionsBottomSheetCallback) + val callStatsBottomSheetBehavior = BottomSheetBehavior.from(binding.callStats.root) + callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN + callStatsBottomSheetBehavior.addBottomSheetCallback(callStatsBottomSheetCallback) + callViewModel.callDuration.observe(viewLifecycleOwner) { duration -> binding.chronometer.base = SystemClock.elapsedRealtime() - (1000 * duration) binding.chronometer.start() @@ -136,6 +151,7 @@ class ActiveConferenceCallFragment : GenericCallFragment() { callViewModel.fullScreenMode.observe(viewLifecycleOwner) { hide -> Log.i("$TAG Switching full screen mode to ${if (hide) "ON" else "OFF"}") sharedViewModel.toggleFullScreenEvent.value = Event(hide) + callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN } callViewModel.conferenceModel.conferenceLayout.observe(viewLifecycleOwner) { layout -> @@ -177,7 +193,8 @@ class ActiveConferenceCallFragment : GenericCallFragment() { } binding.setCallStatisticsClickListener { - showCallStatistics() + actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED + callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED } } @@ -197,10 +214,6 @@ class ActiveConferenceCallFragment : GenericCallFragment() { bottomSheetDialog = null } - private fun showCallStatistics() { - // TODO - } - private fun showMediaEncryptionStatistics(model: CallMediaEncryptionModel) { val modalBottomSheet = MediaEncryptionStatisticsDialogFragment(model) modalBottomSheet.show( diff --git a/app/src/main/res/layout/call_active_conference_fragment.xml b/app/src/main/res/layout/call_active_conference_fragment.xml index 4eab9a486..ce701886e 100644 --- a/app/src/main/res/layout/call_active_conference_fragment.xml +++ b/app/src/main/res/layout/call_active_conference_fragment.xml @@ -268,6 +268,11 @@ bind:participantsListClickListener="@{participantsListClickListener}" bind:callsListClickListener="@{callsListClickListener}"/> + + \ No newline at end of file diff --git a/app/src/main/res/layout/call_active_fragment.xml b/app/src/main/res/layout/call_active_fragment.xml index 6e5615985..2d18808c7 100644 --- a/app/src/main/res/layout/call_active_fragment.xml +++ b/app/src/main/res/layout/call_active_fragment.xml @@ -27,9 +27,6 @@ - + bind:model="@{viewModel.callStatsModel}"/>