From 92b17325a98e5e6e7e885c87a10ab5fe1634a146 Mon Sep 17 00:00:00 2001 From: jmir1 Date: Tue, 29 Jun 2021 19:15:53 +0200 Subject: [PATCH] fix animelib sorting --- .../java/eu/kanade/tachiyomi/Migrations.kt | 26 ------------------- .../data/preference/PreferenceKeys.kt | 5 ---- .../data/preference/PreferencesHelper.kt | 5 ---- .../ui/animelib/AnimelibSettingsSheet.kt | 8 +++--- .../tachiyomi/ui/animelib/AnimelibSort.kt | 17 ------------ 5 files changed, 4 insertions(+), 57 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSort.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 6ff19d8016..00a729bb0d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.data.updater.UpdaterJob import eu.kanade.tachiyomi.extension.AnimeExtensionUpdateJob import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE -import eu.kanade.tachiyomi.ui.animelib.AnimelibSort import eu.kanade.tachiyomi.ui.library.LibrarySort import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting @@ -242,39 +241,14 @@ object Migrations { else -> SortDirectionSetting.DESCENDING } - val oldSortingModeAnime = prefs.getInt(PreferenceKeys.animelibSortingMode, 0) - val oldSortingDirectionAnime = prefs.getBoolean(PreferenceKeys.animelibSortingDirection, true) - - @Suppress("DEPRECATION") - val newSortingModeAnime = when (oldSortingModeAnime) { - AnimelibSort.ALPHA -> SortModeSetting.ALPHABETICAL - AnimelibSort.LAST_READ -> SortModeSetting.LAST_READ - AnimelibSort.LAST_CHECKED -> SortModeSetting.LAST_CHECKED - AnimelibSort.UNREAD -> SortModeSetting.UNREAD - AnimelibSort.TOTAL -> SortModeSetting.TOTAL_CHAPTERS - AnimelibSort.LATEST_CHAPTER -> SortModeSetting.LATEST_CHAPTER - AnimelibSort.CHAPTER_FETCH_DATE -> SortModeSetting.DATE_FETCHED - AnimelibSort.DATE_ADDED -> SortModeSetting.DATE_ADDED - else -> SortModeSetting.ALPHABETICAL - } - - val newSortingDirectionAnime = when (oldSortingDirectionAnime) { - true -> SortDirectionSetting.ASCENDING - else -> SortDirectionSetting.DESCENDING - } - prefs.edit(commit = true) { remove(PreferenceKeys.librarySortingMode) remove(PreferenceKeys.librarySortingDirection) - remove(PreferenceKeys.animelibSortingMode) - remove(PreferenceKeys.animelibSortingDirection) } prefs.edit { putString(PreferenceKeys.librarySortingMode, newSortingMode.name) putString(PreferenceKeys.librarySortingDirection, newSortingDirection.name) - putString(PreferenceKeys.animelibSortingMode, newSortingModeAnime.name) - putString(PreferenceKeys.animelibSortingDirection, newSortingDirectionAnime.name) } } return true 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 5671c6aa9b..5b7aebb11d 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 @@ -166,9 +166,6 @@ object PreferenceKeys { const val librarySortingMode = "library_sorting_mode" const val librarySortingDirection = "library_sorting_ascending" - const val animelibSortingMode = "animelib_sorting_mode" - const val animelibSortingDirection = "animelib_sorting_ascending" - const val automaticExtUpdates = "automatic_ext_updates" const val showNsfwSource = "show_nsfw_source" @@ -202,8 +199,6 @@ object PreferenceKeys { const val libraryDisplayMode = "pref_display_mode_library" - const val animelibDisplayMode = "pref_display_mode_animelib" - const val lang = "app_language" const val dateFormat = "app_date_format" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 73d84c22a9..a5337c9e0f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -262,8 +262,6 @@ class PreferencesHelper(val context: Context) { fun libraryDisplayMode() = flowPrefs.getEnum(Keys.libraryDisplayMode, DisplayModeSetting.COMPACT_GRID) - fun animelibDisplayMode() = flowPrefs.getEnum(Keys.animelibDisplayMode, DisplayModeSetting.COMPACT_GRID) - fun downloadBadge() = flowPrefs.getBoolean(Keys.downloadBadge, false) fun localBadge() = flowPrefs.getBoolean(Keys.localBadge, true) @@ -291,9 +289,6 @@ class PreferencesHelper(val context: Context) { fun librarySortingMode() = flowPrefs.getEnum(Keys.librarySortingMode, SortModeSetting.ALPHABETICAL) fun librarySortingAscending() = flowPrefs.getEnum(Keys.librarySortingDirection, SortDirectionSetting.ASCENDING) - fun animelibSortingMode() = flowPrefs.getEnum(Keys.animelibSortingMode, SortModeSetting.ALPHABETICAL) - fun animelibSortingAscending() = flowPrefs.getEnum(Keys.animelibSortingDirection, SortDirectionSetting.ASCENDING) - fun automaticExtUpdates() = flowPrefs.getBoolean(Keys.automaticExtUpdates, true) fun showNsfwSource() = flowPrefs.getBoolean(Keys.showNsfwSource, true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSettingsSheet.kt index cfb288a423..7a4be81862 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSettingsSheet.kt @@ -250,7 +250,7 @@ class AnimelibSettingsSheet( db.insertCategory(currentCategory!!).executeAsBlocking() } else { - preferences.animelibSortingAscending().set(flag) + preferences.librarySortingAscending().set(flag) } } @@ -272,7 +272,7 @@ class AnimelibSettingsSheet( db.insertCategory(currentCategory!!).executeAsBlocking() } else { - preferences.animelibSortingMode().set(flag) + preferences.librarySortingMode().set(flag) } } } @@ -307,7 +307,7 @@ class AnimelibSettingsSheet( return if (preferences.categorisedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0) { DisplayModeSetting.fromFlag(currentCategory?.displayMode) } else { - preferences.animelibDisplayMode().get() + preferences.libraryDisplayMode().get() } } @@ -358,7 +358,7 @@ class AnimelibSettingsSheet( db.insertCategory(currentCategory!!).executeAsBlocking() } else { - preferences.animelibDisplayMode().set(flag) + preferences.libraryDisplayMode().set(flag) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSort.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSort.kt deleted file mode 100644 index a1bb88e8b5..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/animelib/AnimelibSort.kt +++ /dev/null @@ -1,17 +0,0 @@ -package eu.kanade.tachiyomi.ui.animelib - -@Deprecated("Deprecated in favor for SortModeSetting") -object AnimelibSort { - - const val ALPHA = 0 - const val LAST_READ = 1 - const val LAST_CHECKED = 2 - const val UNREAD = 3 - const val TOTAL = 4 - const val LATEST_CHAPTER = 6 - const val CHAPTER_FETCH_DATE = 8 - const val DATE_ADDED = 7 - - @Deprecated("Removed in favor of searching by source") - const val SOURCE = 5 -}