mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Show user when magic search didn't returned all available results
This commit is contained in:
parent
856f3e7f94
commit
8c7c7b40c3
10 changed files with 111 additions and 8 deletions
|
|
@ -384,7 +384,7 @@ class CorePreferences
|
|||
|
||||
@get:WorkerThread
|
||||
val magicSearchResultsLimit: Int
|
||||
get() = config.getInt("ui", "max_number_of_magic_search_results", 100)
|
||||
get() = config.getInt("ui", "max_number_of_magic_search_results", 300)
|
||||
|
||||
@get:WorkerThread
|
||||
val singleSignOnClientId: String
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ class ContactsListViewModel
|
|||
|
||||
val isDefaultAccountLinphone = MutableLiveData<Boolean>()
|
||||
|
||||
val showResultsLimitReached = MutableLiveData<Boolean>()
|
||||
|
||||
val vCardTerminatedEvent: MutableLiveData<Event<Pair<String, File>>> by lazy {
|
||||
MutableLiveData<Event<Pair<String, File>>>()
|
||||
}
|
||||
|
|
@ -84,6 +86,14 @@ class ContactsListViewModel
|
|||
Log.i("$TAG Magic search contacts available")
|
||||
processMagicSearchResults(magicSearch.lastSearch)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
override fun onResultsLimitReached(magicSearch: MagicSearch, sourcesFlag: Int) {
|
||||
Log.w("$TAG Results limit reached (configured limit is [${magicSearch.searchLimit}]) for source(s) [$sourcesFlag], user should refine it's search")
|
||||
if (searchFilter.value.orEmpty().isNotEmpty()) {
|
||||
showResultsLimitReached.postValue(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val contactsListener = object : ContactsListener {
|
||||
|
|
@ -259,6 +269,7 @@ class ContactsListViewModel
|
|||
"$TAG Asking Magic search for contacts matching filter [$filter], domain [$domain] and in sources Friends/LDAP/CardDAV"
|
||||
)
|
||||
searchInProgress.postValue(filter.isNotEmpty())
|
||||
showResultsLimitReached.postValue(false)
|
||||
magicSearch.getContactsListAsync(
|
||||
filter,
|
||||
domain,
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ abstract class AddressSelectionViewModel
|
|||
|
||||
val isEmpty = MutableLiveData<Boolean>()
|
||||
|
||||
val showResultsLimitReached = MutableLiveData<Boolean>()
|
||||
|
||||
protected var magicSearchSourceFlags = MagicSearch.Source.All.toInt()
|
||||
|
||||
protected var skipConversation: Boolean = true
|
||||
|
|
@ -77,6 +79,14 @@ abstract class AddressSelectionViewModel
|
|||
Log.i("$TAG Magic search contacts available")
|
||||
processMagicSearchResults(magicSearch.lastSearch)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
override fun onResultsLimitReached(magicSearch: MagicSearch, sourcesFlag: Int) {
|
||||
Log.w("$TAG Results limit reached (configured limit is [${magicSearch.searchLimit}]) for source(s) [$sourcesFlag], user should refine it's search")
|
||||
if (searchFilter.value.orEmpty().isNotEmpty()) {
|
||||
showResultsLimitReached.postValue(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val contactsListener = object : ContactsManager.ContactsListener {
|
||||
|
|
@ -241,6 +251,7 @@ abstract class AddressSelectionViewModel
|
|||
"$TAG Asking Magic search for contacts matching filter [$filter], domain [$domain] and in sources [$sources]"
|
||||
)
|
||||
searchInProgress.postValue(filter.isNotEmpty())
|
||||
showResultsLimitReached.postValue(false)
|
||||
magicSearch.getContactsListAsync(
|
||||
filter,
|
||||
domain,
|
||||
|
|
|
|||
|
|
@ -103,11 +103,25 @@
|
|||
android:layout_marginTop="16dp"
|
||||
android:text="@string/contacts_list_all_contacts_title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/results_limit_reached"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="@string/contacts_list_search_results_limit_reached_label"
|
||||
android:textColor="?attr/color_main2_600"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:visibility="@{viewModel.showResultsLimitReached ? View.VISIBLE : View.GONE, default=gone}"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/contactsList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,23 @@
|
|||
app:layout_constraintTop_toTopOf="@id/search_bar"
|
||||
app:tint="?attr/color_main2_600" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/results_limit_reached"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="@string/contacts_list_search_results_limit_reached_label"
|
||||
android:textColor="?attr/color_main2_600"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:visibility="@{viewModel.showResultsLimitReached ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintStart_toStartOf="@id/search_bar"
|
||||
app:layout_constraintEnd_toEndOf="@id/search_bar"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_contacts_nor_suggestion_image"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -198,7 +215,7 @@
|
|||
android:visibility="@{viewModel.isEmpty ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintTop_toBottomOf="@id/results_limit_reached"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
|
|
|
|||
|
|
@ -104,11 +104,25 @@
|
|||
android:layout_marginTop="16dp"
|
||||
android:text="@string/contacts_list_all_contacts_title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/results_limit_reached"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="@string/contacts_list_search_results_limit_reached_label"
|
||||
android:textColor="?attr/color_main2_600"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:visibility="@{viewModel.showResultsLimitReached ? View.VISIBLE : View.GONE, default=gone}"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/contactsList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -157,6 +157,23 @@
|
|||
app:layout_constraintTop_toTopOf="@id/search_bar"
|
||||
app:tint="?attr/color_main2_600" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/results_limit_reached"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="@string/contacts_list_search_results_limit_reached_label"
|
||||
android:textColor="?attr/color_main2_600"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:visibility="@{viewModel.showResultsLimitReached ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintStart_toStartOf="@id/search_bar"
|
||||
app:layout_constraintEnd_toEndOf="@id/search_bar"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_call"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -182,13 +199,13 @@
|
|||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/video_conference"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintTop_toBottomOf="@id/results_limit_reached"
|
||||
app:tint="?attr/color_on_main" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
|
|
|||
|
|
@ -139,6 +139,23 @@
|
|||
app:layout_constraintTop_toTopOf="@id/search_bar"
|
||||
app:tint="?attr/color_main2_600" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/results_limit_reached"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="@string/contacts_list_search_results_limit_reached_label"
|
||||
android:textColor="?attr/color_main2_600"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:visibility="@{viewModel.showResultsLimitReached ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintStart_toStartOf="@id/search_bar"
|
||||
app:layout_constraintEnd_toEndOf="@id/search_bar"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_chat"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -164,13 +181,13 @@
|
|||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/users_three"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintTop_toBottomOf="@id/results_limit_reached"
|
||||
app:tint="?attr/color_on_main" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
|
|
|||
|
|
@ -397,6 +397,7 @@
|
|||
<string name="contacts_list_filter_popup_see_all">Tous les contacts</string>
|
||||
<string name="contacts_list_filter_popup_see_linphone_only">Contacts &appName;</string>
|
||||
<string name="contacts_list_filter_popup_see_sip_only">Contacts SIP</string>
|
||||
<string name="contacts_list_search_results_limit_reached_label">Nombre maximal de résultats atteint, affinez votre recherche.</string>
|
||||
|
||||
<string name="contact_new_title">Nouveau contact</string>
|
||||
<string name="contact_edit_title">Modifier contact</string>
|
||||
|
|
|
|||
|
|
@ -439,6 +439,7 @@
|
|||
<string name="contacts_list_filter_popup_see_all">See all</string>
|
||||
<string name="contacts_list_filter_popup_see_linphone_only">See &appName; contacts</string>
|
||||
<string name="contacts_list_filter_popup_see_sip_only">See SIP contacts</string>
|
||||
<string name="contacts_list_search_results_limit_reached_label">Search results limit reached, refine your search.</string>
|
||||
|
||||
<string name="contact_new_title">New contact</string>
|
||||
<string name="contact_edit_title">Edit contact</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue