Started audio only layout for conference

This commit is contained in:
Sylvain Berfini 2024-02-01 10:32:48 +01:00
parent 784803336c
commit 1c24c805df
11 changed files with 329 additions and 14 deletions

View file

@ -140,6 +140,7 @@ dependencies {
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
implementation "androidx.window:window:1.2.0"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
def nav_version = "2.7.6"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"

View file

@ -65,13 +65,25 @@ class ConferenceActiveSpeakerFragment : GenericCallFragment() {
callViewModel.conferenceModel.conferenceLayout.observe(viewLifecycleOwner) {
when (it) {
ConferenceModel.GRID_LAYOUT -> {
Log.i("$TAG Conference layout changed to mosaic, navigating to Grid fragment")
Log.i(
"$TAG Conference layout changed to mosaic, navigating to matching fragment"
)
if (findNavController().currentDestination?.id == R.id.conferenceActiveSpeakerFragment) {
findNavController().navigate(
R.id.action_conferenceActiveSpeakerFragment_to_conferenceGridFragment
)
}
}
ConferenceModel.AUDIO_ONLY_LAYOUT -> {
Log.i(
"$TAG Conference layout changed to audio only, navigating to matching fragment"
)
if (findNavController().currentDestination?.id == R.id.conferenceActiveSpeakerFragment) {
findNavController().navigate(
R.id.action_conferenceActiveSpeakerFragment_to_conferenceAudioOnlyFragment
)
}
}
else -> {
}
}

View file

@ -0,0 +1,98 @@
/*
* 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.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.UiThread
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.CallConferenceAudioOnlyFragmentBinding
import org.linphone.ui.call.model.ConferenceModel
import org.linphone.ui.call.viewmodel.CurrentCallViewModel
@UiThread
class ConferenceAudioOnlyFragment : GenericCallFragment() {
companion object {
private const val TAG = "[Conference Audio Only Fragment]"
}
private lateinit var binding: CallConferenceAudioOnlyFragmentBinding
private lateinit var callViewModel: CurrentCallViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = CallConferenceAudioOnlyFragmentBinding.inflate(layoutInflater)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel
binding.conferenceViewModel = callViewModel.conferenceModel
callViewModel.conferenceModel.conferenceLayout.observe(viewLifecycleOwner) {
when (it) {
ConferenceModel.ACTIVE_SPEAKER_LAYOUT -> {
Log.i(
"$TAG Conference layout changed to active speaker, navigating to matching fragment"
)
if (findNavController().currentDestination?.id == R.id.conferenceAudioOnlyFragment) {
findNavController().navigate(
R.id.action_conferenceAudioOnlyFragment_to_conferenceActiveSpeakerFragment
)
}
}
ConferenceModel.GRID_LAYOUT -> {
Log.i(
"$TAG Conference layout changed to mosaic, navigating to matching fragment"
)
if (findNavController().currentDestination?.id == R.id.conferenceAudioOnlyFragment) {
findNavController().navigate(
R.id.action_conferenceAudioOnlyFragment_to_conferenceGridFragment
)
}
}
else -> {
}
}
}
}
override fun onResume() {
super.onResume()
Log.i("$TAG Making sure we are not in full-screen mode")
callViewModel.fullScreenMode.value = false
}
}

View file

@ -65,7 +65,7 @@ class ConferenceGridFragment : GenericCallFragment() {
when (it) {
ConferenceModel.ACTIVE_SPEAKER_LAYOUT -> {
Log.i(
"$TAG Conference layout changed to active speaker, navigating to Active Speaker fragment"
"$TAG Conference layout changed to active speaker, navigating to matching fragment"
)
if (findNavController().currentDestination?.id == R.id.conferenceGridFragment) {
findNavController().navigate(
@ -73,6 +73,16 @@ class ConferenceGridFragment : GenericCallFragment() {
)
}
}
ConferenceModel.AUDIO_ONLY_LAYOUT -> {
Log.i(
"$TAG Conference layout changed to audio only, navigating to matching fragment"
)
if (findNavController().currentDestination?.id == R.id.conferenceGridFragment) {
findNavController().navigate(
R.id.action_conferenceGridFragment_to_conferenceAudioOnlyFragment
)
}
}
else -> {
}
}

View file

@ -61,7 +61,7 @@
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="@dimen/call_main_actions_menu_margin"
app:layout_constraintTop_toBottomOf="@id/media_encryption"
app:layout_constraintTop_toBottomOf="@id/media_encryption_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
@ -80,7 +80,7 @@
app:layout_constraintEnd_toEndOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintBottom_toTopOf="@id/address"/>
app:layout_constraintBottom_toTopOf="@id/display_name"/>
<ImageView
android:id="@+id/trust_badge"
@ -91,17 +91,30 @@
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
android:id="@+id/display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@{viewModel.displayedName, default=`John Doe`}"
android:textSize="22sp"
android:textColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/avatar"
app:layout_constraintBottom_toTopOf="@id/address"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintTop_toBottomOf="@id/avatar"
app:layout_constraintTop_toBottomOf="@id/display_name"
app:layout_constraintBottom_toBottomOf="@id/background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
@ -181,26 +194,39 @@
android:visibility="@{viewModel.isPaused || viewModel.isPausedByRemote ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/separator"
app:layout_constraintEnd_toStartOf="@id/media_encryption"
app:layout_constraintTop_toTopOf="@id/name"/>
<ImageView
style="@style/default_text_style"
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"
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 &amp;&amp; !viewModel.pipMode &amp;&amp; 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" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/media_encryption"
android:id="@+id/media_encryption_label"
android:onClick="@{() -> viewModel.showMediaEncryptionStatisticsIfPossible()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginStart="5dp"
android:text="@{viewModel.isZrtpPq ? @string/call_post_quantum_zrtp_end_to_end_encrypted : @string/call_zrtp_end_to_end_encrypted, default=@string/call_post_quantum_zrtp_end_to_end_encrypted}"
android:textSize="12sp"
android:textColor="@color/blue_info_500"
android:maxLines="1"
android:ellipsize="end"
android:drawableStart="@{viewModel.isZrtpPq ? @drawable/atom : @drawable/lock_simple, default=@drawable/atom}"
android:drawablePadding="5dp"
android:drawableTint="@color/blue_info_500"
android:visibility="@{!viewModel.fullScreenMode &amp;&amp; !viewModel.pipMode &amp;&amp; viewModel.isMediaEncrypted ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintStart_toEndOf="@id/media_encryption_icon"
app:layout_constraintTop_toBottomOf="@id/name"/>
<ImageView

View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<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" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.call.model.ConferenceParticipantDeviceModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="@dimen/call_conference_audio_only_miniature_height"
android:padding="8dp"
app:layout_columnWeight="1"
app:layout_gravity="fill_horizontal">
<ImageView
android:id="@+id/participant_device_background"
android:layout_width="match_parent"
android:layout_height="0dp"
android:contentDescription="@null"
android:background="@drawable/shape_round_in_call_cell_gray_background"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<com.google.android.material.imageview.ShapeableImageView
style="@style/avatar_imageview"
android:id="@+id/avatar"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="10dp"
coilCallAvatar="@{model.avatarModel}"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintWidth_max="@dimen/avatar_list_cell_size"
app:layout_constraintHeight_max="@dimen/avatar_list_cell_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
<ImageView
android:id="@+id/muted"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:layout_marginEnd="10dp"
android:padding="2dp"
android:src="@drawable/microphone_slash"
android:background="@drawable/shape_circle_white_call_background"
android:visibility="@{model.isMuted ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_500"
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="@{model.name, default=`John Doe`}"
android:textColor="@color/white"
android:textSize="14sp"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintEnd_toStartOf="@id/muted"/>
<ImageView
android:id="@+id/speaking"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/shape_squircle_main2_200_call_border"
android:visibility="@{model.isSpeaking ? View.VISIBLE : View.GONE}" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<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" />
<import type="org.linphone.ui.call.model.ConferenceModel" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
<variable
name="conferenceViewModel"
type="org.linphone.ui.call.model.ConferenceModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_900">
<ScrollView
android:id="@+id/grid_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<androidx.gridlayout.widget.GridLayout
android:id="@+id/grid_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
entries="@{conferenceViewModel.participantDevices}"
layout="@{@layout/call_conference_audio_only_cell}"
app:columnCount="2"
app:orientation="horizontal" />
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -20,6 +20,7 @@
android:id="@+id/participant_device_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:background="@drawable/shape_round_in_call_cell_gray_background" />
<com.google.android.material.imageview.ShapeableImageView

View file

@ -16,7 +16,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/gray_900">
<org.linphone.ui.call.view.GridBoxLayout
android:id="@+id/grid_box_layout"

View file

@ -16,6 +16,12 @@
app:launchSingleTop="true"
app:popUpTo="@id/conferenceActiveSpeakerFragment"
app:popUpToInclusive="true" />
<action
android:id="@+id/action_conferenceGridFragment_to_conferenceAudioOnlyFragment"
app:destination="@id/conferenceAudioOnlyFragment"
app:launchSingleTop="true"
app:popUpTo="@id/conferenceAudioOnlyFragment"
app:popUpToInclusive="true" />
</fragment>
<fragment
@ -29,5 +35,29 @@
app:launchSingleTop="true"
app:popUpTo="@id/conferenceGridFragment"
app:popUpToInclusive="true" />
<action
android:id="@+id/action_conferenceActiveSpeakerFragment_to_conferenceAudioOnlyFragment"
app:destination="@id/conferenceAudioOnlyFragment"
app:launchSingleTop="true"
app:popUpTo="@id/conferenceAudioOnlyFragment"
app:popUpToInclusive="true" />
</fragment>
<fragment
android:id="@+id/conferenceAudioOnlyFragment"
android:name="org.linphone.ui.call.fragment.ConferenceAudioOnlyFragment"
android:label="ConferenceAudioOnlyFragment"
tools:layout="@layout/call_conference_audio_only_fragment">
<action
android:id="@+id/action_conferenceAudioOnlyFragment_to_conferenceActiveSpeakerFragment"
app:destination="@id/conferenceActiveSpeakerFragment"
app:launchSingleTop="true"
app:popUpTo="@id/conferenceActiveSpeakerFragment"
app:popUpToInclusive="true" />
<action
android:id="@+id/action_conferenceAudioOnlyFragment_to_conferenceGridFragment"
app:destination="@id/conferenceGridFragment"
app:launchSingleTop="true"
app:popUpTo="@id/conferenceGridFragment"
app:popUpToInclusive="true" />
</fragment>
</navigation>

View file

@ -52,6 +52,7 @@
<dimen name="call_button_icon_padding">15dp</dimen>
<dimen name="call_extra_button_top_margin">30dp</dimen>
<dimen name="call_conference_audio_only_miniature_height">100dp</dimen>
<dimen name="call_conference_active_speaker_miniature_size">120dp</dimen>
<dimen name="meeting_list_decoration_height">66dp</dimen>