General settings split into General and Library
This commit is contained in:
parent
2535ea92eb
commit
ce30d9602b
@ -56,8 +56,6 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var titleText = "Migrate manga"
|
|
||||||
|
|
||||||
private var adapter: MigrationProcessAdapter? = null
|
private var adapter: MigrationProcessAdapter? = null
|
||||||
|
|
||||||
override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default
|
override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default
|
||||||
@ -78,11 +76,12 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
return inflater.inflate(R.layout.migration_list_controller, container, false)
|
return inflater.inflate(R.layout.migration_list_controller, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTitle(): String {
|
override fun getTitle(): String? {
|
||||||
return titleText
|
return resources?.getString(R.string.migration)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
|
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
setTitle()
|
setTitle()
|
||||||
val config = this.config ?: return
|
val config = this.config ?: return
|
||||||
|
@ -49,26 +49,6 @@ class SettingsAboutController : SettingsController() {
|
|||||||
summaryRes = R.string.pref_acra_summary
|
summaryRes = R.string.pref_acra_summary
|
||||||
defaultValue = true
|
defaultValue = true
|
||||||
}
|
}
|
||||||
switchPreference {
|
|
||||||
key = Keys.automaticUpdates
|
|
||||||
titleRes = R.string.pref_enable_automatic_updates
|
|
||||||
summaryRes = R.string.pref_enable_automatic_updates_summary
|
|
||||||
defaultValue = false
|
|
||||||
|
|
||||||
if (isUpdaterEnabled) {
|
|
||||||
onChange { newValue ->
|
|
||||||
val checked = newValue as Boolean
|
|
||||||
if (checked) {
|
|
||||||
UpdaterJob.setupTask()
|
|
||||||
} else {
|
|
||||||
UpdaterJob.cancelTask()
|
|
||||||
}
|
|
||||||
true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
isVisible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
preference {
|
preference {
|
||||||
title = "Discord"
|
title = "Discord"
|
||||||
val url = "https://discord.gg/tachiyomi"
|
val url = "https://discord.gg/tachiyomi"
|
||||||
|
@ -7,12 +7,14 @@ import android.view.View
|
|||||||
import androidx.biometric.BiometricManager
|
import androidx.biometric.BiometricManager
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
import eu.kanade.tachiyomi.data.database.models.Category
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
|
import eu.kanade.tachiyomi.data.updater.UpdaterJob
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import eu.kanade.tachiyomi.util.LocaleHelper
|
import eu.kanade.tachiyomi.util.LocaleHelper
|
||||||
import eu.kanade.tachiyomi.widget.preference.IntListPreference
|
import eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||||
@ -24,7 +26,7 @@ import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
|||||||
|
|
||||||
class SettingsGeneralController : SettingsController() {
|
class SettingsGeneralController : SettingsController() {
|
||||||
|
|
||||||
private val db: DatabaseHelper = Injekt.get()
|
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||||
titleRes = R.string.pref_category_general
|
titleRes = R.string.pref_category_general
|
||||||
@ -67,30 +69,7 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
preference {
|
|
||||||
titleRes = R.string.pref_library_columns
|
|
||||||
onClick {
|
|
||||||
LibraryColumnsDialog().showDialog(router)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getColumnValue(value: Int): String {
|
|
||||||
return if (value == 0)
|
|
||||||
context.getString(R.string.default_columns)
|
|
||||||
else
|
|
||||||
value.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
Observable.combineLatest(
|
|
||||||
preferences.portraitColumns().asObservable(),
|
|
||||||
preferences.landscapeColumns().asObservable(),
|
|
||||||
{ portraitCols, landscapeCols -> Pair(portraitCols, landscapeCols) })
|
|
||||||
.subscribeUntilDestroy { (portraitCols, landscapeCols) ->
|
|
||||||
val portrait = getColumnValue(portraitCols)
|
|
||||||
val landscape = getColumnValue(landscapeCols)
|
|
||||||
summary = "${context.getString(R.string.portrait)}: $portrait, " +
|
|
||||||
"${context.getString(R.string.landscape)}: $landscape"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intListPreference {
|
intListPreference {
|
||||||
key = Keys.startScreen
|
key = Keys.startScreen
|
||||||
titleRes = R.string.pref_start_screen
|
titleRes = R.string.pref_start_screen
|
||||||
@ -100,121 +79,25 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
defaultValue = "1"
|
defaultValue = "1"
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
}
|
}
|
||||||
intListPreference {
|
switchPreference {
|
||||||
key = Keys.libraryUpdateInterval
|
key = eu.kanade.tachiyomi.data.preference.PreferenceKeys.automaticUpdates
|
||||||
titleRes = R.string.pref_library_update_interval
|
titleRes = R.string.pref_enable_automatic_updates
|
||||||
entriesRes = arrayOf(R.string.update_never, R.string.update_1hour,
|
summaryRes = R.string.pref_enable_automatic_updates_summary
|
||||||
R.string.update_2hour, R.string.update_3hour, R.string.update_6hour,
|
defaultValue = false
|
||||||
R.string.update_12hour, R.string.update_24hour, R.string.update_48hour)
|
|
||||||
entryValues = arrayOf("0", "1", "2", "3", "6", "12", "24", "48")
|
|
||||||
defaultValue = "0"
|
|
||||||
summary = "%s"
|
|
||||||
|
|
||||||
|
if (isUpdaterEnabled) {
|
||||||
onChange { newValue ->
|
onChange { newValue ->
|
||||||
// Always cancel the previous task, it seems that sometimes they are not updated.
|
val checked = newValue as Boolean
|
||||||
LibraryUpdateJob.cancelTask()
|
if (checked) {
|
||||||
|
UpdaterJob.setupTask()
|
||||||
val interval = (newValue as String).toInt()
|
} else {
|
||||||
if (interval > 0) {
|
UpdaterJob.cancelTask()
|
||||||
LibraryUpdateJob.setupTask(interval)
|
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
isVisible = false
|
||||||
}
|
}
|
||||||
multiSelectListPreference {
|
|
||||||
key = Keys.libraryUpdateRestriction
|
|
||||||
titleRes = R.string.pref_library_update_restriction
|
|
||||||
entriesRes = arrayOf(R.string.wifi, R.string.charging)
|
|
||||||
entryValues = arrayOf("wifi", "ac")
|
|
||||||
summaryRes = R.string.pref_library_update_restriction_summary
|
|
||||||
|
|
||||||
preferences.libraryUpdateInterval().asObservable()
|
|
||||||
.subscribeUntilDestroy { isVisible = it > 0 }
|
|
||||||
|
|
||||||
onChange {
|
|
||||||
// Post to event looper to allow the preference to be updated.
|
|
||||||
Handler().post { LibraryUpdateJob.setupTask() }
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switchPreference {
|
|
||||||
key = Keys.updateOnlyNonCompleted
|
|
||||||
titleRes = R.string.pref_update_only_non_completed
|
|
||||||
defaultValue = false
|
|
||||||
}
|
|
||||||
|
|
||||||
val dbCategories = db.getCategories().executeAsBlocking()
|
|
||||||
|
|
||||||
multiSelectListPreference {
|
|
||||||
key = Keys.libraryUpdateCategories
|
|
||||||
titleRes = R.string.pref_library_update_categories
|
|
||||||
entries = dbCategories.map { it.name }.toTypedArray()
|
|
||||||
entryValues = dbCategories.map { it.id.toString() }.toTypedArray()
|
|
||||||
|
|
||||||
preferences.libraryUpdateCategories().asObservable()
|
|
||||||
.subscribeUntilDestroy {
|
|
||||||
val selectedCategories = it
|
|
||||||
.mapNotNull { id -> dbCategories.find { it.id == id.toInt() } }
|
|
||||||
.sortedBy { it.order }
|
|
||||||
|
|
||||||
summary = if (selectedCategories.isEmpty())
|
|
||||||
context.getString(R.string.all)
|
|
||||||
else
|
|
||||||
selectedCategories.joinToString { it.name }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intListPreference{
|
|
||||||
key = Keys.libraryUpdatePrioritization
|
|
||||||
titleRes = R.string.pref_library_update_prioritization
|
|
||||||
// The following arrays are to be lined up with the list rankingScheme in:
|
|
||||||
// ../../data/library/LibraryUpdateRanker.kt
|
|
||||||
entriesRes = arrayOf(
|
|
||||||
R.string.action_sort_alpha,
|
|
||||||
R.string.action_sort_last_updated
|
|
||||||
)
|
|
||||||
entryValues = arrayOf(
|
|
||||||
"0",
|
|
||||||
"1"
|
|
||||||
)
|
|
||||||
defaultValue = "0"
|
|
||||||
summaryRes = R.string.pref_library_update_prioritization_summary
|
|
||||||
}
|
|
||||||
intListPreference {
|
|
||||||
key = Keys.defaultCategory
|
|
||||||
titleRes = R.string.default_category
|
|
||||||
|
|
||||||
val categories = listOf(Category.createDefault()) + dbCategories
|
|
||||||
|
|
||||||
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
|
||||||
entries = arrayOf(context.getString(R.string.default_category_summary)) +
|
|
||||||
categories.map { it.name }.toTypedArray()
|
|
||||||
entryValues = arrayOf("-1") + categories.map { it.id.toString() }.toTypedArray()
|
|
||||||
defaultValue = "-1"
|
|
||||||
summary = selectedCategory?.name ?: context.getString(R.string.default_category_summary)
|
|
||||||
|
|
||||||
onChange { newValue ->
|
|
||||||
summary = categories.find {
|
|
||||||
it.id == (newValue as String).toInt()
|
|
||||||
}?.name ?: context.getString(R.string.default_category_summary)
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preferences.skipPreMigration().getOrDefault() || preferences.migrationSources()
|
|
||||||
.getOrDefault().isNotEmpty()) {
|
|
||||||
switchPreference {
|
|
||||||
key = Keys.skipPreMigration
|
|
||||||
titleRes = R.string.pref_skip_pre_migration
|
|
||||||
summaryRes = R.string.pref_skip_pre_migration_summary
|
|
||||||
defaultValue = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switchPreference {
|
|
||||||
key = Keys.removeArticles
|
|
||||||
titleRes = R.string.pref_remove_articles
|
|
||||||
summaryRes = R.string.pref_remove_articles_summary
|
|
||||||
defaultValue = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val biometricManager = BiometricManager.from(context)
|
val biometricManager = BiometricManager.from(context)
|
||||||
@ -248,51 +131,4 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LibraryColumnsDialog : DialogController() {
|
|
||||||
|
|
||||||
private val preferences: PreferencesHelper = Injekt.get()
|
|
||||||
|
|
||||||
private var portrait = preferences.portraitColumns().getOrDefault()
|
|
||||||
private var landscape = preferences.landscapeColumns().getOrDefault()
|
|
||||||
|
|
||||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
|
||||||
val dialog = MaterialDialog.Builder(activity!!)
|
|
||||||
.title(R.string.pref_library_columns)
|
|
||||||
.customView(R.layout.pref_library_columns, false)
|
|
||||||
.positiveText(android.R.string.ok)
|
|
||||||
.negativeText(android.R.string.cancel)
|
|
||||||
.onPositive { _, _ ->
|
|
||||||
preferences.portraitColumns().set(portrait)
|
|
||||||
preferences.landscapeColumns().set(landscape)
|
|
||||||
}
|
|
||||||
.build()
|
|
||||||
|
|
||||||
onViewCreated(dialog.view)
|
|
||||||
return dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onViewCreated(view: View) {
|
|
||||||
with(view.portrait_columns) {
|
|
||||||
displayedValues = arrayOf(context.getString(R.string.default_columns)) +
|
|
||||||
IntRange(1, 10).map(Int::toString)
|
|
||||||
value = portrait
|
|
||||||
|
|
||||||
setOnValueChangedListener { _, _, newValue ->
|
|
||||||
portrait = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
with(view.landscape_columns) {
|
|
||||||
displayedValues = arrayOf(context.getString(R.string.default_columns)) +
|
|
||||||
IntRange(1, 10).map(Int::toString)
|
|
||||||
value = landscape
|
|
||||||
|
|
||||||
setOnValueChangedListener { _, _, newValue ->
|
|
||||||
landscape = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,221 @@
|
|||||||
|
package eu.kanade.tachiyomi.ui.setting
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.view.View
|
||||||
|
import androidx.biometric.BiometricManager
|
||||||
|
import androidx.preference.PreferenceScreen
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
|
import eu.kanade.tachiyomi.data.database.models.Category
|
||||||
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||||
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
|
import eu.kanade.tachiyomi.util.LocaleHelper
|
||||||
|
import eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||||
|
import kotlinx.android.synthetic.main.pref_library_columns.view.*
|
||||||
|
import rx.Observable
|
||||||
|
import uy.kohesive.injekt.Injekt
|
||||||
|
import uy.kohesive.injekt.api.get
|
||||||
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||||
|
|
||||||
|
class SettingsLibraryController : SettingsController() {
|
||||||
|
|
||||||
|
private val db: DatabaseHelper = Injekt.get()
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||||
|
titleRes = R.string.pref_category_library
|
||||||
|
|
||||||
|
preference {
|
||||||
|
titleRes = R.string.pref_library_columns
|
||||||
|
onClick {
|
||||||
|
LibraryColumnsDialog().showDialog(router)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getColumnValue(value: Int): String {
|
||||||
|
return if (value == 0)
|
||||||
|
context.getString(R.string.default_columns)
|
||||||
|
else
|
||||||
|
value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
Observable.combineLatest(
|
||||||
|
preferences.portraitColumns().asObservable(),
|
||||||
|
preferences.landscapeColumns().asObservable(),
|
||||||
|
{ portraitCols, landscapeCols -> Pair(portraitCols, landscapeCols) })
|
||||||
|
.subscribeUntilDestroy { (portraitCols, landscapeCols) ->
|
||||||
|
val portrait = getColumnValue(portraitCols)
|
||||||
|
val landscape = getColumnValue(landscapeCols)
|
||||||
|
summary = "${context.getString(R.string.portrait)}: $portrait, " +
|
||||||
|
"${context.getString(R.string.landscape)}: $landscape"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intListPreference {
|
||||||
|
key = Keys.libraryUpdateInterval
|
||||||
|
titleRes = R.string.pref_library_update_interval
|
||||||
|
entriesRes = arrayOf(R.string.update_never, R.string.update_1hour,
|
||||||
|
R.string.update_2hour, R.string.update_3hour, R.string.update_6hour,
|
||||||
|
R.string.update_12hour, R.string.update_24hour, R.string.update_48hour)
|
||||||
|
entryValues = arrayOf("0", "1", "2", "3", "6", "12", "24", "48")
|
||||||
|
defaultValue = "0"
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
onChange { newValue ->
|
||||||
|
// Always cancel the previous task, it seems that sometimes they are not updated.
|
||||||
|
LibraryUpdateJob.cancelTask()
|
||||||
|
|
||||||
|
val interval = (newValue as String).toInt()
|
||||||
|
if (interval > 0) {
|
||||||
|
LibraryUpdateJob.setupTask(interval)
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
multiSelectListPreference {
|
||||||
|
key = Keys.libraryUpdateRestriction
|
||||||
|
titleRes = R.string.pref_library_update_restriction
|
||||||
|
entriesRes = arrayOf(R.string.wifi, R.string.charging)
|
||||||
|
entryValues = arrayOf("wifi", "ac")
|
||||||
|
summaryRes = R.string.pref_library_update_restriction_summary
|
||||||
|
|
||||||
|
preferences.libraryUpdateInterval().asObservable()
|
||||||
|
.subscribeUntilDestroy { isVisible = it > 0 }
|
||||||
|
|
||||||
|
onChange {
|
||||||
|
// Post to event looper to allow the preference to be updated.
|
||||||
|
Handler().post { LibraryUpdateJob.setupTask() }
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.updateOnlyNonCompleted
|
||||||
|
titleRes = R.string.pref_update_only_non_completed
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
|
|
||||||
|
val dbCategories = db.getCategories().executeAsBlocking()
|
||||||
|
|
||||||
|
multiSelectListPreference {
|
||||||
|
key = Keys.libraryUpdateCategories
|
||||||
|
titleRes = R.string.pref_library_update_categories
|
||||||
|
entries = dbCategories.map { it.name }.toTypedArray()
|
||||||
|
entryValues = dbCategories.map { it.id.toString() }.toTypedArray()
|
||||||
|
|
||||||
|
preferences.libraryUpdateCategories().asObservable()
|
||||||
|
.subscribeUntilDestroy {
|
||||||
|
val selectedCategories = it
|
||||||
|
.mapNotNull { id -> dbCategories.find { it.id == id.toInt() } }
|
||||||
|
.sortedBy { it.order }
|
||||||
|
|
||||||
|
summary = if (selectedCategories.isEmpty())
|
||||||
|
context.getString(R.string.all)
|
||||||
|
else
|
||||||
|
selectedCategories.joinToString { it.name }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intListPreference{
|
||||||
|
key = Keys.libraryUpdatePrioritization
|
||||||
|
titleRes = R.string.pref_library_update_prioritization
|
||||||
|
// The following arrays are to be lined up with the list rankingScheme in:
|
||||||
|
// ../../data/library/LibraryUpdateRanker.kt
|
||||||
|
entriesRes = arrayOf(
|
||||||
|
R.string.action_sort_alpha,
|
||||||
|
R.string.action_sort_last_updated
|
||||||
|
)
|
||||||
|
entryValues = arrayOf(
|
||||||
|
"0",
|
||||||
|
"1"
|
||||||
|
)
|
||||||
|
defaultValue = "0"
|
||||||
|
summaryRes = R.string.pref_library_update_prioritization_summary
|
||||||
|
}
|
||||||
|
intListPreference {
|
||||||
|
key = Keys.defaultCategory
|
||||||
|
titleRes = R.string.default_category
|
||||||
|
|
||||||
|
val categories = listOf(Category.createDefault()) + dbCategories
|
||||||
|
|
||||||
|
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
||||||
|
entries = arrayOf(context.getString(R.string.default_category_summary)) +
|
||||||
|
categories.map { it.name }.toTypedArray()
|
||||||
|
entryValues = arrayOf("-1") + categories.map { it.id.toString() }.toTypedArray()
|
||||||
|
defaultValue = "-1"
|
||||||
|
summary = selectedCategory?.name ?: context.getString(R.string.default_category_summary)
|
||||||
|
|
||||||
|
onChange { newValue ->
|
||||||
|
summary = categories.find {
|
||||||
|
it.id == (newValue as String).toInt()
|
||||||
|
}?.name ?: context.getString(R.string.default_category_summary)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only show this if someone has mass migrated manga once
|
||||||
|
if (preferences.skipPreMigration().getOrDefault() || preferences.migrationSources()
|
||||||
|
.getOrDefault().isNotEmpty()) {
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.skipPreMigration
|
||||||
|
titleRes = R.string.pref_skip_pre_migration
|
||||||
|
summaryRes = R.string.pref_skip_pre_migration_summary
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.removeArticles
|
||||||
|
titleRes = R.string.pref_remove_articles
|
||||||
|
summaryRes = R.string.pref_remove_articles_summary
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LibraryColumnsDialog : DialogController() {
|
||||||
|
|
||||||
|
private val preferences: PreferencesHelper = Injekt.get()
|
||||||
|
|
||||||
|
private var portrait = preferences.portraitColumns().getOrDefault()
|
||||||
|
private var landscape = preferences.landscapeColumns().getOrDefault()
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||||
|
val dialog = MaterialDialog.Builder(activity!!)
|
||||||
|
.title(R.string.pref_library_columns)
|
||||||
|
.customView(R.layout.pref_library_columns, false)
|
||||||
|
.positiveText(android.R.string.ok)
|
||||||
|
.negativeText(android.R.string.cancel)
|
||||||
|
.onPositive { _, _ ->
|
||||||
|
preferences.portraitColumns().set(portrait)
|
||||||
|
preferences.landscapeColumns().set(landscape)
|
||||||
|
}
|
||||||
|
.build()
|
||||||
|
|
||||||
|
onViewCreated(dialog.view)
|
||||||
|
return dialog
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onViewCreated(view: View) {
|
||||||
|
with(view.portrait_columns) {
|
||||||
|
displayedValues = arrayOf(context.getString(R.string.default_columns)) +
|
||||||
|
IntRange(1, 10).map(Int::toString)
|
||||||
|
value = portrait
|
||||||
|
|
||||||
|
setOnValueChangedListener { _, _, newValue ->
|
||||||
|
portrait = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with(view.landscape_columns) {
|
||||||
|
displayedValues = arrayOf(context.getString(R.string.default_columns)) +
|
||||||
|
IntRange(1, 10).map(Int::toString)
|
||||||
|
value = landscape
|
||||||
|
|
||||||
|
setOnValueChangedListener { _, _, newValue ->
|
||||||
|
landscape = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,10 @@
|
|||||||
package eu.kanade.tachiyomi.ui.setting
|
package eu.kanade.tachiyomi.ui.setting
|
||||||
|
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||||
|
import eu.kanade.tachiyomi.data.updater.UpdaterJob
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.util.getResourceColor
|
import eu.kanade.tachiyomi.util.getResourceColor
|
||||||
|
|
||||||
@ -17,6 +20,12 @@ class SettingsMainController : SettingsController() {
|
|||||||
titleRes = R.string.pref_category_general
|
titleRes = R.string.pref_category_general
|
||||||
onClick { navigateTo(SettingsGeneralController()) }
|
onClick { navigateTo(SettingsGeneralController()) }
|
||||||
}
|
}
|
||||||
|
preference {
|
||||||
|
iconRes = R.drawable.ic_in_library_24dp
|
||||||
|
iconTint = tintColor
|
||||||
|
titleRes = R.string.pref_category_library
|
||||||
|
onClick { navigateTo(SettingsLibraryController()) }
|
||||||
|
}
|
||||||
preference {
|
preference {
|
||||||
iconRes = R.drawable.ic_chrome_reader_mode_black_24dp
|
iconRes = R.drawable.ic_chrome_reader_mode_black_24dp
|
||||||
iconTint = tintColor
|
iconTint = tintColor
|
||||||
|
@ -72,35 +72,33 @@
|
|||||||
android:id="@+id/info_scrollview"
|
android:id="@+id/info_scrollview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="0dp"
|
|
||||||
android:layout_marginStart="0dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:paddingTop="16dp"
|
android:paddingTop="16dp"
|
||||||
android:paddingBottom="24dp"
|
android:paddingBottom="20dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:clipToPadding="false"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/guideline"
|
app:layout_constraintBottom_toBottomOf="@+id/backdrop"
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/guideline2"
|
app:layout_constraintLeft_toLeftOf="@+id/guideline2"
|
||||||
app:layout_constraintRight_toRightOf="parent">
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/manga_info_full_title_label"
|
|
||||||
android:id="@+id/manga_full_title"
|
android:id="@+id/manga_full_title"
|
||||||
style="@style/TextAppearance.Medium.Title"
|
style="@style/TextAppearance.Medium.Title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
|
android:text="@string/manga_info_full_title_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:autoSizeTextType="uniform"
|
|
||||||
app:autoSizeMinTextSize="12sp"
|
|
||||||
app:autoSizeMaxTextSize="20sp"
|
app:autoSizeMaxTextSize="20sp"
|
||||||
app:autoSizeStepGranularity="2sp"/>
|
app:autoSizeMinTextSize="12sp"
|
||||||
|
app:autoSizeStepGranularity="2sp"
|
||||||
|
app:autoSizeTextType="uniform"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_author_label"
|
android:id="@+id/manga_author_label"
|
||||||
@ -110,8 +108,8 @@
|
|||||||
android:text="@string/manga_info_author_label"
|
android:text="@string/manga_info_author_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_full_title"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@+id/manga_full_title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_author"
|
android:id="@+id/manga_author"
|
||||||
@ -124,7 +122,7 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_author_label"
|
app:layout_constraintBaseline_toBaselineOf="@+id/manga_author_label"
|
||||||
app:layout_constraintLeft_toRightOf="@+id/manga_author_label"
|
app:layout_constraintLeft_toRightOf="@+id/manga_author_label"
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_artist_label"
|
android:id="@+id/manga_artist_label"
|
||||||
@ -133,8 +131,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/manga_info_artist_label"
|
android:text="@string/manga_info_artist_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_author_label"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@+id/manga_author_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_artist"
|
android:id="@+id/manga_artist"
|
||||||
@ -147,7 +145,7 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_artist_label"
|
app:layout_constraintBaseline_toBaselineOf="@+id/manga_artist_label"
|
||||||
app:layout_constraintLeft_toRightOf="@+id/manga_artist_label"
|
app:layout_constraintLeft_toRightOf="@+id/manga_artist_label"
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_chapters_label"
|
android:id="@+id/manga_chapters_label"
|
||||||
@ -156,8 +154,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/manga_info_last_chapter_label"
|
android:text="@string/manga_info_last_chapter_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_chapters"
|
android:id="@+id/manga_chapters"
|
||||||
@ -170,7 +168,7 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_chapters_label"
|
app:layout_constraintBaseline_toBaselineOf="@+id/manga_chapters_label"
|
||||||
app:layout_constraintLeft_toRightOf="@+id/manga_chapters_label"
|
app:layout_constraintLeft_toRightOf="@+id/manga_chapters_label"
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_last_update_label"
|
android:id="@+id/manga_last_update_label"
|
||||||
@ -179,8 +177,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/manga_info_latest_data_label"
|
android:text="@string/manga_info_latest_data_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_chapters_label"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@+id/manga_chapters_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_last_update"
|
android:id="@+id/manga_last_update"
|
||||||
@ -193,7 +191,7 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_last_update_label"
|
app:layout_constraintBaseline_toBaselineOf="@+id/manga_last_update_label"
|
||||||
app:layout_constraintLeft_toRightOf="@+id/manga_last_update_label"
|
app:layout_constraintLeft_toRightOf="@+id/manga_last_update_label"
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status_label"
|
android:id="@+id/manga_status_label"
|
||||||
@ -202,8 +200,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/manga_info_status_label"
|
android:text="@string/manga_info_status_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_last_update_label"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@+id/manga_last_update_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status"
|
android:id="@+id/manga_status"
|
||||||
@ -216,7 +214,7 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_status_label"
|
app:layout_constraintBaseline_toBaselineOf="@+id/manga_status_label"
|
||||||
app:layout_constraintLeft_toRightOf="@+id/manga_status_label"
|
app:layout_constraintLeft_toRightOf="@+id/manga_status_label"
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_source_label"
|
android:id="@+id/manga_source_label"
|
||||||
@ -225,8 +223,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/manga_info_source_label"
|
android:text="@string/manga_info_source_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_status_label"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@+id/manga_status_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_source"
|
android:id="@+id/manga_source"
|
||||||
@ -239,7 +237,7 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_source_label"
|
app:layout_constraintBaseline_toBaselineOf="@+id/manga_source_label"
|
||||||
app:layout_constraintLeft_toRightOf="@+id/manga_source_label"
|
app:layout_constraintLeft_toRightOf="@+id/manga_source_label"
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@
|
|||||||
<!-- Preferences -->
|
<!-- Preferences -->
|
||||||
<!-- Subsections -->
|
<!-- Subsections -->
|
||||||
<string name="pref_category_general">General</string>
|
<string name="pref_category_general">General</string>
|
||||||
|
<string name="pref_category_library">Library</string>
|
||||||
<string name="pref_category_reader">Reader</string>
|
<string name="pref_category_reader">Reader</string>
|
||||||
<string name="pref_category_downloads">Downloads</string>
|
<string name="pref_category_downloads">Downloads</string>
|
||||||
<string name="pref_category_sources">Sources</string>
|
<string name="pref_category_sources">Sources</string>
|
||||||
@ -422,8 +423,8 @@
|
|||||||
<string name="download_all">Download all</string>
|
<string name="download_all">Download all</string>
|
||||||
<string name="download_unread">Download unread</string>
|
<string name="download_unread">Download unread</string>
|
||||||
<string name="confirm_delete_chapters">Are you sure you want to delete selected chapters?</string>
|
<string name="confirm_delete_chapters">Are you sure you want to delete selected chapters?</string>
|
||||||
<string name="confirm_migration">Migrate %1$d%2$s mangas?</string>
|
<string name="confirm_migration">Migrate %1$d%2$s manga?</string>
|
||||||
<string name="confirm_copy">Copy %1$d%2$s mangas?</string>
|
<string name="confirm_copy">Copy %1$d%2$s manga?</string>
|
||||||
<string name="skipping_x">(skipping %1$d)</string>
|
<string name="skipping_x">(skipping %1$d)</string>
|
||||||
<string name="no_migrations">No manga migrated</string>
|
<string name="no_migrations">No manga migrated</string>
|
||||||
<string name="error_fetching_migration">No chapters found, this manga cannot be used for
|
<string name="error_fetching_migration">No chapters found, this manga cannot be used for
|
||||||
@ -499,6 +500,7 @@
|
|||||||
<string name="migrate">Migrate</string>
|
<string name="migrate">Migrate</string>
|
||||||
<string name="copy">Copy</string>
|
<string name="copy">Copy</string>
|
||||||
<string name="migrating">Migrating…</string>
|
<string name="migrating">Migrating…</string>
|
||||||
|
<string name="migration">Migration</string>
|
||||||
<string name="latest_x">Latest: %1$s</string>
|
<string name="latest_x">Latest: %1$s</string>
|
||||||
|
|
||||||
<!-- Downloads activity and service -->
|
<!-- Downloads activity and service -->
|
||||||
@ -574,6 +576,6 @@
|
|||||||
<string name="use_most_chapters">Use source with the most chapters (slower)</string>
|
<string name="use_most_chapters">Use source with the most chapters (slower)</string>
|
||||||
<string name="use_first_source">Use first source with alternative</string>
|
<string name="use_first_source">Use first source with alternative</string>
|
||||||
<string name="skip_this_step_next_time">Skip this step next time</string>
|
<string name="skip_this_step_next_time">Skip this step next time</string>
|
||||||
<string name="pre_migration_skip_toast">To show this screen again, go to Settings -> General.</string>
|
<string name="pre_migration_skip_toast">To show this screen again, go to Settings -> Library.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user