Started conversation info fragment

This commit is contained in:
Sylvain Berfini 2023-10-16 15:11:16 +02:00
parent c076dcb2c7
commit a2355e3225
14 changed files with 905 additions and 12 deletions

View file

@ -161,10 +161,12 @@ class ConversationEventAdapter(
override fun areContentsTheSame(oldItem: EventLogModel, newItem: EventLogModel): Boolean {
return if (oldItem.isEvent && newItem.isEvent) {
true
} else {
} else if (!oldItem.isEvent && !newItem.isEvent) {
val oldModel = (newItem.model as ChatMessageModel)
val newModel = newItem.model
oldModel.statusIcon.value == newModel.statusIcon.value
} else {
false
}
}
}

View file

@ -168,6 +168,14 @@ class ConversationFragment : GenericFragment() {
emojisBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
}*/
}
binding.setGoToInfoClickListener {
val action = ConversationFragmentDirections.actionConversationFragmentToConversationInfoFragment(
localSipUri,
remoteSipUri
)
findNavController().navigate(action)
}
}
private fun showChatMessageLongPressMenu(chatMessageModel: ChatMessageModel) {

View file

@ -0,0 +1,118 @@
/*
* 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.main.chat.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.UiThread
import androidx.core.view.doOnPreDraw
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import org.linphone.core.tools.Log
import org.linphone.databinding.ChatInfoFragmentBinding
import org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel
import org.linphone.ui.main.fragment.GenericFragment
@UiThread
class ConversationInfoFragment : GenericFragment() {
companion object {
private const val TAG = "[Conversation Info Fragment]"
}
private lateinit var binding: ChatInfoFragmentBinding
private lateinit var viewModel: ConversationInfoViewModel
private val args: ConversationInfoFragmentArgs by navArgs()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = ChatInfoFragmentBinding.inflate(layoutInflater)
return binding.root
}
override fun goBack(): Boolean {
findNavController().popBackStack()
return true
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// This fragment is displayed in a SlidingPane "child" area
isSlidingPaneChild = true
super.onViewCreated(view, savedInstanceState)
binding.lifecycleOwner = viewLifecycleOwner
viewModel = ViewModelProvider(this)[ConversationInfoViewModel::class.java]
binding.viewModel = viewModel
val localSipUri = args.localSipUri
val remoteSipUri = args.remoteSipUri
Log.i(
"$TAG Looking up for conversation with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
)
viewModel.findChatRoom(localSipUri, remoteSipUri)
viewModel.chatRoomFoundEvent.observe(viewLifecycleOwner) {
it.consume { found ->
if (found) {
Log.i(
"$TAG Found matching chat room for local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
)
(view.parent as? ViewGroup)?.doOnPreDraw {
startPostponedEnterTransition()
}
} else {
(view.parent as? ViewGroup)?.doOnPreDraw {
Log.e("$TAG Failed to find chat room, going back")
goBack()
}
}
}
}
viewModel.groupLeftEvent.observe(viewLifecycleOwner) {
it.consume {
// TODO: show toast ?
Log.i("$TAG Group has been left, leaving conversation info...")
goBack()
}
}
viewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
it.consume {
// TODO: show toast ?
Log.i("$TAG History has been deleted, leaving conversation info...")
goBack()
}
}
binding.setBackClickListener {
goBack()
}
}
}

View file

@ -131,7 +131,7 @@ class ConversationModel @WorkerThread constructor(private val chatRoom: ChatRoom
val friend = coreContext.contactsManager.findContactByAddress(
participant.address
)
if (friend != null) {
if (friend != null && !friends.contains(friend)) {
friends.add(friend)
}
}
@ -146,7 +146,7 @@ class ConversationModel @WorkerThread constructor(private val chatRoom: ChatRoom
if (isGroup) {
val fakeFriend = coreContext.core.createFriend()
val model = ContactAvatarModel(fakeFriend)
model.addPicturesFromFriends(friends)
model.setPicturesFromFriends(friends)
avatarModel.postValue(model)
} else {
val friend = coreContext.contactsManager.findContactByAddress(address)

View file

@ -0,0 +1,27 @@
/*
* 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.main.chat.model
import org.linphone.core.Friend
import org.linphone.ui.main.contacts.model.ContactAvatarModel
class ParticipantModel(friend: Friend, val isMyselfAdmin: Boolean, val isParticipantAdmin: Boolean) : ContactAvatarModel(
friend
)

View file

@ -0,0 +1,263 @@
/*
* 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.main.chat.viewmodel
import androidx.annotation.UiThread
import androidx.annotation.WorkerThread
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.Address
import org.linphone.core.ChatRoom
import org.linphone.core.ChatRoomListenerStub
import org.linphone.core.EventLog
import org.linphone.core.Factory
import org.linphone.core.Friend
import org.linphone.core.tools.Log
import org.linphone.ui.main.chat.model.ParticipantModel
import org.linphone.ui.main.contacts.model.ContactAvatarModel
import org.linphone.utils.Event
import org.linphone.utils.LinphoneUtils
class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
companion object {
private const val TAG = "[Conversation Info ViewModel]"
}
val avatarModel = MutableLiveData<ContactAvatarModel>()
val participants = MutableLiveData<ArrayList<ParticipantModel>>()
val isGroup = MutableLiveData<Boolean>()
val subject = MutableLiveData<String>()
val isReadOnly = MutableLiveData<Boolean>()
val isMyselfAdmin = MutableLiveData<Boolean>()
val isMuted = MutableLiveData<Boolean>()
val expandParticipants = MutableLiveData<Boolean>()
val chatRoomFoundEvent = MutableLiveData<Event<Boolean>>()
val groupLeftEvent = MutableLiveData<Event<Boolean>>()
val historyDeletedEvent = MutableLiveData<Event<Boolean>>()
private lateinit var chatRoom: ChatRoom
private val avatarsMap = hashMapOf<String, ParticipantModel>()
private val chatRoomListener = object : ChatRoomListenerStub() {
@WorkerThread
override fun onParticipantAdded(chatRoom: ChatRoom, eventLog: EventLog) {
computeParticipantsList(isGroup.value == true)
}
@WorkerThread
override fun onParticipantRemoved(chatRoom: ChatRoom, eventLog: EventLog) {
computeParticipantsList(isGroup.value == true)
}
@WorkerThread
override fun onParticipantAdminStatusChanged(chatRoom: ChatRoom, eventLog: EventLog) {
computeParticipantsList(isGroup.value == true)
}
@WorkerThread
override fun onSubjectChanged(chatRoom: ChatRoom, eventLog: EventLog) {
subject.postValue(chatRoom.subject)
}
}
init {
expandParticipants.value = true
}
override fun onCleared() {
super.onCleared()
coreContext.postOnCoreThread {
if (::chatRoom.isInitialized) {
chatRoom.removeListener(chatRoomListener)
}
avatarModel.value?.destroy()
avatarsMap.values.forEach(ParticipantModel::destroy)
}
}
@UiThread
fun findChatRoom(localSipUri: String, remoteSipUri: String) {
coreContext.postOnCoreThread { core ->
Log.i(
"$TAG Looking for chat room with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
)
val localAddress = Factory.instance().createAddress(localSipUri)
val remoteAddress = Factory.instance().createAddress(remoteSipUri)
if (localAddress != null && remoteAddress != null) {
val found = core.searchChatRoom(
null,
localAddress,
remoteAddress,
arrayOfNulls(
0
)
)
if (found != null) {
chatRoom = found
chatRoom.addListener(chatRoomListener)
configureChatRoom()
chatRoomFoundEvent.postValue(Event(true))
} else {
Log.e("$TAG Failed to find chat room given local & remote addresses!")
chatRoomFoundEvent.postValue(Event(false))
}
} else {
Log.e("$TAG Failed to parse local or remote SIP URI as Address!")
chatRoomFoundEvent.postValue(Event(false))
}
}
}
@UiThread
fun leaveGroup() {
coreContext.postOnCoreThread {
if (::chatRoom.isInitialized) {
Log.i("$TAG Leaving chat room [${LinphoneUtils.getChatRoomId(chatRoom)}]")
chatRoom.leave()
}
groupLeftEvent.postValue(Event(true))
}
}
@UiThread
fun deleteHistory() {
coreContext.postOnCoreThread {
// TODO: confirmation dialog ?
if (::chatRoom.isInitialized) {
Log.i("$TAG Cleaning chat room [${LinphoneUtils.getChatRoomId(chatRoom)}] history")
chatRoom.deleteHistory()
}
historyDeletedEvent.postValue(Event(true))
}
}
@UiThread
fun toggleMute() {
coreContext.postOnCoreThread {
chatRoom.muted = !chatRoom.muted
isMuted.postValue(chatRoom.muted)
}
}
@UiThread
fun toggleParticipantsExpand() {
expandParticipants.value = expandParticipants.value == false
}
@WorkerThread
private fun configureChatRoom() {
isMuted.postValue(chatRoom.muted)
isMyselfAdmin.postValue(chatRoom.me?.isAdmin)
val isGroupChatRoom = !chatRoom.hasCapability(ChatRoom.Capabilities.OneToOne.toInt()) &&
chatRoom.hasCapability(ChatRoom.Capabilities.Conference.toInt())
isGroup.postValue(isGroupChatRoom)
val empty = chatRoom.hasCapability(ChatRoom.Capabilities.Conference.toInt()) && chatRoom.participants.isEmpty()
val readOnly = chatRoom.isReadOnly || empty
isReadOnly.postValue(readOnly)
if (readOnly) {
Log.w("$TAG Chat room with subject [${chatRoom.subject}] is read only!")
}
subject.postValue(chatRoom.subject)
computeParticipantsList(isGroupChatRoom)
}
@WorkerThread
private fun computeParticipantsList(isGroupChatRoom: Boolean) {
avatarModel.value?.destroy()
avatarsMap.values.forEach(ParticipantModel::destroy)
val friends = arrayListOf<Friend>()
val participantsList = arrayListOf<ParticipantModel>()
if (chatRoom.hasCapability(ChatRoom.Capabilities.Basic.toInt())) {
val model = getParticipantModelForAddress(chatRoom.peerAddress, false)
friends.add(model.friend)
participantsList.add(model)
} else {
for (participant in chatRoom.participants) {
val model = getParticipantModelForAddress(
participant.address,
if (isGroup.value == true) participant.isAdmin else false
)
friends.add(model.friend)
participantsList.add(model)
}
}
val avatar = if (isGroupChatRoom) {
val fakeFriend = coreContext.core.createFriend()
ContactAvatarModel(fakeFriend)
} else {
participantsList.first()
}
avatar.setPicturesFromFriends(friends)
avatarModel.postValue(avatar)
participants.postValue(participantsList)
}
@WorkerThread
private fun getParticipantModelForAddress(address: Address?, isAdmin: Boolean): ParticipantModel {
Log.i("$TAG Looking for participant model with address [${address?.asStringUriOnly()}]")
if (address == null) {
val fakeFriend = coreContext.core.createFriend()
return ParticipantModel(fakeFriend, isMyselfAdmin.value == true, false)
}
val clone = address.clone()
clone.clean()
val key = clone.asStringUriOnly()
val foundInMap = if (avatarsMap.keys.contains(key)) avatarsMap[key] else null
if (foundInMap != null) return foundInMap
val friend = coreContext.contactsManager.findContactByAddress(clone)
val avatar = if (friend != null) {
ParticipantModel(friend, isMyselfAdmin.value == true, isAdmin)
} else {
val fakeFriend = coreContext.core.createFriend()
fakeFriend.address = clone
ParticipantModel(fakeFriend, isMyselfAdmin.value == true, isAdmin)
}
avatarsMap[key] = avatar
return avatar
}
}

View file

@ -133,6 +133,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
coreContext.postOnCoreThread {
chatRoom.removeListener(chatRoomListener)
avatarModel.value?.destroy()
events.value.orEmpty().forEach(EventLogModel::destroy)
avatarsMap.values.forEach(ContactAvatarModel::destroy)
}
@ -163,11 +164,11 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
configureChatRoom()
chatRoomFoundEvent.postValue(Event(true))
} else {
Log.e("Failed to find chat room given local & remote addresses!")
Log.e("$TAG Failed to find chat room given local & remote addresses!")
chatRoomFoundEvent.postValue(Event(false))
}
} else {
Log.e("Failed to parse local or remote SIP URI as Address!")
Log.e("$TAG Failed to parse local or remote SIP URI as Address!")
chatRoomFoundEvent.postValue(Event(false))
}
}
@ -233,7 +234,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
} else {
for (participant in chatRoom.participants) {
val friend = coreContext.contactsManager.findContactByAddress(participant.address)
if (friend != null) {
if (friend != null && !friends.contains(friend)) {
friends.add(friend)
}
}
@ -248,7 +249,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
} else {
getAvatarModelForAddress(address)
}
avatar.addPicturesFromFriends(friends)
avatar.setPicturesFromFriends(friends)
avatarModel.postValue(avatar)
val history = chatRoom.getHistoryEvents(0)
@ -330,7 +331,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
@WorkerThread
private fun getAvatarModelForAddress(address: Address?): ContactAvatarModel {
Log.i("Looking for avatar model with address [${address?.asStringUriOnly()}]")
Log.i("$TAG Looking for avatar model with address [${address?.asStringUriOnly()}]")
if (address == null) {
val fakeFriend = coreContext.core.createFriend()
return ContactAvatarModel(fakeFriend)

View file

@ -36,7 +36,7 @@ import org.linphone.ui.main.model.isInSecureMode
import org.linphone.utils.AppUtils
import org.linphone.utils.TimestampUtils
class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : AbstractAvatarModel() {
open class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : AbstractAvatarModel() {
companion object {
private const val TAG = "[Contact Avatar Model]"
}
@ -83,10 +83,9 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : Abstrac
}
@WorkerThread
fun addPicturesFromFriends(friends: List<Friend>) {
fun setPicturesFromFriends(friends: List<Friend>) {
if (friends.isNotEmpty()) {
val list = arrayListOf<String>()
list.addAll(images.value.orEmpty())
for (friend in friends) {
list.add(getAvatarUri(friend).toString())
}

View file

@ -350,7 +350,7 @@ private suspend fun loadContactPictureWithCoil(
}
)
}
} else if (count > 1) {
} else {
val w = if (size > 0) {
AppUtils.getDimension(size).toInt()
} else {
@ -409,6 +409,14 @@ private suspend fun loadContactPictureWithCoil(
imageView.load(bitmap)
}
} else {
imageView.load(
ResourcesCompat.getDrawable(
context.resources,
R.drawable.user_circle,
context.theme
)
)
}
}
}

View file

@ -9,6 +9,15 @@
<variable
name="backClickListener"
type="View.OnClickListener" />
<variable
name="startCallClickListener"
type="View.OnClickListener" />
<variable
name="startVideoCallClickListener"
type="View.OnClickListener" />
<variable
name="goToInfoClickListener"
type="View.OnClickListener" />
<variable
name="openEmojiPickerClickListener"
type="View.OnClickListener" />
@ -82,6 +91,7 @@
<ImageView
android:id="@+id/info"
android:onClick="@{goToInfoClickListener}"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="15dp"
@ -93,6 +103,7 @@
<ImageView
android:id="@+id/video_call"
android:onClick="@{startVideoCallClickListener}"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="15dp"
@ -104,6 +115,7 @@
<ImageView
android:id="@+id/call"
android:onClick="@{startCallClickListener}"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="15dp"

View file

@ -0,0 +1,326 @@
<?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.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
<variable
name="scheduleMeetingClickListener"
type="View.OnClickListener" />
<variable
name="addParticipantsClickListener"
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:padding="15dp"
android:onClick="@{backClickListener}"
android:src="@drawable/caret_left"
app:tint="@color/orange_main_500"
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/invisible_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/main_page_title_style"
android:id="@+id/invisible_title"
android:visibility="invisible"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="parent"/>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
android:background="@color/gray_100"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/invisible_title"
app:layout_constraintBottom_toBottomOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.imageview.ShapeableImageView
style="@style/avatar_imageview"
android:id="@+id/avatar"
android:layout_width="@dimen/avatar_big_size"
android:layout_height="@dimen/avatar_big_size"
android:layout_marginTop="8dp"
coilBigAvatar="@{viewModel.avatarModel}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginStart="16dp"
android:text="@{viewModel.isGroup ? viewModel.subject : viewModel.avatarModel.name, default=`John Doe`}"
android:textSize="14sp"
android:textColor="@color/gray_main2_700"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@id/avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/edit_subject" />
<ImageView
android:id="@+id/edit_subject"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:src="@drawable/pencil_simple"
android:visibility="@{!viewModel.isGroup || viewModel.isReadOnly || !viewModel.isMyselfAdmin ? View.GONE : View.VISIBLE}"
app:layout_constraintTop_toTopOf="@id/title"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintStart_toEndOf="@id/title"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/mute"
android:onClick="@{() -> viewModel.toggleMute()}"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginTop="40dp"
android:background="@drawable/circle_light_blue_button_background"
android:padding="16dp"
android:src="@{viewModel.isMuted ? @drawable/bell_simple : @drawable/bell_simple_slash, default=@drawable/bell_simple_slash}"
app:tint="@color/gray_main2_500"
app:layout_constraintEnd_toStartOf="@id/meeting"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/mute_label"
android:onClick="@{() -> viewModel.toggleMute()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@{viewModel.isMuted ? @string/conversation_action_unmute : @string/conversation_action_mute, default=@string/conversation_action_mute}"
android:textSize="14sp"
app:layout_constraintTop_toBottomOf="@id/mute"
app:layout_constraintStart_toStartOf="@id/mute"
app:layout_constraintEnd_toEndOf="@id/mute"/>
<ImageView
android:id="@+id/meeting"
android:onClick="@{scheduleMeetingClickListener}"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginTop="40dp"
android:background="@drawable/circle_light_blue_button_background"
android:padding="16dp"
android:src="@drawable/users_three"
app:tint="@color/gray_main2_500"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/mute"
app:layout_constraintTop_toBottomOf="@id/title" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/meeting_label"
android:onClick="@{scheduleMeetingClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/meeting_schedule_meeting_label"
android:textSize="14sp"
app:layout_constraintTop_toBottomOf="@id/meeting"
app:layout_constraintStart_toStartOf="@id/meeting"
app:layout_constraintEnd_toEndOf="@id/meeting"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:onClick="@{() -> viewModel.toggleParticipantsExpand()}"
android:id="@+id/participants_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginStart="26dp"
android:layout_marginEnd="26dp"
android:layout_marginTop="32dp"
android:text="@string/conversation_info_participants_list_title"
android:drawableEnd="@{viewModel.expandParticipants ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
android:drawableTint="@color/gray_main2_600"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/mute_label"/>
<ImageView
android:id="@+id/participants_background"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:src="@drawable/shape_squircle_white_background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/participants"
app:layout_constraintBottom_toBottomOf="@id/participants_anchor" />
<LinearLayout
android:id="@+id/participants"
android:visibility="@{viewModel.expandParticipants ? View.VISIBLE : View.GONE}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:padding="10dp"
entries="@{viewModel.participants}"
layout="@{@layout/chat_participant_list_cell}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/participants_label"
app:layout_constraintBottom_toTopOf="@id/add_participants"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/tertiary_button_label_style"
android:id="@+id/add_participants"
android:onClick="@{addParticipantsClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/tertiary_button_background"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:gravity="center"
android:text="@string/conversation_info_add_participants_label"
android:maxLines="1"
android:ellipsize="end"
android:drawableStart="@drawable/plus_circle"
android:drawablePadding="8dp"
android:visibility="@{!viewModel.expandParticipants || !viewModel.isMyselfAdmin || viewModel.isGroup || viewModel.isReadOnly ? View.GONE : View.VISIBLE}"
app:drawableTint="@color/orange_main_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/participants"/>
<View
android:id="@+id/participants_anchor"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:visibility="@{!viewModel.expandParticipants || !viewModel.isMyselfAdmin || viewModel.isGroup || viewModel.isReadOnly ? View.GONE : View.VISIBLE}"
app:layout_constraintTop_toBottomOf="@id/add_participants"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:id="@+id/actions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginStart="26dp"
android:layout_marginEnd="26dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:text="@string/contact_details_actions_title"
app:layout_constraintVertical_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/participants_background"
app:layout_constraintBottom_toTopOf="@id/actions_background"/>
<ImageView
android:id="@+id/actions_background"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:src="@drawable/shape_squircle_white_background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/actions"
app:layout_constraintBottom_toBottomOf="@id/action_delete" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_action_label_style"
android:id="@+id/action_leave_group"
android:onClick="@{() -> viewModel.leaveGroup()}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/conversation_action_leave_group"
android:drawableStart="@drawable/sign_out"
android:background="@drawable/action_background"
android:visibility="@{viewModel.isGroup &amp;&amp; !viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toTopOf="@id/actions_background"
app:layout_constraintStart_toStartOf="@id/actions_background"
app:layout_constraintEnd_toEndOf="@id/actions_background"/>
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/gray_main2_200"
app:layout_constraintStart_toStartOf="@id/action_leave_group"
app:layout_constraintEnd_toEndOf="@id/action_leave_group"
app:layout_constraintTop_toBottomOf="@+id/action_leave_group"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/context_menu_danger_action_label_style"
android:id="@+id/action_delete"
android:onClick="@{() -> viewModel.deleteHistory()}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/action_background"
android:text="@string/conversation_info_delete_history_action"
android:drawableStart="@drawable/trash_simple"
app:layout_constraintVertical_bias="0"
app:layout_constraintTop_toBottomOf="@id/action_leave_group"
app:layout_constraintBottom_toTopOf="@id/anchor"
app:layout_constraintStart_toStartOf="@id/actions_background"
app:layout_constraintEnd_toEndOf="@id/actions_background"/>
<View
android:id="@+id/anchor"
android:layout_width="wrap_content"
android:layout_height="@dimen/screen_bottom_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -0,0 +1,104 @@
<?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.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.chat.model.ParticipantModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/primary_cell_background"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
<com.google.android.material.imageview.ShapeableImageView
style="@style/avatar_imageview"
android:id="@+id/avatar"
android:layout_width="@dimen/avatar_list_cell_size"
android:layout_height="@dimen/avatar_list_cell_size"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
coilAvatar="@{model}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/presence_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:layout_marginEnd="@dimen/avatar_presence_badge_end_margin"
android:background="@drawable/led_background"
android:padding="@dimen/avatar_presence_badge_padding"
app:presenceIcon="@{model.presenceStatus}"
android:visibility="@{model.presenceStatus == ConsolidatedPresence.Offline ? View.GONE : View.VISIBLE}"
app:layout_constraintEnd_toEndOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
<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.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.trust == SecurityLevel.Safe || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@{model.name, default=`John Doe`}"
android:textSize="14sp"
android:layout_marginStart="10dp"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/participant_menu"
app:layout_constraintBottom_toTopOf="@id/admin_label"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
android:id="@+id/admin_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/conversation_info_participant_is_admin_label"
android:textColor="@color/gray_main2_500"
android:textSize="12sp"
android:visibility="@{model.isParticipantAdmin ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintStart_toStartOf="@id/name"
app:layout_constraintEnd_toEndOf="@id/name"
app:layout_constraintBottom_toBottomOf="parent" />
<ImageView
android:id="@+id/participant_menu"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:src="@drawable/dots_three_vertical"
android:visibility="@{model.isMyselfAdmin ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginEnd="10dp"
android:background="@color/gray_main2_200"
app:layout_constraintStart_toStartOf="@id/name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -22,6 +22,13 @@
<argument
android:name="remoteSipUri"
app:argType="string" />
<action
android:id="@+id/action_conversationFragment_to_conversationInfoFragment"
app:destination="@id/conversationInfoFragment"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
</fragment>
<action
@ -29,4 +36,17 @@
app:destination="@id/conversationFragment"
app:launchSingleTop="true" />
<fragment
android:id="@+id/conversationInfoFragment"
android:name="org.linphone.ui.main.chat.fragment.ConversationInfoFragment"
android:label="ConversationInfoFragment"
tools:layout="@layout/chat_info_fragment">
<argument
android:name="localSipUri"
app:argType="string" />
<argument
android:name="remoteSipUri"
app:argType="string" />
</fragment>
</navigation>

View file

@ -341,6 +341,11 @@
<item quantity="other">%s are composing…</item>
</plurals>
<string name="conversation_info_participants_list_title">Group members</string>
<string name="conversation_info_add_participants_label">Add participants</string>
<string name="conversation_info_participant_is_admin_label">Admin</string>
<string name="conversation_info_delete_history_action">Delete history</string>
<string name="meetings_list_empty">No meeting for the moment…</string>
<string name="meeting_schedule_title">New meeting</string>
<string name="meeting_schedule_meeting_label">Meeting</string>