Added statistics bottom sheet to conference

This commit is contained in:
Sylvain Berfini 2024-02-26 12:30:51 +01:00
parent d7d6767361
commit 4536f917f6
4 changed files with 24 additions and 10 deletions

View file

@ -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

View file

@ -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(

View file

@ -268,6 +268,11 @@
bind:participantsListClickListener="@{participantsListClickListener}"
bind:callsListClickListener="@{callsListClickListener}"/>
<include
android:id="@+id/call_stats"
layout="@layout/call_stats_bottom_sheet"
bind:model="@{viewModel.callStatsModel}"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

View file

@ -27,9 +27,6 @@
<variable
name="numpadModel"
type="org.linphone.ui.main.history.model.NumpadModel" />
<variable
name="callStatsModel"
type="org.linphone.ui.call.model.CallStatsModel" />
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
@ -311,7 +308,7 @@
<include
android:id="@+id/call_stats"
layout="@layout/call_stats_bottom_sheet"
bind:model="@{callStatsModel}"/>
bind:model="@{viewModel.callStatsModel}"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>