converting conversations and messages into searchresults

This commit is contained in:
tibbi 2021-02-15 22:36:48 +01:00
parent a53652042b
commit fbe46a55a8
2 changed files with 13 additions and 0 deletions

View File

@ -82,6 +82,16 @@ class SearchActivity : SimpleActivity() {
val conversations = conversationsDB.getConversationsWithText(searchQuery)
if (text == mLastSearchedText) {
val searchResults = ArrayList<SearchResult>()
conversations.forEach { conversation ->
val searchResult = SearchResult(conversation.title, conversation.phoneNumber, conversation.date, conversation.threadId)
searchResults.add(searchResult)
}
messages.forEach { message ->
val searchResult = SearchResult(message.senderName, message.body, message.date, message.threadId)
searchResults.add(searchResult)
}
runOnUiThread {
search_results_list.beVisibleIf(searchResults.isNotEmpty())
search_placeholder.beVisibleIf(searchResults.isEmpty())

View File

@ -0,0 +1,3 @@
package com.simplemobiletools.smsmessenger.models
data class SearchResult(val title: String, val snippet: String, val date: Int, val threadId: Long)