From 42bc2b07ce1f0b4cfbfe3045cddc9c1fcca8f519 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 23 Jun 2023 22:39:59 -0400 Subject: [PATCH] Minor cleanup --- .../settings/screen/SettingsReaderScreen.kt | 10 +++--- .../tachiyomi/data/cache/ChapterCache.kt | 31 +++++++------------ .../main/res/layout/reader_pager_settings.xml | 18 +++++------ i18n/src/main/res/values/strings.xml | 2 +- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt index 577b9c8597..f069708654 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt @@ -190,11 +190,6 @@ object SettingsReaderScreen : SearchableSettings { 6 to stringResource(R.string.scale_type_smart_fit), ), ), - Preference.PreferenceItem.SwitchPreference( - pref = readerPreferences.landscapeZoom(), - title = stringResource(R.string.pref_landscape_zoom), - enabled = imageScaleType == 1, - ), Preference.PreferenceItem.ListPreference( pref = readerPreferences.zoomStart(), title = stringResource(R.string.pref_zoom_start), @@ -210,6 +205,11 @@ object SettingsReaderScreen : SearchableSettings { pref = readerPreferences.cropBorders(), title = stringResource(R.string.pref_crop_borders), ), + Preference.PreferenceItem.SwitchPreference( + pref = readerPreferences.landscapeZoom(), + title = stringResource(R.string.pref_landscape_zoom), + enabled = imageScaleType == 1, + ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.navigateToPan(), title = stringResource(R.string.pref_navigate_pan), diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt index 37b7261fdb..f05be6bc07 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt @@ -24,29 +24,14 @@ import java.io.IOException * The files are in format *md5key*.0 * * @param context the application context. - * @constructor creates an instance of the chapter cache. */ class ChapterCache(private val context: Context) { - companion object { - /** Name of cache directory. */ - const val PARAMETER_CACHE_DIRECTORY = "chapter_disk_cache" - - /** Application cache version. */ - const val PARAMETER_APP_VERSION = 1 - - /** The number of values per cache entry. Must be positive. */ - const val PARAMETER_VALUE_COUNT = 1 - - /** The maximum number of bytes this cache should use to store. */ - const val PARAMETER_CACHE_SIZE = 100L * 1024 * 1024 - } - private val json: Json by injectLazy() - /** Cache class used for cache management. */ + /** Cache class used for cache management. */ private val diskCache = DiskLruCache.open( - File(context.cacheDir, PARAMETER_CACHE_DIRECTORY), + File(context.cacheDir, "chapter_disk_cache"), PARAMETER_APP_VERSION, PARAMETER_VALUE_COUNT, PARAMETER_CACHE_SIZE, @@ -55,8 +40,7 @@ class ChapterCache(private val context: Context) { /** * Returns directory of cache. */ - private val cacheDir: File - get() = diskCache.directory + private val cacheDir: File = diskCache.directory /** * Returns real size of directory. @@ -210,3 +194,12 @@ class ChapterCache(private val context: Context) { return "${chapter.mangaId}${chapter.url}" } } + +/** Application cache version. */ +private const val PARAMETER_APP_VERSION = 1 + +/** The number of values per cache entry. Must be positive. */ +private const val PARAMETER_VALUE_COUNT = 1 + +/** The maximum number of bytes this cache should use to store. */ +private const val PARAMETER_CACHE_SIZE = 100L * 1024 * 1024 diff --git a/app/src/main/res/layout/reader_pager_settings.xml b/app/src/main/res/layout/reader_pager_settings.xml index 0cbc9c70e7..c48c467296 100644 --- a/app/src/main/res/layout/reader_pager_settings.xml +++ b/app/src/main/res/layout/reader_pager_settings.xml @@ -37,15 +37,6 @@ android:entries="@array/image_scale_type" app:title="@string/pref_image_scale_type" /> - - + + Original size Smart fit Pan wide images - Zoom landscape image + Automatically zoom into wide images Zoom start position Automatic Left