From 8dd48586121dd28056b3a912b3eac114d8202bdb Mon Sep 17 00:00:00 2001 From: Willi Ye Date: Wed, 10 Feb 2021 21:11:58 +0100 Subject: [PATCH] Fix sorting in search --- app/src/main/java/emu/skyline/adapter/GenericAdapter.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt b/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt index fc17050f..da5a7fb0 100644 --- a/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt +++ b/app/src/main/java/emu/skyline/adapter/GenericAdapter.kt @@ -79,9 +79,7 @@ class GenericAdapter : RecyclerView.Adapter>(), F val similarity = (jw.similarity(currentSearchTerm, it) + cos.similarity(currentSearchTerm, it)) / 2 if (similarity != 0.0) ScoredItem(similarity, item) else null } - }.apply { - sortedByDescending { it.score } - } + }.sortedByDescending { it.score } /** * This performs filtering on the items in [allItems] based on similarity to [term]