From d37341d7d09021cf2ab10f58ad57e0bc700362d6 Mon Sep 17 00:00:00 2001 From: mpm11011 Date: Sat, 5 Sep 2020 16:20:45 -0400 Subject: [PATCH] Inlined non-reused key strings. --- .../data/preference/PreferenceKeys.kt | 42 ------------------- .../tachiyomi/ui/more/AboutController.kt | 21 +++++----- .../ui/setting/SettingsAdvancedController.kt | 10 ++--- .../ui/setting/SettingsBackupController.kt | 4 +- .../ui/setting/SettingsGeneralController.kt | 2 +- .../ui/setting/SettingsLibraryController.kt | 4 +- 6 files changed, 20 insertions(+), 63 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 410df4b2c..2c7f66dcf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -165,48 +165,6 @@ object PreferenceKeys { const val enableDoh = "enable_doh" - const val disableBatteryOptimization = "pref_disable_battery_optimization" - - const val clearDatabase = "pref_clear_database" - - const val clearCookies = "pref_clear_cookies" - - const val refreshLibraryCovers = "pref_refresh_library_covers" - - const val refreshLibraryTracking = "pref_refresh_library_tracking" - - const val createBackup = "pref_create_backup" - - const val restoreBackup = "pref_restore_backup" - - const val manageNotifications = "pref_manage_notifications" - - const val libraryColumns = "pref_library_columns" - - const val actionEditCategories = "pref_action_edit_categories" - - const val parentalControlsInfo = "pref_parental_controls_info" - - const val aboutVersion = "pref_about_version" - - const val aboutBuildTime = "pref_about_build_time" - - const val aboutCheckForUpdates = "pref_about_check_for_updates" - - const val aboutWhatsNew = "pref_about_whats_new" - - const val aboutNotices = "pref_about_notices" - - const val aboutWebsite = "pref_about_website" - - const val aboutDiscord = "pref_about_discord" - - const val aboutGitHub = "pref_about_github" - - const val aboutLabelExtensions = "pref_about_label_extensions" - - const val aboutLicenses = "pref_about_licenses" - fun trackUsername(syncId: Int) = "pref_mangasync_username_$syncId" fun trackPassword(syncId: Int) = "pref_mangasync_password_$syncId" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index 2c3fb84ad..f33aad5dc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -10,7 +10,6 @@ import com.afollestad.materialdialogs.MaterialDialog import com.mikepenz.aboutlibraries.LibsBuilder import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.updater.UpdateChecker import eu.kanade.tachiyomi.data.updater.UpdateResult import eu.kanade.tachiyomi.data.updater.UpdaterService @@ -46,7 +45,7 @@ class AboutController : SettingsController() { titleRes = R.string.pref_category_about preference { - key = Keys.aboutVersion + key = "pref_about_version" titleRes = R.string.version summary = if (BuildConfig.DEBUG) { "Preview r${BuildConfig.COMMIT_COUNT} (${BuildConfig.COMMIT_SHA})" @@ -57,20 +56,20 @@ class AboutController : SettingsController() { onClick { copyDebugInfo() } } preference { - key = Keys.aboutBuildTime + key = "pref_about_build_time" titleRes = R.string.build_time summary = getFormattedBuildTime() } if (isUpdaterEnabled) { preference { - key = Keys.aboutCheckForUpdates + key = "pref_about_check_for_updates" titleRes = R.string.check_for_updates onClick { checkVersion() } } } preference { - key = Keys.aboutWhatsNew + key = "pref_about_whats_new" titleRes = R.string.whats_new onClick { @@ -86,7 +85,7 @@ class AboutController : SettingsController() { } if (BuildConfig.DEBUG) { preference { - key = Keys.aboutNotices + key = "pref_about_notices" titleRes = R.string.notices onClick { @@ -100,7 +99,7 @@ class AboutController : SettingsController() { titleRes = R.string.about_resources preference { - key = Keys.aboutWebsite + key = "pref_about_website" titleRes = R.string.website val url = "https://tachiyomi.org" summary = url @@ -110,7 +109,7 @@ class AboutController : SettingsController() { } } preference { - key = Keys.aboutDiscord + key = "pref_about_discord" title = "Discord" val url = "https://discord.gg/tachiyomi" summary = url @@ -120,7 +119,7 @@ class AboutController : SettingsController() { } } preference { - key = Keys.aboutGitHub + key = "pref_about_github" title = "GitHub" val url = "https://github.com/inorichi/tachiyomi" summary = url @@ -130,7 +129,7 @@ class AboutController : SettingsController() { } } preference { - key = Keys.aboutLabelExtensions + key = "pref_about_label_extensions" titleRes = R.string.label_extensions val url = "https://github.com/inorichi/tachiyomi-extensions" summary = url @@ -140,7 +139,7 @@ class AboutController : SettingsController() { } } preference { - key = Keys.aboutLicenses + key = "pref_about_licenses" titleRes = R.string.licenses onClick { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt index 1b06065fc..87b114268 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt @@ -51,7 +51,7 @@ class SettingsAdvancedController : SettingsController() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { preference { - key = Keys.disableBatteryOptimization + key = "pref_disable_battery_optimization" titleRes = R.string.pref_disable_battery_optimization summaryRes = R.string.pref_disable_battery_optimization_summary @@ -85,7 +85,7 @@ class SettingsAdvancedController : SettingsController() { onClick { clearChapterCache() } } preference { - key = Keys.clearDatabase + key = "pref_clear_database" titleRes = R.string.pref_clear_database summaryRes = R.string.pref_clear_database_summary @@ -101,7 +101,7 @@ class SettingsAdvancedController : SettingsController() { titleRes = R.string.label_network preference { - key = Keys.clearCookies + key = "pref_clear_cookies" titleRes = R.string.pref_clear_cookies onClick { @@ -121,13 +121,13 @@ class SettingsAdvancedController : SettingsController() { titleRes = R.string.label_library preference { - key = Keys.refreshLibraryCovers + key = "pref_refresh_library_covers" titleRes = R.string.pref_refresh_library_covers onClick { LibraryUpdateService.start(context, target = Target.COVERS) } } preference { - key = Keys.refreshLibraryTracking + key = "pref_refresh_library_tracking" titleRes = R.string.pref_refresh_library_tracking summaryRes = R.string.pref_refresh_library_tracking_summary diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt index d9ca82cb6..459384fdb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt @@ -53,7 +53,7 @@ class SettingsBackupController : SettingsController() { titleRes = R.string.backup preference { - key = Keys.createBackup + key = "pref_create_backup" titleRes = R.string.pref_create_backup summaryRes = R.string.pref_create_backup_summ @@ -68,7 +68,7 @@ class SettingsBackupController : SettingsController() { } } preference { - key = Keys.restoreBackup + key = "pref_restore_backup" titleRes = R.string.pref_restore_backup summaryRes = R.string.pref_restore_backup_summ diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index fbe106e2c..b28d74af2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -47,7 +47,7 @@ class SettingsGeneralController : SettingsController() { } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { preference { - key = Keys.manageNotifications + key = "pref_manage_notifications" titleRes = R.string.pref_manage_notifications onClick { val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index f4dd9869c..4d83eaf83 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -50,7 +50,7 @@ class SettingsLibraryController : SettingsController() { titleRes = R.string.pref_category_display preference { - key = Keys.libraryColumns + key = "pref_library_columns" titleRes = R.string.pref_library_columns onClick { LibraryColumnsDialog().showDialog(router) @@ -84,7 +84,7 @@ class SettingsLibraryController : SettingsController() { titleRes = R.string.pref_category_library_categories preference { - key = Keys.actionEditCategories + key = "pref_action_edit_categories" titleRes = R.string.action_edit_categories val catCount = dbCategories.size