mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 02:34:39 +00:00
feat(reader): Debug mode
This commit is contained in:
parent
b1f2c30892
commit
d25a857b7a
7 changed files with 29 additions and 4 deletions
|
@ -185,6 +185,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
|||
data: Any,
|
||||
config: Config,
|
||||
) = (pageView as? SubsamplingScaleImageView)?.apply {
|
||||
setDebug(config.debugMode)
|
||||
setDoubleTapZoomDuration(config.zoomDuration.getSystemScaledDuration())
|
||||
setMinimumScaleType(config.minimumScaleType)
|
||||
setMinimumDpi(1) // Just so that very small image will be fit for initial load
|
||||
|
@ -249,7 +250,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
|||
isVisible = true
|
||||
},
|
||||
onError = {
|
||||
this@ReaderPageImageView.onImageLoadError()
|
||||
onImageLoadError()
|
||||
},
|
||||
)
|
||||
.size(ViewSizeResolver(this@ReaderPageImageView))
|
||||
|
@ -349,6 +350,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
|||
val landscapeZoom: Boolean = false,
|
||||
val insetInfo: InsetInfo? = null,
|
||||
val hingeGapSize: Int = 0,
|
||||
val debugMode: Boolean = false,
|
||||
)
|
||||
|
||||
data class InsetInfo(
|
||||
|
|
|
@ -4,11 +4,18 @@ import eu.kanade.tachiyomi.core.preference.Preference
|
|||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.changesIn
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import yokai.domain.ui.settings.ReaderPreferences
|
||||
|
||||
/**
|
||||
* Common configuration for all viewers.
|
||||
*/
|
||||
abstract class ViewerConfig(preferences: PreferencesHelper, protected val scope: CoroutineScope) {
|
||||
abstract class ViewerConfig(
|
||||
preferences: PreferencesHelper,
|
||||
protected val scope: CoroutineScope,
|
||||
readerPreferences: ReaderPreferences = Injekt.get(),
|
||||
) {
|
||||
|
||||
var imagePropertyChangedListener: (() -> Unit)? = null
|
||||
var reloadChapterListener: ((Boolean) -> Unit)? = null
|
||||
|
@ -27,6 +34,8 @@ abstract class ViewerConfig(preferences: PreferencesHelper, protected val scope:
|
|||
var navigationMode = 0
|
||||
protected set
|
||||
|
||||
var debugMode = false
|
||||
|
||||
abstract var navigator: ViewerNavigation
|
||||
protected set
|
||||
|
||||
|
@ -45,6 +54,9 @@ abstract class ViewerConfig(preferences: PreferencesHelper, protected val scope:
|
|||
|
||||
preferences.alwaysShowChapterTransition()
|
||||
.register({ alwaysShowChapterTransition = it })
|
||||
|
||||
readerPreferences.debugMode()
|
||||
.register({ debugMode = it })
|
||||
}
|
||||
|
||||
fun <T> Preference<T>.register(
|
||||
|
|
|
@ -534,6 +534,7 @@ class PagerPageHolder(
|
|||
insets = viewer.activity.window.decorView.rootWindowInsets,
|
||||
),
|
||||
hingeGapSize = viewer.config.hingeGapSize,
|
||||
debugMode = viewer.config.debugMode,
|
||||
)
|
||||
|
||||
private suspend fun setBG(stream: InputStream): Drawable {
|
||||
|
|
|
@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView
|
|||
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
|
||||
import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.e
|
||||
import eu.kanade.tachiyomi.util.system.launchIO
|
||||
import eu.kanade.tachiyomi.util.system.withIOContext
|
||||
import eu.kanade.tachiyomi.util.system.withUIContext
|
||||
|
@ -198,6 +197,7 @@ class WebtoonPageHolder(
|
|||
cropBorders = viewer.config.run {
|
||||
if (viewer.hasMargins) { verticalCropBorders } else { webtoonCropBorders }
|
||||
},
|
||||
debugMode = viewer.config.debugMode,
|
||||
),
|
||||
)
|
||||
removeErrorLayout()
|
||||
|
|
|
@ -59,7 +59,6 @@ import eu.kanade.tachiyomi.ui.setting.switchPreference
|
|||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||
import eu.kanade.tachiyomi.util.system.GLUtil
|
||||
import eu.kanade.tachiyomi.util.system.disableItems
|
||||
import eu.kanade.tachiyomi.util.system.e
|
||||
import eu.kanade.tachiyomi.util.system.isPackageInstalled
|
||||
import eu.kanade.tachiyomi.util.system.launchIO
|
||||
import eu.kanade.tachiyomi.util.system.launchUI
|
||||
|
@ -89,6 +88,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
import yokai.domain.base.BasePreferences.ExtensionInstaller
|
||||
import yokai.domain.extension.interactor.TrustExtension
|
||||
import yokai.domain.manga.interactor.GetManga
|
||||
import yokai.domain.ui.settings.ReaderPreferences
|
||||
import yokai.i18n.MR
|
||||
import yokai.util.lang.getString
|
||||
import android.R as AR
|
||||
|
@ -99,6 +99,7 @@ class SettingsAdvancedController : SettingsLegacyController() {
|
|||
|
||||
private val network: NetworkHelper by injectLazy()
|
||||
private val networkPreferences: NetworkPreferences by injectLazy()
|
||||
private val readerPreferences: ReaderPreferences by injectLazy()
|
||||
|
||||
private val db: DatabaseHelper by injectLazy()
|
||||
|
||||
|
@ -424,6 +425,11 @@ class SettingsAdvancedController : SettingsLegacyController() {
|
|||
if (actualPath.isNotEmpty()) summary = actualPath
|
||||
}
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(readerPreferences.debugMode())
|
||||
titleRes = MR.strings.pref_reader_debug_mode
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package yokai.domain.ui.settings
|
||||
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.preference.getEnum
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
|
@ -45,4 +46,6 @@ class ReaderPreferences(private val preferenceStore: PreferenceStore) {
|
|||
}
|
||||
|
||||
fun webtoonDoubleTapZoomEnabled() = preferenceStore.getBoolean("pref_enable_double_tap_zoom_webtoon", true)
|
||||
|
||||
fun debugMode() = preferenceStore.getBoolean("pref_enable_reader_debug_mode", BuildConfig.DEBUG)
|
||||
}
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
<string name="crash_log_saved">Crash logs saved</string>
|
||||
<string name="pref_verbose_logging">Verbose logging</string>
|
||||
<string name="pref_verbose_logging_summary">Print verbose logs to system log (may reduces app performance)</string>
|
||||
<string name="pref_reader_debug_mode">Debug mode</string>
|
||||
<string name="network">Network</string>
|
||||
<string name="doh">DNS over HTTPS</string>
|
||||
<string name="user_agent_string">Default user agent string</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue