lets ignore accents at sorting apps for now

This commit is contained in:
tibbi 2022-09-18 10:12:21 +02:00
parent ed81323af6
commit 9f20afef1c
2 changed files with 5 additions and 3 deletions

View File

@ -92,7 +92,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
} }
val launchers = allApps.distinctBy { it.packageName } as ArrayList<AppLauncher> val launchers = allApps.distinctBy { it.packageName } as ArrayList<AppLauncher>
launchers.sortBy { it.title.toLowerCase() } launchers.sortBy { it.title.normalizeString().lowercase() }
val layoutManager = all_apps_grid.layoutManager as MyGridLayoutManager val layoutManager = all_apps_grid.layoutManager as MyGridLayoutManager
layoutManager.spanCount = context.getColumnCount() layoutManager.spanCount = context.getColumnCount()

View File

@ -2,8 +2,10 @@ package com.simplemobiletools.launcher.models
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import androidx.room.* import androidx.room.*
import com.simplemobiletools.commons.extensions.normalizeString
import com.simplemobiletools.commons.helpers.SORT_BY_TITLE import com.simplemobiletools.commons.helpers.SORT_BY_TITLE
import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.commons.helpers.SORT_DESCENDING
import java.util.*
@Entity(tableName = "apps", indices = [(Index(value = ["package_name"], unique = true))]) @Entity(tableName = "apps", indices = [(Index(value = ["package_name"], unique = true))])
data class AppLauncher( data class AppLauncher(
@ -30,7 +32,7 @@ data class AppLauncher(
override fun compareTo(other: AppLauncher): Int { override fun compareTo(other: AppLauncher): Int {
var result = when { var result = when {
sorting and SORT_BY_TITLE != 0 -> title.toLowerCase().compareTo(other.title.toLowerCase()) sorting and SORT_BY_TITLE != 0 -> title.normalizeString().lowercase().compareTo(other.title.normalizeString().lowercase())
else -> { else -> {
if (order > 0 && other.order == 0) { if (order > 0 && other.order == 0) {
-1 -1
@ -39,7 +41,7 @@ data class AppLauncher(
} else if (order > 0 && other.order > 0) { } else if (order > 0 && other.order > 0) {
order.compareTo(other.order) order.compareTo(other.order)
} else { } else {
title.toLowerCase().compareTo(other.title.toLowerCase()) title.lowercase().compareTo(other.title.lowercase())
} }
} }
} }