Updated media encryption statistics layout

This commit is contained in:
Sylvain Berfini 2024-02-26 14:34:53 +01:00
parent 37bf87e23e
commit 3b626bd0a6
14 changed files with 335 additions and 406 deletions

View file

@ -36,13 +36,11 @@ import androidx.navigation.fragment.findNavController
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
import androidx.window.layout.FoldingFeature
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.CallActiveFragmentBinding
import org.linphone.ui.call.CallActivity
import org.linphone.ui.call.model.CallMediaEncryptionModel
import org.linphone.ui.call.model.ZrtpSasConfirmationDialogModel
import org.linphone.ui.call.viewmodel.CallsViewModel
import org.linphone.ui.call.viewmodel.CurrentCallViewModel
@ -67,8 +65,6 @@ class ActiveCallFragment : GenericCallFragment() {
private var zrtpSasDialog: Dialog? = null
private var bottomSheetDialog: BottomSheetDialogFragment? = null
// For moving video preview purposes
private var previewX: Float = 0f
@ -96,22 +92,11 @@ class ActiveCallFragment : GenericCallFragment() {
}
}
private val numpadBottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
val numpadBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
}
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
val bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
}
@ -177,11 +162,17 @@ class ActiveCallFragment : GenericCallFragment() {
val numpadBottomSheetBehavior = BottomSheetBehavior.from(binding.callNumpad.root)
numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
numpadBottomSheetBehavior.addBottomSheetCallback(numpadBottomSheetCallback)
numpadBottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback)
val callStatsBottomSheetBehavior = BottomSheetBehavior.from(binding.callStats.root)
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callStatsBottomSheetBehavior.addBottomSheetCallback(callStatsBottomSheetCallback)
callStatsBottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback)
val callMediaEncryptionStatsBottomSheetBehavior = BottomSheetBehavior.from(
binding.callMediaEncryptionStats.root
)
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callMediaEncryptionStatsBottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback)
binding.setBackClickListener {
requireActivity().finish()
@ -200,9 +191,17 @@ class ActiveCallFragment : GenericCallFragment() {
binding.setCallStatisticsClickListener {
actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
}
binding.setCallMediaEncryptionStatisticsClickListener {
actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
}
sharedViewModel = requireActivity().run {
ViewModelProvider(this)[SharedCallViewModel::class.java]
}
@ -223,6 +222,7 @@ class ActiveCallFragment : GenericCallFragment() {
sharedViewModel.toggleFullScreenEvent.value = Event(hide)
numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
callViewModel.showZrtpSasDialogEvent.observe(viewLifecycleOwner) {
@ -334,12 +334,6 @@ class ActiveCallFragment : GenericCallFragment() {
}
}
}
callViewModel.showMediaEncryptionStatisticsEvent.observe(viewLifecycleOwner) {
it.consume { model ->
showMediaEncryptionStatistics(model)
}
}
}
@SuppressLint("ClickableViewAccessibility")
@ -363,9 +357,6 @@ class ActiveCallFragment : GenericCallFragment() {
zrtpSasDialog?.dismiss()
zrtpSasDialog = null
bottomSheetDialog?.dismiss()
bottomSheetDialog = null
binding.localPreviewVideoSurface.setOnTouchListener(null)
}
@ -388,22 +379,4 @@ class ActiveCallFragment : GenericCallFragment() {
set.applyTo(constraintLayout)
}
private fun showMediaEncryptionStatistics(model: CallMediaEncryptionModel) {
val modalBottomSheet = MediaEncryptionStatisticsDialogFragment(model)
modalBottomSheet.show(
requireActivity().supportFragmentManager,
MediaEncryptionStatisticsDialogFragment.TAG
)
bottomSheetDialog = modalBottomSheet
model.showZrtpSasValidationDialogEvent.observe(viewLifecycleOwner) {
it.consume {
callViewModel.showZrtpSasDialogIfPossible()
modalBottomSheet.dismiss()
bottomSheetDialog = null
}
}
}
}

