converting conversations and messages into searchresults
This commit is contained in:
parent
a53652042b
commit
fbe46a55a8
|
@ -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())
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
package com.simplemobiletools.smsmessenger.models
|
||||
|
||||
data class SearchResult(val title: String, val snippet: String, val date: Int, val threadId: Long)
|
Loading…
Reference in New Issue