Sectioning Advanced section

This commit is contained in:
Jay 2020-08-09 20:18:45 -04:00
parent 696ffff401
commit 7a87714c88
2 changed files with 94 additions and 78 deletions

View File

@ -58,6 +58,8 @@ class SettingsAdvancedController : SettingsController() {
summaryRes = R.string.helps_fix_bugs
defaultValue = true
}
preferenceCategory {
titleRes = R.string.data_management
preference {
key = CLEAR_CACHE_KEY
titleRes = R.string.clear_chapter_cache
@ -68,7 +70,10 @@ class SettingsAdvancedController : SettingsController() {
preference {
titleRes = R.string.clean_up_cached_covers
summary = context.getString(R.string.delete_old_covers_in_library_used_, coverCache.getChapterCacheSize())
summary = context.getString(
R.string.delete_old_covers_in_library_used_,
coverCache.getChapterCacheSize()
)
onClick {
context.toast(R.string.starting_cleanup)
@ -77,21 +82,16 @@ class SettingsAdvancedController : SettingsController() {
}
preference {
titleRes = R.string.clean_up_cached_covers_non_library
summary = context.getString(R.string.delete_all_covers__not_in_library_used_, coverCache.getOnlineCoverCacheSize())
summary = context.getString(
R.string.delete_all_covers__not_in_library_used_,
coverCache.getOnlineCoverCacheSize()
)
onClick {
context.toast(R.string.starting_cleanup)
coverCache.deleteAllCachedCovers()
}
}
preference {
titleRes = R.string.clear_cookies
onClick {
network.cookieManager.removeAll()
activity?.toast(R.string.cookies_cleared)
}
}
preference {
titleRes = R.string.clear_database
summaryRes = R.string.clear_database_summary
@ -102,6 +102,20 @@ class SettingsAdvancedController : SettingsController() {
ctrl.showDialog(router)
}
}
preference {
titleRes = R.string.clean_up_downloaded_chapters
summaryRes = R.string.delete_unused_chapters
onClick {
val ctrl = CleanupDownloadsDialogController()
ctrl.targetController = this@SettingsAdvancedController
ctrl.showDialog(router)
}
}
}
preferenceCategory {
titleRes = R.string.library
preference {
titleRes = R.string.refresh_library_metadata
summaryRes = R.string.updates_covers_genres_desc
@ -114,15 +128,15 @@ class SettingsAdvancedController : SettingsController() {
onClick { LibraryUpdateService.start(context, target = Target.TRACKING) }
}
preference {
titleRes = R.string.clean_up_downloaded_chapters
}
summaryRes = R.string.delete_unused_chapters
preferenceCategory {
preference {
titleRes = R.string.clear_cookies
onClick {
val ctrl = CleanupDownloadsDialogController()
ctrl.targetController = this@SettingsAdvancedController
ctrl.showDialog(router)
network.cookieManager.removeAll()
activity?.toast(R.string.cookies_cleared)
}
}
@ -147,6 +161,7 @@ class SettingsAdvancedController : SettingsController() {
}
}
}
}
class CleanupDownloadsDialogController() : DialogController() {
override fun onCreateDialog(savedViewState: Bundle?): Dialog {

View File

@ -527,6 +527,7 @@
<!-- Advanced section -->
<string name="clear_chapter_cache">Clear chapter cache</string>
<string name="data_management">Data Management</string>
<string name="used_">Used: %1$s</string>
<plurals name="cache_cleared">
<item quantity="one">Cache cleared. %d file has been deleted</item>