From c2e1f7c09a76c7da7ae9c7a4a31e4d95f3de5e51 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 13 Jan 2020 04:18:17 -0800 Subject: [PATCH] Delete ExtensionFilterController.kt --- .../ui/extension/ExtensionFilterController.kt | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionFilterController.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionFilterController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionFilterController.kt deleted file mode 100644 index 7c2be136f3..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionFilterController.kt +++ /dev/null @@ -1,52 +0,0 @@ -package eu.kanade.tachiyomi.ui.extension - -import androidx.preference.PreferenceScreen -import androidx.preference.SwitchPreference -import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.preference.getOrDefault -import eu.kanade.tachiyomi.extension.ExtensionManager -import eu.kanade.tachiyomi.ui.setting.SettingsController -import eu.kanade.tachiyomi.ui.setting.onChange -import eu.kanade.tachiyomi.ui.setting.titleRes -import eu.kanade.tachiyomi.util.LocaleHelper -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get - -class ExtensionFilterController: SettingsController() { - - override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { - titleRes = R.string.action_filter - - val activeLangs = preferences.enabledLanguages().getOrDefault() - - val availableLangs = - Injekt.get().availableExtensions.groupBy { - it.lang - }.keys.minus("all").partition { - it in activeLangs - }.let { - it.first + it.second - } - - availableLangs.forEach { - SwitchPreference(context).apply { - preferenceScreen.addPreference(this) - title = LocaleHelper.getDisplayName(it, context) - isPersistent = false - isChecked = it in activeLangs - - onChange { newValue -> - val checked = newValue as Boolean - val currentActiveLangs = preferences.enabledLanguages().getOrDefault() - - if (checked) { - preferences.enabledLanguages().set(currentActiveLangs + it) - } else { - preferences.enabledLanguages().set(currentActiveLangs - it) - } - true - } - } - } - } -}