Minor cleanup

This commit is contained in:
arkon 2023-06-23 22:39:59 -04:00
parent e2d6269a38
commit 42bc2b07ce
4 changed files with 27 additions and 34 deletions

View file

@ -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),

View file

@ -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

View file

@ -37,15 +37,6 @@
android:entries="@array/image_scale_type"
app:title="@string/pref_image_scale_type" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/landscape_zoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:text="@string/pref_landscape_zoom"
android:textColor="?android:attr/textColorSecondary" />
<eu.kanade.tachiyomi.widget.MaterialSpinnerView
android:id="@+id/zoom_start"
android:layout_width="match_parent"
@ -62,6 +53,15 @@
android:text="@string/pref_crop_borders"
android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/landscape_zoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:text="@string/pref_landscape_zoom"
android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/navigate_pan"
android:layout_width="match_parent"

View file

@ -408,7 +408,7 @@
<string name="scale_type_original_size">Original size</string>
<string name="scale_type_smart_fit">Smart fit</string>
<string name="pref_navigate_pan">Pan wide images</string>
<string name="pref_landscape_zoom">Zoom landscape image</string>
<string name="pref_landscape_zoom">Automatically zoom into wide images</string>
<string name="pref_zoom_start">Zoom start position</string>
<string name="zoom_start_automatic">Automatic</string>
<string name="zoom_start_left">Left</string>