aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt b/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt
index 31258201..3dcca85f 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt
@@ -92,7 +92,9 @@ private fun PasswordItem.Companion.makeComparator(
): Comparator<PasswordItem> {
return when (typeSortOrder) {
PasswordRepository.PasswordSortOrder.FOLDER_FIRST -> compareBy { it.type }
- PasswordRepository.PasswordSortOrder.INDEPENDENT -> compareBy<PasswordItem>()
+ // In order to let INDEPENDENT not distinguish between items based on their type, we simply
+ // declare them all equal at this stage.
+ PasswordRepository.PasswordSortOrder.INDEPENDENT -> Comparator<PasswordItem> { _, _ -> 0 }
PasswordRepository.PasswordSortOrder.FILE_FIRST -> compareByDescending { it.type }
}
.then(compareBy(nullsLast(CaseInsensitiveComparator)) {