Also moved all migration options to the sources settings Migration sources converted to flowpref New settings: Only globally search pinned sources Match migration sources with pinned Match migration sources with enabled sourcespull/3372/head
parent
f851c5536a
commit
45f1f99292
@ -0,0 +1,110 @@
|
||||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.migration.MigrationController
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsBrowseController : SettingsController() {
|
||||
|
||||
val sourceManager: SourceManager by injectLazy()
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||
titleRes = R.string.sources
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.extensions
|
||||
switchPreference {
|
||||
key = PreferenceKeys.automaticExtUpdates
|
||||
titleRes = R.string.check_for_extension_updates
|
||||
defaultValue = true
|
||||
|
||||
onChange {
|
||||
it as Boolean
|
||||
ExtensionUpdateJob.setupTask(it)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_global_search
|
||||
switchPreference {
|
||||
key = PreferenceKeys.onlySearchPinned
|
||||
titleRes = R.string.only_search_pinned_when
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.migration
|
||||
// Only show this if someone has mass migrated manga once
|
||||
|
||||
preference {
|
||||
titleRes = R.string.source_migration
|
||||
onClick { router.pushController(MigrationController().withFadeTransaction()) }
|
||||
}
|
||||
if (preferences.skipPreMigration().getOrDefault() || preferences.migrationSources()
|
||||
.isSet()
|
||||
) {
|
||||
switchPreference {
|
||||
key = PreferenceKeys.skipPreMigration
|
||||
titleRes = R.string.skip_pre_migration
|
||||
summaryRes = R.string.use_last_saved_migration_preferences
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
preference {
|
||||
titleRes = R.string.match_pinned_sources
|
||||
summaryRes = R.string.only_enable_pinned_for_migration
|
||||
onClick {
|
||||
val ogSources = preferences.migrationSources().get()
|
||||
val pinnedSources =
|
||||
(preferences.pinnedCatalogues().get() ?: emptySet()).joinToString("/")
|
||||
preferences.migrationSources().set(pinnedSources)
|
||||
(activity as? MainActivity)?.setUndoSnackBar(view?.snack(
|
||||
R.string.migration_sources_set
|
||||
) {
|
||||
setAction(R.string.undo) {
|
||||
preferences.migrationSources().set(ogSources)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
preference {
|
||||
titleRes = R.string.match_enabled_sources
|
||||
summaryRes = R.string.only_enable_enabled_for_migration
|
||||
onClick {
|
||||
val ogSources = preferences.migrationSources().get()
|
||||
val languages = preferences.enabledLanguages().getOrDefault()
|
||||
val hiddenCatalogues = preferences.hiddenSources().getOrDefault()
|
||||
val enabledSources =
|
||||
sourceManager.getCatalogueSources().filter { it.lang in languages }
|
||||
.filterNot { it.id.toString() in hiddenCatalogues }
|
||||
.sortedBy { "(${it.lang}) ${it.name}" }
|
||||
.joinToString("/") { it.id.toString() }
|
||||
preferences.migrationSources().set(enabledSources)
|
||||
(activity as? MainActivity)?.setUndoSnackBar(view?.snack(R.string.migration_sources_set) {
|
||||
setAction(R.string.undo) {
|
||||
preferences.migrationSources().set(ogSources)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.ic_info_outline_24dp
|
||||
iconTint = activity?.getResourceColor(android.R.attr.textColorSecondary) ?: 0
|
||||
summaryRes = R.string.you_can_migrate_in_library
|
||||
isEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z" />
|
||||
</vector>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/auto_checkbox"
|
||||
android:layout_marginStart="8dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notify_extension_updates">
|
||||
|
||||
</com.google.android.material.checkbox.MaterialCheckBox>
|
Loading…
Reference in new issue