Skip to content

Commit 63e75ec

Browse files
committed
sort notes properly, including accents
1 parent 1622970 commit 63e75ec

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers/CollatorBasedComparator.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.text.Collator
77
*
88
* Adapted from AlphanumericComparator to support numerical collation.
99
*/
10-
class CollatorBasedComparator: Comparator<String> {
10+
class CollatorBasedComparator : Comparator<String> {
1111
override fun compare(string1: String, string2: String): Int {
1212
val collator = getCollator()
1313

@@ -64,10 +64,12 @@ class CollatorBasedComparator: Comparator<String> {
6464
chunk.append(c)
6565
current++
6666
}
67+
6768
return chunk.toString()
6869
}
6970

7071
private fun isDigit(ch: Char) = ch in '0'..'9'
72+
7173
private fun coerceResult(compareToResult: Int) = compareToResult.coerceIn(-1, 1)
7274

7375
private fun getCollator(): Collator {

app/src/main/kotlin/com/simplemobiletools/notes/pro/interfaces/NotesDao.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.simplemobiletools.notes.pro.models.Note
55

66
@Dao
77
interface NotesDao {
8-
@Query("SELECT * FROM notes ORDER BY title COLLATE NOCASE ASC")
8+
@Query("SELECT * FROM notes ORDER BY title COLLATE UNICODE ASC ")
99
fun getNotes(): List<Note>
1010

1111
@Query("SELECT * FROM notes WHERE id = :id")

0 commit comments

Comments
 (0)