Added label to let user know there is no message matching it's filter

This commit is contained in:
Sylvain Berfini 2024-01-10 11:50:41 +01:00
parent 29e4bb5932
commit 8a6a2bef02
3 changed files with 24 additions and 1 deletions

View file

@ -70,6 +70,8 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
val isUserScrollingUp = MutableLiveData<Boolean>()
val noMatchingResultForFilter = MutableLiveData<Boolean>()
var scrollingPosition: Int = SCROLLING_POSITION_NOT_SET
val focusSearchBarEvent: MutableLiveData<Event<Boolean>> by lazy {
@ -474,6 +476,12 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
val history = chatRoom.getHistoryEvents(0)
val eventsList = getEventsListFromHistory(history, filter)
events.postValue(eventsList)
if (filter.isNotEmpty() && eventsList.isEmpty()) {
noMatchingResultForFilter.postValue(true)
} else {
noMatchingResultForFilter.postValue(false)
}
}
@WorkerThread

View file

@ -147,7 +147,7 @@
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="15dp"
android:src="@drawable/phone_call"
android:src="@drawable/phone"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintEnd_toStartOf="@id/show_menu"
app:layout_constraintTop_toTopOf="@id/title"
@ -216,6 +216,20 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/composing"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"
android:id="@+id/no_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/conversation_filter_no_matching_result"
android:textColor="?attr/color_main2_600"
android:textSize="16sp"
android:visibility="@{viewModel.noMatchingResultForFilter ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/search"
app:layout_constraintBottom_toTopOf="@id/send_area"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
android:id="@+id/composing"

View file

@ -415,6 +415,7 @@
<string name="conversation_reply_to_message_title">Replying to:</string>
<string name="conversation_menu_search_in_messages">Search</string>
<string name="conversation_menu_go_to_info">Conversation info</string>
<string name="conversation_filter_no_matching_result">No matching result</string>
<string name="conversation_info_participants_list_title">Group members</string>
<string name="conversation_info_add_participants_label">Add participants</string>