mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Change sources sort to case-insensitive (#3743)
This commit is contained in:
		| @@ -112,7 +112,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : | ||||
|                 .forEach { | ||||
|                     val preferenceBlock = { | ||||
|                         it.value | ||||
|                             .sortedWith(compareBy({ !it.isEnabled() }, { it.name })) | ||||
|                             .sortedWith(compareBy({ !it.isEnabled() }, { it.name.toLowerCase() })) | ||||
|                             .forEach { source -> | ||||
|                                 val sourcePrefs = mutableListOf<Preference>() | ||||
|  | ||||
|   | ||||
| @@ -29,7 +29,7 @@ class MigrationSourcesPresenter( | ||||
|         val header = SelectionHeader() | ||||
|         return library.map { it.source }.toSet() | ||||
|             .mapNotNull { if (it != LocalSource.ID) sourceManager.getOrStub(it) else null } | ||||
|             .sortedBy { it.name } | ||||
|             .sortedBy { it.name.toLowerCase() } | ||||
|             .map { SourceItem(it, header) } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -42,7 +42,7 @@ class SourceFilterController : SettingsController() { | ||||
|         ) | ||||
|  | ||||
|         orderedLangs.forEach { lang -> | ||||
|             val sources = sourcesByLang[lang].orEmpty().sortedBy { it.name } | ||||
|             val sources = sourcesByLang[lang].orEmpty().sortedBy { it.name.toLowerCase() } | ||||
|  | ||||
|             // Create a preference group and set initial state and change listener | ||||
|             switchPreferenceCategory { | ||||
|   | ||||
| @@ -128,7 +128,7 @@ class SourcePresenter( | ||||
|         return sourceManager.getCatalogueSources() | ||||
|             .filter { it.lang in languages } | ||||
|             .filterNot { it.id.toString() in disabledSourceIds } | ||||
|             .sortedBy { "(${it.lang}) ${it.name}" } + | ||||
|             .sortedBy { "(${it.lang}) ${it.name.toLowerCase()}" } + | ||||
|             sourceManager.get(LocalSource.ID) as LocalSource | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -108,7 +108,7 @@ open class GlobalSearchPresenter( | ||||
|         return sourceManager.getCatalogueSources() | ||||
|             .filter { it.lang in languages } | ||||
|             .filterNot { it.id.toString() in disabledSourceIds } | ||||
|             .sortedWith(compareBy({ it.id.toString() !in pinnedSourceIds }, { "${it.name} (${it.lang})" })) | ||||
|             .sortedWith(compareBy({ it.id.toString() !in pinnedSourceIds }, { "${it.name.toLowerCase()} (${it.lang})" })) | ||||
|     } | ||||
|  | ||||
|     private fun getSourcesToQuery(): List<CatalogueSource> { | ||||
| @@ -188,7 +188,7 @@ open class GlobalSearchPresenter( | ||||
|                             { it.results.isNullOrEmpty() }, | ||||
|                             // Same as initial sort, i.e. pinned first then alphabetically | ||||
|                             { it.source.id.toString() !in pinnedSourceIds }, | ||||
|                             { "${it.source.name} (${it.source.lang})" } | ||||
|                             { "${it.source.name.toLowerCase()} (${it.source.lang})" } | ||||
|                         ) | ||||
|                     ) | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user