Moving Source migration and edit categories to settings
This commit is contained in:
parent
2e4d57749c
commit
4aee7752c4
@ -58,7 +58,7 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
versionNameSuffix "-${getCommitCount()}"
|
||||
applicationIdSuffix ".debugJ2K"
|
||||
applicationIdSuffix ".debug"
|
||||
}
|
||||
release {
|
||||
applicationIdSuffix = '.j2k'
|
||||
|
@ -40,12 +40,10 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.TabbedController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||
import eu.kanade.tachiyomi.ui.download.DownloadController
|
||||
import eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.ui.migration.MigrationController
|
||||
import eu.kanade.tachiyomi.ui.migration.MigrationInterface
|
||||
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
|
||||
import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationListController
|
||||
@ -520,12 +518,6 @@ open class LibraryController(
|
||||
bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
else bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
R.id.action_edit_categories -> {
|
||||
router.pushController(CategoryController().withFadeTransaction())
|
||||
}
|
||||
R.id.action_source_migration -> {
|
||||
router.pushController(MigrationController().withFadeTransaction())
|
||||
}
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,8 @@ 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.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||
import kotlinx.android.synthetic.main.pref_library_columns.view.*
|
||||
import rx.Observable
|
||||
import uy.kohesive.injekt.Injekt
|
||||
@ -70,6 +72,47 @@ class SettingsLibraryController : SettingsController() {
|
||||
|
||||
val dbCategories = db.getCategories().executeAsBlocking()
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_category_library_categories
|
||||
preference {
|
||||
titleRes = R.string.action_edit_categories
|
||||
onClick { router.pushController(CategoryController().withFadeTransaction()) }
|
||||
}
|
||||
intListPreference(activity) {
|
||||
key = Keys.defaultCategory
|
||||
titleRes = R.string.default_category
|
||||
|
||||
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||
entries =
|
||||
listOf(context.getString(R.string.default_category_summary)) + categories.map { it.name }.toTypedArray()
|
||||
entryValues = listOf(-1) + categories.mapNotNull { it.id }.toList()
|
||||
defaultValue = "-1"
|
||||
|
||||
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
||||
summary =
|
||||
selectedCategory?.name ?: context.getString(R.string.default_category_summary)
|
||||
onChange { newValue ->
|
||||
summary = categories.find {
|
||||
it.id == newValue as Int
|
||||
}?.name ?: context.getString(R.string.default_category_summary)
|
||||
true
|
||||
}
|
||||
}
|
||||
intListPreference(activity) {
|
||||
titleRes = R.string.pref_keep_category_sorting
|
||||
key = Keys.keepCatSort
|
||||
|
||||
customSummary = context.getString(R.string.pref_keep_category_sorting_summary)
|
||||
entries = listOf(
|
||||
context.getString(R.string.always_ask),
|
||||
context.getString(R.string.option_keep_category_sort),
|
||||
context.getString(R.string.option_switch_to_dnd)
|
||||
)
|
||||
entryRange = 0..2
|
||||
defaultValue = 0
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_category_library_update
|
||||
intListPreference(activity) {
|
||||
@ -160,42 +203,6 @@ class SettingsLibraryController : SettingsController() {
|
||||
}
|
||||
}
|
||||
}
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_category_library_categories
|
||||
intListPreference(activity) {
|
||||
key = Keys.defaultCategory
|
||||
titleRes = R.string.default_category
|
||||
|
||||
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||
entries =
|
||||
listOf(context.getString(R.string.default_category_summary)) + categories.map { it.name }.toTypedArray()
|
||||
entryValues = listOf(-1) + categories.mapNotNull { it.id }.toList()
|
||||
defaultValue = "-1"
|
||||
|
||||
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
||||
summary =
|
||||
selectedCategory?.name ?: context.getString(R.string.default_category_summary)
|
||||
onChange { newValue ->
|
||||
summary = categories.find {
|
||||
it.id == newValue as Int
|
||||
}?.name ?: context.getString(R.string.default_category_summary)
|
||||
true
|
||||
}
|
||||
}
|
||||
intListPreference(activity) {
|
||||
titleRes = R.string.pref_keep_category_sorting
|
||||
key = Keys.keepCatSort
|
||||
|
||||
customSummary = context.getString(R.string.pref_keep_category_sorting_summary)
|
||||
entries = listOf(
|
||||
context.getString(R.string.always_ask),
|
||||
context.getString(R.string.option_keep_category_sort),
|
||||
context.getString(R.string.option_switch_to_dnd)
|
||||
)
|
||||
entryRange = 0..2
|
||||
defaultValue = 0
|
||||
}
|
||||
}
|
||||
if (preferences.skipPreMigration().getOrDefault() || preferences.migrationSources().getOrDefault().isNotEmpty()) {
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_category_library_migration
|
||||
|
@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.extension.ExtensionController
|
||||
import eu.kanade.tachiyomi.ui.migration.MigrationController
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
|
||||
@ -60,6 +61,12 @@ class SettingsMainController : SettingsController() {
|
||||
titleRes = R.string.pref_category_tracking
|
||||
onClick { navigateTo(SettingsTrackingController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.ic_swap_calls_white_24dp
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.label_migration
|
||||
onClick { navigateTo(MigrationController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.ic_backup_black_24dp
|
||||
iconTint = tintColor
|
||||
|
@ -17,16 +17,4 @@
|
||||
android:title="@string/action_filter"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_edit_categories"
|
||||
android:icon="@drawable/ic_label_outline_white_24dp"
|
||||
android:title="@string/action_edit_categories"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_source_migration"
|
||||
android:icon="@drawable/ic_swap_calls_white_24dp"
|
||||
android:title="@string/label_migration"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
|
Loading…
Reference in New Issue
Block a user