Bläddra i källkod

Sort sources/extensions filter languages

arkon 4 år sedan
förälder
incheckning
0bf14fd31c

+ 0 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt

@@ -91,7 +91,6 @@ open class ExtensionController :
                     ExtensionFilterController().withFadeTransaction()
                 )
             }
-            else -> return super.onOptionsItemSelected(item)
         }
         return super.onOptionsItemSelected(item)
     }

+ 2 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionDetailsController.kt

@@ -45,11 +45,12 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
         val extension = presenter.extension ?: return
         val context = view.context
 
+        extension.getApplicationIcon(context)?.let { binding.extensionIcon.setImageDrawable(it) }
         binding.extensionTitle.text = extension.name
         binding.extensionVersion.text = context.getString(R.string.ext_version_info, extension.versionName)
         binding.extensionLang.text = context.getString(R.string.ext_language_info, LocaleHelper.getSourceDisplayName(extension.lang, context))
         binding.extensionPkg.text = extension.pkgName
-        extension.getApplicationIcon(context)?.let { binding.extensionIcon.setImageDrawable(it) }
+
         binding.extensionUninstallButton.clicks()
             .onEach { presenter.uninstallExtension() }
             .launchIn(scope)

+ 7 - 9
app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterController.kt

@@ -21,11 +21,9 @@ class ExtensionFilterController : SettingsController() {
         val availableLangs =
             Injekt.get<ExtensionManager>().availableExtensions.groupBy {
                 it.lang
-            }.keys.minus("all").partition {
-                it in activeLangs
-            }.let {
-                it.first + it.second
-            }
+            }.keys
+                .minus("all")
+                .sortedWith(compareBy({ it !in activeLangs }, { LocaleHelper.getSourceDisplayName(it, context) }))
 
         availableLangs.forEach {
             switchPreference {
@@ -38,11 +36,11 @@ class ExtensionFilterController : SettingsController() {
                     val checked = newValue as Boolean
                     val currentActiveLangs = preferences.enabledLanguages().get()
 
-                    if (checked) {
-                        preferences.enabledLanguages().set(currentActiveLangs + it)
+                    preferences.enabledLanguages().set(if (checked) {
+                        currentActiveLangs + it
                     } else {
-                        preferences.enabledLanguages().set(currentActiveLangs - it)
-                    }
+                        currentActiveLangs - it
+                    })
                     true
                 }
             }

+ 1 - 2
app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesController.kt

@@ -30,8 +30,7 @@ class SettingsSourcesController : SettingsController() {
         val sourcesByLang = onlineSources.groupByTo(TreeMap(), { it.lang })
 
         // Order first by active languages, then inactive ones
-        val orderedLangs = sourcesByLang.keys.filter { it in activeLangsCodes } +
-            sourcesByLang.keys.filterNot { it in activeLangsCodes }
+        val orderedLangs = sourcesByLang.keys.sortedWith(compareBy({ it !in activeLangsCodes }, { LocaleHelper.getSourceDisplayName(it, context) }))
 
         orderedLangs.forEach { lang ->
             val sources = sourcesByLang[lang].orEmpty().sortedBy { it.name }