View file

@ -31,12 +31,10 @@ import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.CallActiveConferenceFragmentBinding
import org.linphone.ui.call.model.CallMediaEncryptionModel
import org.linphone.ui.call.viewmodel.CallsViewModel
import org.linphone.ui.call.viewmodel.CurrentCallViewModel
import org.linphone.utils.Event
@ -53,6 +51,17 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
private lateinit var callsViewModel: CallsViewModel
private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
val bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
}
override fun onSlide(bottomSheet: View, slideOffset: Float) { }
}
private val actionsBottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_EXPANDED) {
@ -73,19 +82,6 @@ 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(
inflater: LayoutInflater,
container: ViewGroup?,
@ -118,7 +114,13 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
val callStatsBottomSheetBehavior = BottomSheetBehavior.from(binding.callStats.root)
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callStatsBottomSheetBehavior.addBottomSheetCallback(callStatsBottomSheetCallback)
callStatsBottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback)
val callMediaEncryptionStatsBottomSheetBehavior = BottomSheetBehavior.from(
binding.callMediaEncryptionStats.root
)
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callMediaEncryptionStatsBottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback)
callViewModel.callDuration.observe(viewLifecycleOwner) { duration ->
binding.chronometer.base = SystemClock.elapsedRealtime() - (1000 * duration)
@ -152,6 +154,7 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
Log.i("$TAG Switching full screen mode to ${if (hide) "ON" else "OFF"}")
sharedViewModel.toggleFullScreenEvent.value = Event(hide)
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
callViewModel.conferenceModel.conferenceLayout.observe(viewLifecycleOwner) { layout ->
@ -159,12 +162,6 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
}
callViewModel.showMediaEncryptionStatisticsEvent.observe(viewLifecycleOwner) {
it.consume { model ->
showMediaEncryptionStatistics(model)
}
}
binding.setBackClickListener {
requireActivity().finish()
}
@ -194,8 +191,15 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
binding.setCallStatisticsClickListener {
actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
}
binding.setCallMediaEncryptionStatisticsClickListener {
actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
callMediaEncryptionStatsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
}
}
override fun onResume() {
@ -206,20 +210,4 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
callViewModel.updateCallDuration()
}
}
override fun onPause() {
super.onPause()
bottomSheetDialog?.dismiss()
bottomSheetDialog = null
}
private fun showMediaEncryptionStatistics(model: CallMediaEncryptionModel) {
val modalBottomSheet = MediaEncryptionStatisticsDialogFragment(model)
modalBottomSheet.show(
requireActivity().supportFragmentManager,
MediaEncryptionStatisticsDialogFragment.TAG
)
bottomSheetDialog = modalBottomSheet
}
}

View file

