mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Hide active speaker miniature + fix display name missing + added missing mute indicator + added avatar if not sending video
This commit is contained in:
parent
bd2936b05e
commit
d32c6f70a1
5 changed files with 60 additions and 13 deletions
|
|
@ -53,7 +53,7 @@ class ConferenceModel {
|
|||
|
||||
val participantsLabel = MutableLiveData<String>()
|
||||
|
||||
val activeSpeakerName = MutableLiveData<String>()
|
||||
val activeSpeaker = MutableLiveData<ConferenceParticipantDeviceModel>()
|
||||
|
||||
val isCurrentCallInConference = MutableLiveData<Boolean>()
|
||||
|
||||
|
|
@ -87,16 +87,20 @@ class ConferenceModel {
|
|||
conference: Conference,
|
||||
participantDevice: ParticipantDevice
|
||||
) {
|
||||
activeSpeaker.value?.isActiveSpeaker?.postValue(false)
|
||||
|
||||
val found = participantDevices.value.orEmpty().find {
|
||||
it.device == participantDevice
|
||||
}
|
||||
if (found != null) {
|
||||
val name = found.avatarModel.contactName ?: participantDevice.name ?: participantDevice.address.username
|
||||
Log.i("$TAG Newly active speaker participant is [$name]")
|
||||
activeSpeakerName.postValue(name.orEmpty())
|
||||
Log.i("$TAG Newly active speaker participant is [${found.name}]")
|
||||
found.isActiveSpeaker.postValue(true)
|
||||
activeSpeaker.postValue(found)
|
||||
} else {
|
||||
Log.i("$TAG Failed to find actively speaking participant...")
|
||||
activeSpeakerName.postValue(participantDevice.name)
|
||||
val model = ConferenceParticipantDeviceModel(participantDevice)
|
||||
model.isActiveSpeaker.postValue(true)
|
||||
activeSpeaker.postValue(model)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -299,10 +303,10 @@ class ConferenceModel {
|
|||
val model = ConferenceParticipantDeviceModel(device)
|
||||
devicesList.add(model)
|
||||
|
||||
if (device.isSpeaking) {
|
||||
val name = model.avatarModel.contactName ?: device.name ?: device.address.username
|
||||
Log.i("$TAG Using participant is [$name] as current active speaker")
|
||||
activeSpeakerName.postValue(name.orEmpty())
|
||||
if (device == conference.activeSpeakerParticipantDevice) {
|
||||
Log.i("$TAG Using participant is [${model.name}] as current active speaker")
|
||||
model.isActiveSpeaker.postValue(true)
|
||||
activeSpeaker.postValue(model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.linphone.core.ParticipantDevice
|
|||
import org.linphone.core.ParticipantDeviceListenerStub
|
||||
import org.linphone.core.StreamType
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.utils.LinphoneUtils
|
||||
|
||||
class ConferenceParticipantDeviceModel @WorkerThread constructor(
|
||||
val device: ParticipantDevice,
|
||||
|
|
@ -40,10 +41,16 @@ class ConferenceParticipantDeviceModel @WorkerThread constructor(
|
|||
|
||||
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(device.address)
|
||||
|
||||
val name = avatarModel.contactName ?: device.name ?: LinphoneUtils.getDisplayName(
|
||||
device.address
|
||||
)
|
||||
|
||||
val isMuted = MutableLiveData<Boolean>()
|
||||
|
||||
val isSpeaking = MutableLiveData<Boolean>()
|
||||
|
||||
val isActiveSpeaker = MutableLiveData<Boolean>()
|
||||
|
||||
val isVideoAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val isSendingVideo = MutableLiveData<Boolean>()
|
||||
|
|
@ -119,6 +126,7 @@ class ConferenceParticipantDeviceModel @WorkerThread constructor(
|
|||
|
||||
isMuted.postValue(device.isMuted)
|
||||
isSpeaking.postValue(device.isSpeaking)
|
||||
isActiveSpeaker.postValue(false)
|
||||
Log.i(
|
||||
"$TAG Participant [${device.address.asStringUriOnly()}] is in state [${device.state}]"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/call_conference_active_speaker_miniature_size"
|
||||
android:layout_height="@dimen/call_conference_active_speaker_miniature_size"
|
||||
android:visibility="@{model.isActiveSpeaker ? View.GONE : View.VISIBLE}"
|
||||
android:padding="2dp">
|
||||
|
||||
<ImageView
|
||||
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
|
||||
|
|
@ -79,7 +81,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@{model.avatarModel.name, default=`John Doe`}"
|
||||
android:text="@{model.name, default=`John Doe`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
|
||||
<import type="org.linphone.ui.call.model.ConferenceModel" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
|
|
@ -16,13 +17,32 @@
|
|||
<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">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
coilCallAvatar="@{conferenceViewModel.activeSpeaker.avatarModel}"
|
||||
android:visibility="@{conferenceViewModel.activeSpeaker.isSendingVideo ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintWidth_max="@dimen/avatar_in_call_size"
|
||||
app:layout_constraintHeight_max="@dimen/avatar_in_call_size"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<org.linphone.ui.call.view.RoundCornersTextureView
|
||||
android:id="@+id/active_speaker_surface"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{() -> viewModel.toggleFullScreen()}"
|
||||
android:visibility="@{conferenceViewModel.activeSpeaker.isSendingVideo ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -35,12 +55,25 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@{conferenceViewModel.activeSpeakerName, default=`John Doe`}"
|
||||
android:text="@{conferenceViewModel.activeSpeaker.name, default=`John Doe`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/active_speaker_miniatures_layout"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/muted"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/microphone_slash"
|
||||
android:background="@drawable/shape_circle_white_call_background"
|
||||
android:visibility="@{conferenceViewModel.activeSpeaker.isMuted ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/active_speaker_miniatures_layout"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@{model.avatarModel.name, default=`John Doe`}"
|
||||
android:text="@{model.name, default=`John Doe`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue