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 fe11b23cd..bb6b4cbf2 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 @@ -29,13 +29,18 @@ import android.view.View import android.view.ViewGroup 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 +import org.linphone.utils.startAnimatedDrawable class ActiveConferenceCallFragment : GenericCallFragment() { companion object { @@ -48,6 +53,28 @@ class ActiveConferenceCallFragment : GenericCallFragment() { private lateinit var callsViewModel: CallsViewModel + private val actionsBottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() { + override fun onStateChanged(bottomSheet: View, newState: Int) { + if (newState == BottomSheetBehavior.STATE_EXPANDED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_handle_to_caret + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + } else if (newState == BottomSheetBehavior.STATE_COLLAPSED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_caret_to_handle + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + } + } + + override fun onSlide(bottomSheet: View, slideOffset: Float) { } + } + + private var bottomSheetDialog: BottomSheetDialogFragment? = null + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -76,6 +103,7 @@ class ActiveConferenceCallFragment : GenericCallFragment() { val actionsBottomSheetBehavior = BottomSheetBehavior.from(binding.bottomBar.root) actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED + actionsBottomSheetBehavior.addBottomSheetCallback(actionsBottomSheetCallback) callViewModel.callDuration.observe(viewLifecycleOwner) { duration -> binding.chronometer.base = SystemClock.elapsedRealtime() - (1000 * duration) @@ -86,8 +114,20 @@ class ActiveConferenceCallFragment : GenericCallFragment() { it.consume { val state = actionsBottomSheetBehavior.state if (state == BottomSheetBehavior.STATE_COLLAPSED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_caret_to_handle + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + binding.bottomBar.mainActions.handle.startAnimatedDrawable() actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED } else if (state == BottomSheetBehavior.STATE_EXPANDED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_handle_to_caret + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + binding.bottomBar.mainActions.handle.startAnimatedDrawable() actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED } } @@ -103,6 +143,16 @@ class ActiveConferenceCallFragment : GenericCallFragment() { actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED } + callViewModel.showMediaEncryptionStatisticsEvent.observe(viewLifecycleOwner) { + it.consume { model -> + showMediaEncryptionStatistics(model) + } + } + + binding.setBackClickListener { + requireActivity().finish() + } + binding.setCallsListClickListener { Log.i("$TAG Going to calls list fragment") val action = ActiveConferenceCallFragmentDirections.actionActiveConferenceCallFragmentToCallsListFragment() @@ -125,6 +175,10 @@ class ActiveConferenceCallFragment : GenericCallFragment() { clipboard.setPrimaryClip(ClipData.newPlainText(label, sipUri)) } } + + binding.setCallStatisticsClickListener { + showCallStatistics() + } } override fun onResume() { @@ -135,4 +189,17 @@ class ActiveConferenceCallFragment : GenericCallFragment() { callViewModel.updateCallDuration() } } + + private fun showCallStatistics() { + // TODO + } + + private fun showMediaEncryptionStatistics(model: CallMediaEncryptionModel) { + val modalBottomSheet = MediaEncryptionStatisticsDialogFragment(model) + modalBottomSheet.show( + requireActivity().supportFragmentManager, + MediaEncryptionStatisticsDialogFragment.TAG + ) + bottomSheetDialog = modalBottomSheet + } } 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 ca8527bf4..9f69d4811 100644 --- a/app/src/main/res/layout/call_active_conference_fragment.xml +++ b/app/src/main/res/layout/call_active_conference_fragment.xml @@ -7,6 +7,9 @@ + @@ -16,6 +19,9 @@ + @@ -40,27 +46,11 @@ android:layout_height="match_parent" android:background="@color/gray_900"> - - @@ -93,8 +83,8 @@ android:drawablePadding="8dp" app:drawableTint="@color/gray_main2_400" app:layout_constraintTop_toBottomOf="@id/waiting_for_others" - app:layout_constraintStart_toStartOf="@id/background" - app:layout_constraintEnd_toEndOf="@id/background"/> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent"/> + app:layout_constraintBottom_toBottomOf="@id/media_encryption_icon"/> + app:constraint_referenced_ids="back, conference_subject, separator, chronometer" /> + app:layout_constraintTop_toTopOf="parent" + app:tint="@color/white" /> + + + + + + + app:layout_constraintEnd_toStartOf="@+id/stats" /> - - @@ -261,12 +247,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="10dp" - android:layout_marginBottom="40dp" + android:layout_marginBottom="20dp" android:visibility="@{viewModel.isVideoEnabled ? View.VISIBLE : View.GONE}" app:alignTopRight="true" app:displayMode="black_bars" - app:layout_constraintBottom_toBottomOf="@id/background" - app:layout_constraintEnd_toEndOf="@id/background" + app:layout_constraintBottom_toBottomOf="@id/remote_video_surface" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHeight_max="200dp" app:layout_constraintWidth_max="200dp" /> @@ -278,8 +264,8 @@ android:layout_marginStart="10dp" android:src="@drawable/record_fill" android:visibility="@{viewModel.isRecording ? View.VISIBLE : View.GONE, default=gone}" - app:layout_constraintTop_toTopOf="@id/background" - app:layout_constraintStart_toStartOf="@id/background" + app:layout_constraintTop_toBottomOf="@id/media_encryption_icon" + app:layout_constraintStart_toStartOf="parent" app:tint="?attr/color_danger_500" /> diff --git a/app/src/main/res/layout/call_ended_fragment.xml b/app/src/main/res/layout/call_ended_fragment.xml index 0df8dbe6c..0a81fd230 100644 --- a/app/src/main/res/layout/call_ended_fragment.xml +++ b/app/src/main/res/layout/call_ended_fragment.xml @@ -16,30 +16,16 @@ android:layout_height="match_parent" android:background="@color/gray_900"> - - - - + app:layout_constraintTop_toTopOf="parent" + app:tint="@color/white" /> - - - - - - + android:visibility="@{viewModel.conferenceModel.isCurrentCallInConference ? View.GONE : View.VISIBLE}" + app:layout_constraintStart_toEndOf="@id/back" + app:layout_constraintTop_toTopOf="@id/back" + app:layout_constraintBottom_toBottomOf="@id/back"/> + app:layout_constraintStart_toEndOf="@id/call_direction_label" + app:layout_constraintTop_toTopOf="@id/call_direction_label" + app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/> + app:layout_constraintTop_toTopOf="@id/call_direction_label" + app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/> - - + android:layout_marginStart="10dp" + android:adjustViewBounds="true" + android:paddingTop="3dp" + android:contentDescription="@null" + android:src="@{viewModel.isZrtpPq ? @drawable/atom : @drawable/lock_simple, default=@drawable/atom}" + android:visibility="@{!viewModel.fullScreenMode && !viewModel.pipMode && viewModel.isMediaEncrypted ? View.VISIBLE : View.GONE}" + app:layout_constraintStart_toEndOf="@id/back" + app:layout_constraintTop_toTopOf="@id/media_encryption_label" + app:layout_constraintBottom_toBottomOf="@id/media_encryption_label" + app:tint="@color/blue_info_500" /> + + diff --git a/app/src/main/res/layout/call_incoming_fragment.xml b/app/src/main/res/layout/call_incoming_fragment.xml index 88cf6c394..f6b2753d3 100644 --- a/app/src/main/res/layout/call_incoming_fragment.xml +++ b/app/src/main/res/layout/call_incoming_fragment.xml @@ -37,32 +37,7 @@ android:layout_marginBottom="10dp" android:text="@{viewModel.incomingCallTitle, default=@string/call_incoming}" app:layout_constraintStart_toEndOf="@id/call_direction_icon" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toTopOf="@id/background"/> - - - - + app:layout_constraintTop_toTopOf="parent"/> + app:layout_constraintVertical_chainStyle="packed" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/call_direction_label" + app:layout_constraintBottom_toTopOf="@id/name"/> @@ -129,6 +106,7 @@ android:textSize="14sp" android:visibility="@{viewModel.conferenceModel.isCurrentCallInConference ? View.GONE : View.VISIBLE}" app:layout_constraintTop_toBottomOf="@id/name" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" /> diff --git a/app/src/main/res/layout/call_outgoing_fragment.xml b/app/src/main/res/layout/call_outgoing_fragment.xml index 8ac4c17eb..85b226460 100644 --- a/app/src/main/res/layout/call_outgoing_fragment.xml +++ b/app/src/main/res/layout/call_outgoing_fragment.xml @@ -37,46 +37,7 @@ android:layout_marginBottom="10dp" android:text="@string/call_outgoing" app:layout_constraintStart_toEndOf="@id/call_direction_icon" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toTopOf="@id/background"/> - - - - - - + app:layout_constraintTop_toTopOf="parent"/> + app:layout_constraintVertical_chainStyle="packed" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/call_direction_label" + app:layout_constraintBottom_toTopOf="@id/name"/> @@ -142,6 +105,7 @@ android:textColor="@color/white" android:textSize="14sp" app:layout_constraintTop_toBottomOf="@id/name" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" />