Show organizer in conference history details

This commit is contained in:
Sylvain Berfini 2022-03-28 17:04:02 +02:00
parent f4c89fbb2c
commit 0aca41b927
6 changed files with 83 additions and 44 deletions

View file

@ -25,7 +25,8 @@ import org.linphone.utils.LinphoneUtils
class ConferenceSchedulingParticipantData( class ConferenceSchedulingParticipantData(
private val sipAddress: Address, private val sipAddress: Address,
val showLimeBadge: Boolean val showLimeBadge: Boolean = false,
val showDivider: Boolean = true
) : ) :
GenericContactData(sipAddress) { GenericContactData(sipAddress) {
val sipUri: String get() = LinphoneUtils.getDisplayableAddress(sipAddress) val sipUri: String get() = LinphoneUtils.getDisplayableAddress(sipAddress)

View file

@ -116,6 +116,7 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
val conferenceSubject = callLog.conferenceInfo?.subject val conferenceSubject = callLog.conferenceInfo?.subject
val conferenceParticipantsData = MutableLiveData<ArrayList<ConferenceSchedulingParticipantData>>() val conferenceParticipantsData = MutableLiveData<ArrayList<ConferenceSchedulingParticipantData>>()
val organizerParticipantData = MutableLiveData<ConferenceSchedulingParticipantData>()
val conferenceTime = MutableLiveData<String>() val conferenceTime = MutableLiveData<String>()
val conferenceDate = MutableLiveData<String>() val conferenceDate = MutableLiveData<String>()
@ -152,9 +153,14 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
hideYear = false hideYear = false
) )
} }
val organizer = conferenceInfo.organizer
if (organizer != null) {
organizerParticipantData.value =
ConferenceSchedulingParticipantData(organizer, showLimeBadge = false, showDivider = false)
}
val list = arrayListOf<ConferenceSchedulingParticipantData>() val list = arrayListOf<ConferenceSchedulingParticipantData>()
for (participant in conferenceInfo.participants) { for (participant in conferenceInfo.participants) {
list.add(ConferenceSchedulingParticipantData(participant, false)) list.add(ConferenceSchedulingParticipantData(participant, showLimeBadge = false, showDivider = true))
} }
conferenceParticipantsData.value = list conferenceParticipantsData.value = list
} }
@ -169,6 +175,7 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
fun destroy() { fun destroy() {
if (!isRelated) { if (!isRelated) {
relatedCallLogs.value.orEmpty().forEach(CallLogViewModel::destroy) relatedCallLogs.value.orEmpty().forEach(CallLogViewModel::destroy)
organizerParticipantData.value?.destroy()
conferenceParticipantsData.value.orEmpty() conferenceParticipantsData.value.orEmpty()
.forEach(ConferenceSchedulingParticipantData::destroy) .forEach(ConferenceSchedulingParticipantData::destroy)
} }

View file

@ -107,6 +107,7 @@ class ConferenceParticipantDeviceData(
activeSpeaker.value = false activeSpeaker.value = false
micMuted.value = participantDevice.isMuted micMuted.value = participantDevice.isMuted
videoAvailable.value = participantDevice.getStreamAvailability(StreamType.Video) videoAvailable.value = participantDevice.getStreamAvailability(StreamType.Video)
val videoCapability = participantDevice.getStreamCapability(StreamType.Video) val videoCapability = participantDevice.getStreamCapability(StreamType.Video)
videoSendReceive.value = videoCapability == MediaDirection.SendRecv videoSendReceive.value = videoCapability == MediaDirection.SendRecv
@ -120,7 +121,7 @@ class ConferenceParticipantDeviceData(
videoEnabled.value = isVideoAvailableAndSendReceive() videoEnabled.value = isVideoAvailableAndSendReceive()
} }
Log.i("[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}], is in conf? ${isInConference.value}, is video available? ${videoAvailable.value} ($videoCapability)") Log.i("[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}], is in conf? ${isInConference.value}, is video available? ${videoAvailable.value} ($videoCapability), is mic muted? ${micMuted.value}")
} }
override fun destroy() { override fun destroy() {

View file

@ -4,10 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data> <data>
<import type="android.view.View" /> <import type="android.view.View" />
<variable <variable
name="data" name="data"
type="org.linphone.activities.main.conference.data.ConferenceSchedulingParticipantData" /> type="org.linphone.activities.main.conference.data.ConferenceSchedulingParticipantData" />
</data> </data>
<RelativeLayout <RelativeLayout
@ -18,17 +21,17 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"> android:layout_marginRight="5dp"
android:orientation="horizontal">
<org.linphone.contact.ContactAvatarView <org.linphone.contact.ContactAvatarView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
tools:layout="@layout/contact_avatar" app:data="@{data}"
app:showLimeCapability="@{data.showLimeBadge}" app:showLimeCapability="@{data.showLimeBadge}"
app:data="@{data}"/> tools:layout="@layout/contact_avatar" />
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
@ -38,21 +41,21 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:text="@{data.contact.fullName ?? data.displayName}"
style="@style/contact_name_list_cell_font" style="@style/contact_name_list_cell_font"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="top|left" android:gravity="top|left"
android:lines="1" /> android:lines="1"
android:text="@{data.contact.fullName ?? data.displayName}" />
<TextView <TextView
android:text="@{data.sipUri}"
style="@style/conference_scheduling_participant_sip_uri_font" style="@style/conference_scheduling_participant_sip_uri_font"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:gravity="bottom|left" android:gravity="bottom|left"
android:lines="1" /> android:lines="1"
android:text="@{data.sipUri}" />
</LinearLayout> </LinearLayout>
@ -61,8 +64,9 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="?attr/dividerColor" android:background="?attr/dividerColor"
android:layout_alignParentBottom="true"/> android:visibility="@{data.showDivider ? View.VISIBLE : View.GONE}" />
</RelativeLayout> </RelativeLayout>

View file

@ -3,19 +3,25 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data> <data>
<import type="android.view.View" /> <import type="android.view.View" />
<variable <variable
name="backClickListener" name="backClickListener"
type="android.view.View.OnClickListener" /> type="android.view.View.OnClickListener" />
<variable <variable
name="newContactClickListener" name="newContactClickListener"
type="android.view.View.OnClickListener" /> type="android.view.View.OnClickListener" />
<variable <variable
name="contactClickListener" name="contactClickListener"
type="android.view.View.OnClickListener" /> type="android.view.View.OnClickListener" />
<variable <variable
name="viewModel" name="viewModel"
type="org.linphone.activities.main.history.viewmodels.CallLogViewModel" /> type="org.linphone.activities.main.history.viewmodels.CallLogViewModel" />
<variable <variable
name="sharedMainViewModel" name="sharedMainViewModel"
type="org.linphone.activities.main.viewmodels.SharedMainViewModel" /> type="org.linphone.activities.main.viewmodels.SharedMainViewModel" />
@ -35,22 +41,22 @@
<ImageView <ImageView
android:id="@+id/back" android:id="@+id/back"
android:onClick="@{backClickListener}"
android:visibility="@{sharedMainViewModel.isSlidingPaneSlideable ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/content_description_go_back"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.2" android:layout_weight="0.2"
android:contentDescription="@string/content_description_go_back"
android:onClick="@{backClickListener}"
android:padding="18dp" android:padding="18dp"
android:src="@drawable/back" /> android:src="@drawable/back"
android:visibility="@{sharedMainViewModel.isSlidingPaneSlideable ? View.VISIBLE : View.GONE}" />
<TextView <TextView
style="@style/calls_list_header_font"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="0.8" android:layout_weight="0.8"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginLeft="5dp"
style="@style/calls_list_header_font"
android:text="@{viewModel.conferenceSubject, default=`Conference subject`}" /> android:text="@{viewModel.conferenceSubject, default=`Conference subject`}" />
</LinearLayout> </LinearLayout>
@ -66,30 +72,30 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"> android:layout_marginEnd="10dp"
android:orientation="horizontal">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp" android:layout_margin="5dp"
android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
style="@style/conference_scheduling_font"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/conference_scheduling_font"
android:text="@string/conference_schedule_date" /> android:text="@string/conference_schedule_date" />
<TextView <TextView
style="@style/conference_scheduling_font"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
style="@style/conference_scheduling_font"
android:background="?attr/voipFormDisabledFieldBackgroundColor" android:background="?attr/voipFormDisabledFieldBackgroundColor"
android:padding="10dp"
android:text="@{viewModel.conferenceDate}" /> android:text="@{viewModel.conferenceDate}" />
</LinearLayout> </LinearLayout>
@ -97,23 +103,23 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp" android:layout_margin="5dp"
android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
style="@style/conference_scheduling_font"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/conference_scheduling_font"
android:text="@string/conference_schedule_time" /> android:text="@string/conference_schedule_time" />
<TextView <TextView
style="@style/conference_scheduling_font"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
style="@style/conference_scheduling_font"
android:background="?attr/voipFormDisabledFieldBackgroundColor" android:background="?attr/voipFormDisabledFieldBackgroundColor"
android:padding="10dp"
android:text="@{viewModel.conferenceTime}" /> android:text="@{viewModel.conferenceTime}" />
</LinearLayout> </LinearLayout>
@ -127,11 +133,30 @@
android:background="?attr/voipFormBackgroundColor"> android:background="?attr/voipFormBackgroundColor">
<TextView <TextView
style="@style/calls_list_header_font"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:padding="5dp"
android:text="@string/conference_organizer" />
</LinearLayout>
<include
layout="@layout/conference_scheduling_participant_cell"
app:data="@{viewModel.organizerParticipantData}" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/voipFormBackgroundColor">
<TextView
style="@style/calls_list_header_font" style="@style/calls_list_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:padding="5dp"
android:text="@string/conference_schedule_participants_list" /> android:text="@string/conference_schedule_participants_list" />
</LinearLayout> </LinearLayout>
@ -151,19 +176,19 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<TextView <TextView
android:visibility="gone" style="@style/big_orange_button_font"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_rect_orange_button"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingRight="20dp" android:paddingRight="20dp"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center"
android:background="@drawable/shape_rect_orange_button"
android:text="@string/conference_go_to_chat" android:text="@string/conference_go_to_chat"
style="@style/big_orange_button_font"/> android:visibility="gone" />
</LinearLayout> </LinearLayout>

View file

@ -252,6 +252,7 @@
<string name="conference_schedule_encryption">Would you like to encrypt the conference?</string> <string name="conference_schedule_encryption">Would you like to encrypt the conference?</string>
<string name="conference_schedule_send_invite_chat_summary">Invite will be sent out from my &appName; account</string> <string name="conference_schedule_send_invite_chat_summary">Invite will be sent out from my &appName; account</string>
<string name="conference_schedule_participants_list">Participants list</string> <string name="conference_schedule_participants_list">Participants list</string>
<string name="conference_organizer">Organizer</string>
<string name="conference_schedule_summary">Conference info</string> <string name="conference_schedule_summary">Conference info</string>
<string name="conference_schedule_create">Create conference</string> <string name="conference_schedule_create">Create conference</string>
<string name="conference_schedule">Schedule conference</string> <string name="conference_schedule">Schedule conference</string>