Shows favorited tags first on suggestion list
This commit is contained in:
@@ -809,7 +809,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
suggestionJob?.cancel()
|
suggestionJob?.cancel()
|
||||||
|
|
||||||
suggestionJob = CoroutineScope(Dispatchers.IO).launch {
|
suggestionJob = CoroutineScope(Dispatchers.IO).launch {
|
||||||
val suggestions = getSuggestionsForQuery(currentQuery).map { TagSuggestion(it) }
|
val suggestions = ArrayList(getSuggestionsForQuery(currentQuery).map { TagSuggestion(it) })
|
||||||
|
|
||||||
|
suggestions.filter {
|
||||||
|
val tag = "${it.n}:${it.s.replace(Regex("\\s"), "_")}"
|
||||||
|
Tags(json.parse(serializer, favoritesFile.readText())).contains(tag)
|
||||||
|
}.reversed().forEach {
|
||||||
|
suggestions.remove(it)
|
||||||
|
suggestions.add(0, it)
|
||||||
|
}
|
||||||
|
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
swapSuggestions(suggestions)
|
swapSuggestions(suggestions)
|
||||||
|
|||||||
Reference in New Issue
Block a user