diff --git a/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt b/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt index 01770f033..f1d2e75cb 100644 --- a/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt +++ b/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt @@ -22,6 +22,7 @@ package org.linphone.activities.main.conference.data import androidx.lifecycle.MutableLiveData import java.util.concurrent.TimeUnit import org.linphone.LinphoneApplication.Companion.coreContext +import org.linphone.R import org.linphone.core.ConferenceInfo import org.linphone.core.tools.Log import org.linphone.utils.LinphoneUtils @@ -29,6 +30,8 @@ import org.linphone.utils.TimestampUtils class ScheduledConferenceData(val conferenceInfo: ConferenceInfo) { val expanded = MutableLiveData() + val isFinished = MutableLiveData() + val backgroundResId = MutableLiveData() val address = MutableLiveData() val subject = MutableLiveData() @@ -76,6 +79,11 @@ class ScheduledConferenceData(val conferenceInfo: ConferenceInfo) { Log.e("[Scheduled Conference] No organizer SIP URI found for: ${conferenceInfo.uri?.asStringUriOnly()}") } + val now = System.currentTimeMillis() / 1000 // Linphone uses time_t in seconds + val limit = conferenceInfo.dateTime + conferenceInfo.duration + isFinished.value = limit < now + computeBackgroundResId() + computeParticipantsLists() } @@ -88,6 +96,23 @@ class ScheduledConferenceData(val conferenceInfo: ConferenceInfo) { fun toggleExpand() { expanded.value = expanded.value == false + computeBackgroundResId() + } + + private fun computeBackgroundResId() { + backgroundResId.value = if (isFinished.value == true) { + if (expanded.value == true) { + R.drawable.shape_round_dark_gray_background_with_orange_border + } else { + R.drawable.shape_round_dark_gray_background + } + } else { + if (expanded.value == true) { + R.drawable.shape_round_gray_background_with_orange_border + } else { + R.drawable.shape_round_gray_background + } + } } private fun computeParticipantsLists() { diff --git a/app/src/main/java/org/linphone/activities/main/conference/viewmodels/ScheduledConferencesViewModel.kt b/app/src/main/java/org/linphone/activities/main/conference/viewmodels/ScheduledConferencesViewModel.kt index ac7fee75e..2876f8363 100644 --- a/app/src/main/java/org/linphone/activities/main/conference/viewmodels/ScheduledConferencesViewModel.kt +++ b/app/src/main/java/org/linphone/activities/main/conference/viewmodels/ScheduledConferencesViewModel.kt @@ -31,6 +31,8 @@ import org.linphone.core.tools.Log class ScheduledConferencesViewModel : ViewModel() { val conferences = MutableLiveData>() + val showTerminated = MutableLiveData() + private val listener = object : CoreListenerStub() { override fun onConferenceInfoReceived(core: Core, conferenceInfo: ConferenceInfo) { Log.i("[Scheduled Conferences] New conference info received") @@ -40,6 +42,9 @@ class ScheduledConferencesViewModel : ViewModel() { init { coreContext.core.addListener(listener) + + showTerminated.value = false + computeConferenceInfoList() } @@ -49,6 +54,10 @@ class ScheduledConferencesViewModel : ViewModel() { super.onCleared() } + fun applyFilter() { + computeConferenceInfoList() + } + fun deleteConferenceInfo(data: ScheduledConferenceData) { val conferenceInfoList = arrayListOf() @@ -66,11 +75,22 @@ class ScheduledConferencesViewModel : ViewModel() { val conferencesList = arrayListOf() val now = System.currentTimeMillis() / 1000 // Linphone uses time_t in seconds - val oneHourAgo = now - 3600 // Show all conferences from 1 hour ago and forward - for (conferenceInfo in coreContext.core.getConferenceInformationListAfterTime(oneHourAgo)) { - if (conferenceInfo.duration == 0) continue // This isn't a scheduled conference, don't display it - val data = ScheduledConferenceData(conferenceInfo) - conferencesList.add(data) + + if (showTerminated.value == true) { + for (conferenceInfo in coreContext.core.conferenceInformationList) { + if (conferenceInfo.duration == 0) continue // This isn't a scheduled conference, don't display it + val limit = conferenceInfo.dateTime + conferenceInfo.duration + if (limit >= now) continue // This isn't a terminated conference, don't display it + val data = ScheduledConferenceData(conferenceInfo) + conferencesList.add(data) + } + } else { + val oneHourAgo = now - 7200 // Show all conferences from 2 hours ago and forward + for (conferenceInfo in coreContext.core.getConferenceInformationListAfterTime(oneHourAgo)) { + if (conferenceInfo.duration == 0) continue // This isn't a scheduled conference, don't display it + val data = ScheduledConferenceData(conferenceInfo) + conferencesList.add(data) + } } conferences.value = conferencesList diff --git a/app/src/main/res/drawable/shape_round_dark_gray_background.xml b/app/src/main/res/drawable/shape_round_dark_gray_background.xml new file mode 100644 index 000000000..d1cf0fab4 --- /dev/null +++ b/app/src/main/res/drawable/shape_round_dark_gray_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_round_dark_gray_background_with_orange_border.xml b/app/src/main/res/drawable/shape_round_dark_gray_background_with_orange_border.xml new file mode 100644 index 000000000..dfd68923b --- /dev/null +++ b/app/src/main/res/drawable/shape_round_dark_gray_background_with_orange_border.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/conference_schedule_cell.xml b/app/src/main/res/layout/conference_schedule_cell.xml index cfb06ed96..419605d9e 100644 --- a/app/src/main/res/layout/conference_schedule_cell.xml +++ b/app/src/main/res/layout/conference_schedule_cell.xml @@ -35,7 +35,7 @@ android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginTop="5dp" - android:background="@{data.expanded ? @drawable/shape_round_gray_background_with_orange_border : @drawable/shape_round_gray_background, default=@drawable/shape_round_gray_background}"> + backgroundImage="@{data.backgroundResId, default=@drawable/shape_round_gray_background}"> + + + + + + + + + + + android:layout_marginBottom="10dp" + android:layout_below="@id/divider" /> + android:visibility="@{!viewModel.showTerminated && viewModel.conferences.empty ? View.VISIBLE : View.GONE}" /> + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 25f52e6b2..a3d87ee73 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -733,4 +733,7 @@ Voir le contact Exporter l\'enregistrement avec… Exporter l\'enregistrement + Aucune réunion terminée pour le moment. + Terminées + Programmées \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fdb2d9535..56be4fc00 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -283,6 +283,7 @@ There is too many participants for mosaic layout, switching to active speaker (paused) No scheduled meeting yet. + No terminated meeting yet. Organizer: Meeting\'s chat room Failed to create meeting @@ -302,6 +303,8 @@ Group call Do you want to start a group call?\nEveryone in this group will receive a call to join the meeting. Start + Terminated + Scheduled Incoming Call