@ -1,74 +0,0 @@
/*
* Copyright (c) 2010-2023 Belledonne Communications SARL.
*
* This file is part of linphone-android
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.linphone.ui.call.fragment
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.UiThread
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import org.linphone.databinding.CallStatsBottomSheetBindingImpl
import org.linphone.ui.call.model.CallStatsModel
@UiThread
class CallStatisticsDialogFragment(
private val model: CallStatsModel,
private val onDismiss: (() -> Unit)? = null
) : BottomSheetDialogFragment() {
companion object {
const val TAG = "CallStatisticsDialogFragment"
}
override fun onCancel(dialog: DialogInterface) {
onDismiss?.invoke()
super.onCancel(dialog)
}
override fun onDismiss(dialog: DialogInterface) {
onDismiss?.invoke()
super.onDismiss(dialog)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
// Makes sure all menu entries are visible,
// required for landscape mode (otherwise only first item is visible)
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
return dialog
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val view = CallStatsBottomSheetBindingImpl.inflate(layoutInflater)
view.lifecycleOwner = viewLifecycleOwner
view.model = model
return view.root
}
}

View file

@ -1,74 +0,0 @@
/*
* Copyright (c) 2010-2023 Belledonne Communications SARL.
*
* This file is part of linphone-android
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.linphone.ui.call.fragment
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.UiThread
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import org.linphone.databinding.CallMediaEncryptionStatsBottomSheetBinding
import org.linphone.ui.call.model.CallMediaEncryptionModel
@UiThread
class MediaEncryptionStatisticsDialogFragment(
private val model: CallMediaEncryptionModel,
private val onDismiss: (() -> Unit)? = null
) : BottomSheetDialogFragment() {
companion object {
const val TAG = "MediaEncryptionStatisticsDialogFragment"
}
override fun onCancel(dialog: DialogInterface) {
onDismiss?.invoke()
super.onCancel(dialog)
}
override fun onDismiss(dialog: DialogInterface) {
onDismiss?.invoke()
super.onDismiss(dialog)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
// Makes sure all menu entries are visible,
// required for landscape mode (otherwise only first item is visible)
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
return dialog
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val view = CallMediaEncryptionStatsBottomSheetBinding.inflate(layoutInflater)
view.lifecycleOwner = viewLifecycleOwner
view.model = model
return view.root
}
}

View file

@ -28,7 +28,7 @@ import org.linphone.core.StreamType
import org.linphone.utils.AppUtils
import org.linphone.utils.Event
class CallMediaEncryptionModel @WorkerThread constructor(call: Call) {
class CallMediaEncryptionModel @WorkerThread constructor() {
val mediaEncryption = MutableLiveData<String>()
val isMediaEncryptionZrtp = MutableLiveData<Boolean>()
@ -42,7 +42,8 @@ class CallMediaEncryptionModel @WorkerThread constructor(call: Call) {
MutableLiveData<Event<Boolean>>()
}
init {
@WorkerThread
fun update(call: Call) {
isMediaEncryptionZrtp.postValue(false)
val stats = call.getStats(StreamType.Audio)

View file

@ -106,6 +106,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
val callStatsModel = CallStatsModel()
val callMediaEncryptionModel = CallMediaEncryptionModel()
val incomingCallTitle: MutableLiveData<String> by lazy {
MutableLiveData<String>()
}
@ -149,10 +151,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
MutableLiveData<Event<Pair<String, String>>>()
}
val showMediaEncryptionStatisticsEvent: MutableLiveData<Event<CallMediaEncryptionModel>> by lazy {
MutableLiveData<Event<CallMediaEncryptionModel>>()
}
// Conference
val conferenceModel = ConferenceModel()
@ -195,6 +193,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
@WorkerThread
override fun onEncryptionChanged(call: Call, on: Boolean, authenticationToken: String?) {
updateEncryption()
callMediaEncryptionModel.update(call)
}
override fun onRemoteRecording(call: Call, recording: Boolean) {
@ -696,16 +695,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
}
}
@UiThread
fun showMediaEncryptionStatisticsIfPossible(): Boolean {
coreContext.postOnCoreThread {
val model = CallMediaEncryptionModel(currentCall)
showMediaEncryptionStatisticsEvent.postValue(Event(model))
}
return true
}
@WorkerThread
private fun showZrtpSasDialog(authToken: String) {
val upperCaseAuthToken = authToken.uppercase(Locale.getDefault())
@ -777,6 +766,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
terminatedByUsed = false
currentCall = call
callStatsModel.update(call, call.audioStats)
callMediaEncryptionModel.update(call)
call.addListener(callListener)
if (call.conference != null) {

View file

@ -4,98 +4,147 @@
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
<variable
name="model"
type="org.linphone.ui.call.model.CallMediaEncryptionModel" />
</data>
<androidx.gridlayout.widget.GridLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:columnCount="2"
android:background="?attr/color_main2_000">
android:background="@color/black"
android:visibility="@{viewModel.fullScreenMode || viewModel.pipMode ? View.INVISIBLE : View.VISIBLE}"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.mediaEncryption, default=`Media Encryption: Post Quantum ZRTP`}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical" />
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/handle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="11dp"
android:src="@drawable/shape_drawer_handle"
app:tint="@color/white"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpCipher, default=@string/call_stats_zrtp_cipher_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpKeyAgreement, default=@string/call_stats_zrtp_key_agreement_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpHash, default=@string/call_stats_zrtp_hash_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpAuthTag, default=@string/call_stats_zrtp_auth_tag_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpAuthSas, default=@string/call_stats_zrtp_sas_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/secondary_button_label_style"
android:onClick="@{() -> model.showSasValidationDialog()}"
app:layout_columnSpan="2"
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="@string/call_do_zrtp_sas_validation_again"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"/>
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:background="@drawable/shape_squircle_gray_600_background"
app:columnCount="2"
app:layout_constraintTop_toBottomOf="@id/handle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
</androidx.gridlayout.widget.GridLayout>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/call_stats_media_encryption_title"
android:textSize="12sp"
android:textColor="@color/white"
android:gravity="center"
app:layout_columnSpan="2"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.mediaEncryption, default=`Media Encryption: Post Quantum ZRTP`}"
android:textColor="@color/white"
android:gravity="center"
app:layout_columnWeight="1" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpCipher, default=@string/call_stats_zrtp_cipher_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"
app:layout_columnWeight="1"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpKeyAgreement, default=@string/call_stats_zrtp_key_agreement_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"
app:layout_columnWeight="1" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpHash, default=@string/call_stats_zrtp_hash_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"
app:layout_columnWeight="1" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpAuthTag, default=@string/call_stats_zrtp_auth_tag_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"
app:layout_columnWeight="1" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpAuthSas, default=@string/call_stats_zrtp_sas_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"
app:layout_columnWeight="1" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/secondary_button_label_style"
android:onClick="@{() -> model.showSasValidationDialog()}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="@string/call_do_zrtp_sas_validation_again"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"
app:layout_columnSpan="2"/>
</androidx.gridlayout.widget.GridLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -4,6 +4,9 @@
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
<variable
name="model"
type="org.linphone.ui.call.model.CallStatsModel" />
@ -13,6 +16,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
android:visibility="@{viewModel.fullScreenMode || viewModel.pipMode ? View.INVISIBLE : View.VISIBLE}"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

View file

@ -22,6 +22,9 @@
<variable
name="callStatisticsClickListener"
type="View.OnClickListener" />
<variable
name="callMediaEncryptionStatisticsClickListener"
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -161,7 +164,7 @@
<ImageView
android:id="@+id/media_encryption_icon"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:onClick="@{callMediaEncryptionStatisticsClickListener}"
android:layout_width="@dimen/small_icon_size"
android:layout_height="0dp"
android:layout_marginStart="10dp"
@ -178,7 +181,7 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/media_encryption_label"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:onClick="@{callMediaEncryptionStatisticsClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
@ -268,9 +271,16 @@
bind:participantsListClickListener="@{participantsListClickListener}"
bind:callsListClickListener="@{callsListClickListener}"/>
<include
android:id="@+id/call_media_encryption_stats"
layout="@layout/call_media_encryption_stats_bottom_sheet"
bind:viewModel="@{viewModel}"
bind:model="@{viewModel.callMediaEncryptionModel}"/>
<include
android:id="@+id/call_stats"
layout="@layout/call_stats_bottom_sheet"
bind:viewModel="@{viewModel}"
bind:model="@{viewModel.callStatsModel}"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -18,6 +18,9 @@
<variable
name="callStatisticsClickListener"
type="View.OnClickListener" />
<variable
name="callMediaEncryptionStatisticsClickListener"
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -234,7 +237,7 @@
<ImageView
android:id="@+id/media_encryption_icon"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:onClick="@{callMediaEncryptionStatisticsClickListener}"
android:layout_width="@dimen/small_icon_size"
android:layout_height="0dp"
android:layout_marginStart="10dp"
@ -251,7 +254,7 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/media_encryption_label"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:onClick="@{callMediaEncryptionStatisticsClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
@ -305,9 +308,16 @@
layout="@layout/call_numpad_bottom_sheet"
bind:model="@{numpadModel}"/>
<include
android:id="@+id/call_media_encryption_stats"
layout="@layout/call_media_encryption_stats_bottom_sheet"
bind:viewModel="@{viewModel}"
bind:model="@{viewModel.callMediaEncryptionModel}"/>
<include
android:id="@+id/call_stats"
layout="@layout/call_stats_bottom_sheet"
bind:viewModel="@{viewModel}"
bind:model="@{viewModel.callStatsModel}"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -62,7 +62,6 @@
<ImageView
android:id="@+id/media_encryption_icon"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:layout_width="@dimen/small_icon_size"
android:layout_height="0dp"
android:layout_marginStart="10dp"
@ -79,7 +78,6 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/media_encryption_label"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"

View file

@ -1,93 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
<variable
name="model"
type="org.linphone.ui.call.model.CallMediaEncryptionModel" />
</data>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="?attr/color_main2_000">
android:background="@color/black"
android:visibility="@{viewModel.fullScreenMode || viewModel.pipMode ? View.INVISIBLE : View.VISIBLE}"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/handle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="11dp"
android:src="@drawable/shape_drawer_handle"
app:tint="@color/white"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.mediaEncryption, default=`Media Encryption: Post Quantum ZRTP`}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical" />
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:background="@drawable/shape_squircle_gray_600_background"
app:layout_constraintTop_toBottomOf="@id/handle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpCipher, default=@string/call_stats_zrtp_cipher_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/call_stats_media_encryption_title"
android:textSize="12sp"
android:textColor="@color/white"
android:gravity="center" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpKeyAgreement, default=@string/call_stats_zrtp_key_agreement_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.mediaEncryption, default=`Media Encryption: Post Quantum ZRTP`}"
android:textColor="@color/white"
android:gravity="center" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpHash, default=@string/call_stats_zrtp_hash_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpCipher, default=@string/call_stats_zrtp_cipher_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpAuthTag, default=@string/call_stats_zrtp_auth_tag_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpKeyAgreement, default=@string/call_stats_zrtp_key_agreement_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@{model.zrtpAuthSas, default=@string/call_stats_zrtp_sas_algo}"
android:textColor="?attr/color_grey_900"
android:gravity="center_vertical"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpHash, default=@string/call_stats_zrtp_hash_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/secondary_button_label_style"
android:onClick="@{() -> model.showSasValidationDialog()}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="@string/call_do_zrtp_sas_validation_again"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpAuthTag, default=@string/call_stats_zrtp_auth_tag_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="10dp"
android:text="@{model.zrtpAuthSas, default=@string/call_stats_zrtp_sas_algo}"
android:textColor="@color/white"
android:gravity="center"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/secondary_button_label_style"
android:onClick="@{() -> model.showSasValidationDialog()}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="@string/call_do_zrtp_sas_validation_again"
android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -4,6 +4,9 @@
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
<variable
name="model"
type="org.linphone.ui.call.model.CallStatsModel" />
@ -13,6 +16,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
android:visibility="@{viewModel.fullScreenMode || viewModel.pipMode ? View.INVISIBLE : View.VISIBLE}"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

View file

@ -558,6 +558,7 @@
<string name="call_stats_resolution_label">Resolution: %s</string>
<string name="call_stats_fps_label">FPS: %s</string>
<string name="call_stats_media_encryption_title">Media encryption</string>
<string name="call_stats_media_encryption">Media encryption: %s</string>
<string name="call_stats_media_encryption_zrtp_post_quantum">Post Quantum ZRTP</string>
<string name="call_stats_zrtp_cipher_algo">Cipher algorithm: %s</string>