diff --git a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingsListViewModel.kt b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingsListViewModel.kt index f5fe6a927..1c7dd29d5 100644 --- a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingsListViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/MeetingsListViewModel.kt @@ -143,17 +143,20 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() { meetingForTodayFound = true } - // If no meeting was found for today, insert "Today" fake model before the next meeting to come + // If no meeting was found for today, insert "Today" fake model before the next meeting to come, + // but only add that fake meeting if filter is empty if (!meetingForTodayFound && model.isAfterToday) { - val todayWeekLabel = TimestampUtils.firstAndLastDayOfWeek( - System.currentTimeMillis(), - false - ) - val first = previousModelWeekLabel != todayWeekLabel - list.add(MeetingListItemModel(null, first)) - meetingForTodayFound = true - previousModelWeekLabel = todayWeekLabel - firstMeetingOfTheWeek = false + if (filter.isEmpty()) { + val todayWeekLabel = TimestampUtils.firstAndLastDayOfWeek( + System.currentTimeMillis(), + false + ) + val first = previousModelWeekLabel != todayWeekLabel + list.add(MeetingListItemModel(null, first)) + meetingForTodayFound = true + previousModelWeekLabel = todayWeekLabel + firstMeetingOfTheWeek = false + } } else { previousModelWeekLabel = model.weekLabel } @@ -163,8 +166,9 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() { } } - // If no meeting was found after today, insert "Today" fake model at the end - if (!meetingForTodayFound) { + // If no meeting was found after today, insert "Today" fake model at the end, + // but only add that fake meeting if filter is empty + if (!meetingForTodayFound && filter.isEmpty()) { val todayWeekLabel = TimestampUtils.firstAndLastDayOfWeek( System.currentTimeMillis(), false diff --git a/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractMainViewModel.kt b/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractMainViewModel.kt index 2fcee9886..d7a8cd10a 100644 --- a/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractMainViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractMainViewModel.kt @@ -66,6 +66,8 @@ open class AbstractMainViewModel @UiThread constructor() : GenericViewModel() { val unreadMessages = MutableLiveData() + val isFilterEmpty = MutableLiveData() + val focusSearchBarEvent: MutableLiveData> by lazy { MutableLiveData>() } @@ -170,6 +172,7 @@ open class AbstractMainViewModel @UiThread constructor() : GenericViewModel() { } searchBarVisible.value = false + isFilterEmpty.value = true } @UiThread @@ -214,6 +217,7 @@ open class AbstractMainViewModel @UiThread constructor() : GenericViewModel() { fun applyFilter(filter: String = currentFilter) { Log.i("$TAG New filter set by user [$filter]") currentFilter = filter + isFilterEmpty.postValue(filter.isEmpty()) filter() } diff --git a/app/src/main/res/layout-land/chat_list_fragment.xml b/app/src/main/res/layout-land/chat_list_fragment.xml index 473448840..c511aa369 100644 --- a/app/src/main/res/layout-land/chat_list_fragment.xml +++ b/app/src/main/res/layout-land/chat_list_fragment.xml @@ -87,7 +87,7 @@ android:id="@+id/no_conversation_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/conversations_list_empty" + android:text="@{viewModel.isFilterEmpty ? @string/conversations_list_empty : @string/list_filter_no_result_found, default=@string/conversations_list_empty}" app:layout_constraintBottom_toTopOf="@id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/bottom_nav_bar" diff --git a/app/src/main/res/layout-land/contacts_list_fragment.xml b/app/src/main/res/layout-land/contacts_list_fragment.xml index 2c5fd4fde..e8c921c36 100644 --- a/app/src/main/res/layout-land/contacts_list_fragment.xml +++ b/app/src/main/res/layout-land/contacts_list_fragment.xml @@ -142,7 +142,7 @@ android:id="@+id/no_contacts_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/contacts_list_empty" + android:text="@{viewModel.isFilterEmpty ? @string/contacts_list_empty : @string/list_filter_no_result_found, default=@string/contacts_list_empty}" app:layout_constraintBottom_toTopOf="@id/lists" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/bottom_nav_bar" diff --git a/app/src/main/res/layout-land/history_list_fragment.xml b/app/src/main/res/layout-land/history_list_fragment.xml index 7e32877a7..73655bdf3 100644 --- a/app/src/main/res/layout-land/history_list_fragment.xml +++ b/app/src/main/res/layout-land/history_list_fragment.xml @@ -107,7 +107,7 @@ android:id="@+id/no_calls_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/history_list_empty_history" + android:text="@{viewModel.isFilterEmpty ? @string/history_list_empty_history : @string/list_filter_no_result_found, default=@string/history_list_empty_history}" app:layout_constraintBottom_toTopOf="@id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/bottom_nav_bar" diff --git a/app/src/main/res/layout-land/meetings_list_fragment.xml b/app/src/main/res/layout-land/meetings_list_fragment.xml index 22eb85f6b..37fd23ef2 100644 --- a/app/src/main/res/layout-land/meetings_list_fragment.xml +++ b/app/src/main/res/layout-land/meetings_list_fragment.xml @@ -104,7 +104,7 @@ android:id="@+id/no_meeting_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/meetings_list_empty" + android:text="@{viewModel.isFilterEmpty ? @string/meetings_list_empty : @string/list_filter_no_result_found, default=@string/meetings_list_empty}" app:layout_constraintBottom_toTopOf="@id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/bottom_nav_bar" diff --git a/app/src/main/res/layout/chat_conversation_fragment.xml b/app/src/main/res/layout/chat_conversation_fragment.xml index 8d9a68711..73fc397f9 100644 --- a/app/src/main/res/layout/chat_conversation_fragment.xml +++ b/app/src/main/res/layout/chat_conversation_fragment.xml @@ -246,7 +246,7 @@ android:id="@+id/no_result" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/conversation_filter_no_matching_result" + android:text="@string/list_filter_no_result_found" android:textColor="?attr/color_main2_600" android:textSize="16sp" android:visibility="@{viewModel.noMatchingResultForFilter ? View.VISIBLE : View.GONE}" diff --git a/app/src/main/res/layout/chat_list_fragment.xml b/app/src/main/res/layout/chat_list_fragment.xml index 95e917cfd..42ff73574 100644 --- a/app/src/main/res/layout/chat_list_fragment.xml +++ b/app/src/main/res/layout/chat_list_fragment.xml @@ -77,7 +77,7 @@ android:id="@+id/no_conversation_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/conversations_list_empty" + android:text="@{viewModel.isFilterEmpty ? @string/conversations_list_empty : @string/list_filter_no_result_found, default=@string/conversations_list_empty}" app:layout_constraintBottom_toTopOf="@id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/contacts_list_fragment.xml b/app/src/main/res/layout/contacts_list_fragment.xml index 0bd8ac4df..6601efcbf 100644 --- a/app/src/main/res/layout/contacts_list_fragment.xml +++ b/app/src/main/res/layout/contacts_list_fragment.xml @@ -134,7 +134,7 @@ android:id="@+id/no_contacts_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/contacts_list_empty" + android:text="@{viewModel.isFilterEmpty ? @string/contacts_list_empty : @string/list_filter_no_result_found, default=@string/contacts_list_empty}" app:layout_constraintBottom_toTopOf="@id/lists" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/history_list_fragment.xml b/app/src/main/res/layout/history_list_fragment.xml index fe5d5e7bb..3496baee3 100644 --- a/app/src/main/res/layout/history_list_fragment.xml +++ b/app/src/main/res/layout/history_list_fragment.xml @@ -97,7 +97,7 @@ android:id="@+id/no_calls_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/history_list_empty_history" + android:text="@{viewModel.isFilterEmpty ? @string/history_list_empty_history : @string/list_filter_no_result_found, default=@string/history_list_empty_history}" app:layout_constraintBottom_toTopOf="@id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/meetings_list_fragment.xml b/app/src/main/res/layout/meetings_list_fragment.xml index 76dd642c4..e10718a40 100644 --- a/app/src/main/res/layout/meetings_list_fragment.xml +++ b/app/src/main/res/layout/meetings_list_fragment.xml @@ -94,7 +94,7 @@ android:id="@+id/no_meeting_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/meetings_list_empty" + android:text="@{viewModel.isFilterEmpty ? @string/meetings_list_empty : @string/list_filter_no_result_found, default=@string/meetings_list_empty}" app:layout_constraintBottom_toTopOf="@id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d7cd72300..b73c15468 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -419,7 +419,6 @@ Documents Aucun média pour le moment… Aucun document pour le moment… - Aucun résultat… Conversation chiffrée de bout en bout Les messages de cette conversation sont chiffrés de bout en bout. Seul votre correspondant peut les déchiffrer. La confidentialité de vos échanges garantie @@ -686,6 +685,7 @@ Violet + Aucun résultat… Les participants selectionnés apparaîtront ici Compte(s) non connecté(s) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0bf997505..a432d5655 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -456,7 +456,6 @@ Documents No media found… No document found… - No matching result End-to-end encrypted conversation Messages in this conversation are e2e encrypted. Only your correspondent can decrypt them. Guaranteed confidentiality @@ -723,6 +722,7 @@ Purple + No result found… Selected participants will appear here Account(s) connection error