Show cancelled meetings in list + fixed scroll to today

This commit is contained in:
Sylvain Berfini 2024-08-26 12:03:57 +02:00
parent 5c77b58154
commit 4d190cabdd
7 changed files with 40 additions and 5 deletions

View file

@ -128,10 +128,14 @@ class MeetingsListFragment : AbstractMainFragment() {
adapter.meetingClickedEvent.observe(viewLifecycleOwner) {
it.consume { model ->
Log.i("$TAG Show conversation with ID [${model.id}]")
sharedViewModel.displayedMeeting = model.conferenceInfo
val action = MeetingFragmentDirections.actionGlobalMeetingFragment(model.id)
binding.meetingsNavContainer.findNavController().navigate(action)
if (model.isCancelled) {
Log.w("$TAG Meeting with ID [${model.id}] is cancelled, can't show the details")
} else {
Log.i("$TAG Show meeting with ID [${model.id}]")
sharedViewModel.displayedMeeting = model.conferenceInfo
val action = MeetingFragmentDirections.actionGlobalMeetingFragment(model.id)
binding.meetingsNavContainer.findNavController().navigate(action)
}
}
}

View file

@ -26,7 +26,7 @@ class MeetingListItemModel @WorkerThread constructor(
meetingModel: MeetingModel?,
val firstMeetingOfTheWeek: Boolean
) {
val isToday = meetingModel == null
val isToday = meetingModel == null || meetingModel.isToday
val month = meetingModel?.month ?: TimestampUtils.month(System.currentTimeMillis(), false)

View file

@ -63,6 +63,8 @@ class MeetingModel @WorkerThread constructor(val conferenceInfo: ConferenceInfo)
val firstMeetingOfTheWeek = MutableLiveData<Boolean>()
val isCancelled = conferenceInfo.state == ConferenceInfo.State.Cancelled
init {
subject.postValue(conferenceInfo.subject)

View file

@ -63,6 +63,8 @@ class MeetingViewModel @UiThread constructor() : GenericViewModel() {
val participants = MutableLiveData<ArrayList<ParticipantModel>>()
val isCancelled = MutableLiveData<Boolean>()
val conferenceInfoFoundEvent = MutableLiveData<Event<Boolean>>()
val startTimeStamp = MutableLiveData<Long>()
@ -212,6 +214,10 @@ class MeetingViewModel @UiThread constructor() : GenericViewModel() {
sipUri.postValue(conferenceInfo.uri?.asStringUriOnly() ?: "")
description.postValue(conferenceInfo.description)
val state = conferenceInfo.state
Log.i("$TAG Conference info is in state [$state]")
isCancelled.postValue(state == ConferenceInfo.State.Cancelled)
val timestamp = conferenceInfo.dateTime
val duration = conferenceInfo.duration
val date = TimestampUtils.toString(

View file

@ -132,6 +132,27 @@
android:textColor="?attr/color_main2_500"
android:maxLines="1"
android:ellipsize="end"
android:visibility="@{model.isCancelled ? View.GONE : View.VISIBLE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_600"
android:id="@+id/cancelled"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="3dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/meeting_info_cancelled"
android:textSize="14sp"
android:textColor="?attr/color_danger_500"
android:maxLines="1"
android:ellipsize="end"
android:visibility="@{model.isCancelled ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -535,6 +535,7 @@
<string name="meeting_info_created_toast">La réunion a été créée</string>
<string name="meeting_info_updated_toast">La réunion a été mise à jour</string>
<string name="meeting_info_cancelled_toast">La réunion a été annulée</string>
<string name="meeting_info_cancelled">Réunion annulée</string>
<string name="meeting_failed_to_schedule_toast">Échec de la création de la réunion !</string>
<string name="meeting_schedule_mandatory_field_not_filled_toast">Au moins un champ obligatoire n\'a pas été rempli</string>
<string name="meeting_failed_to_send_invites_toast">Échec de l\'envoi des invitations à la réunion !</string>

View file

@ -573,6 +573,7 @@
<string name="meeting_info_created_toast">Meeting has been created</string>
<string name="meeting_info_updated_toast">Meeting has been updated</string>
<string name="meeting_info_cancelled_toast">Meeting has been cancelled</string>
<string name="meeting_info_cancelled">Meeting cancelled</string>
<string name="meeting_failed_to_schedule_toast">Failed to schedule meeting!</string>
<string name="meeting_schedule_mandatory_field_not_filled_toast">A least a mandatory field wasn\'t filled</string>
<string name="meeting_failed_to_send_invites_toast">Failed to send all invites to meeting!</string>