mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 07:39:10 +01:00
parent
652c935062
commit
443887c89a
@ -71,6 +71,8 @@ object PreferenceKeys {
|
|||||||
|
|
||||||
const val pageLayout = "page_layout"
|
const val pageLayout = "page_layout"
|
||||||
|
|
||||||
|
const val invertDoublePages = "invert_double_pages"
|
||||||
|
|
||||||
const val showNavigationOverlayNewUser = "reader_navigation_overlay_new_user"
|
const val showNavigationOverlayNewUser = "reader_navigation_overlay_new_user"
|
||||||
const val showNavigationOverlayNewUserWebtoon = "reader_navigation_overlay_new_user_webtoon"
|
const val showNavigationOverlayNewUserWebtoon = "reader_navigation_overlay_new_user_webtoon"
|
||||||
|
|
||||||
|
@ -154,6 +154,8 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun pageLayout() = flowPrefs.getInt(Keys.pageLayout, PageLayout.AUTOMATIC)
|
fun pageLayout() = flowPrefs.getInt(Keys.pageLayout, PageLayout.AUTOMATIC)
|
||||||
|
|
||||||
|
fun invertDoublePages() = flowPrefs.getBoolean(Keys.invertDoublePages, false)
|
||||||
|
|
||||||
fun showNavigationOverlayNewUser() = flowPrefs.getBoolean(Keys.showNavigationOverlayNewUser, true)
|
fun showNavigationOverlayNewUser() = flowPrefs.getBoolean(Keys.showNavigationOverlayNewUser, true)
|
||||||
|
|
||||||
fun showNavigationOverlayNewUserWebtoon() = flowPrefs.getBoolean(Keys.showNavigationOverlayNewUserWebtoon, true)
|
fun showNavigationOverlayNewUserWebtoon() = flowPrefs.getBoolean(Keys.showNavigationOverlayNewUserWebtoon, true)
|
||||||
|
@ -3,10 +3,12 @@ package eu.kanade.tachiyomi.ui.reader.settings
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.databinding.ReaderPagedLayoutBinding
|
import eu.kanade.tachiyomi.databinding.ReaderPagedLayoutBinding
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
|
||||||
import eu.kanade.tachiyomi.util.bindToPreference
|
import eu.kanade.tachiyomi.util.bindToPreference
|
||||||
import eu.kanade.tachiyomi.util.lang.addBetaTag
|
import eu.kanade.tachiyomi.util.lang.addBetaTag
|
||||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||||
@ -17,35 +19,45 @@ class ReaderPagedView @JvmOverloads constructor(context: Context, attrs: Attribu
|
|||||||
|
|
||||||
override fun inflateBinding() = ReaderPagedLayoutBinding.bind(this)
|
override fun inflateBinding() = ReaderPagedLayoutBinding.bind(this)
|
||||||
override fun initGeneralPreferences() {
|
override fun initGeneralPreferences() {
|
||||||
binding.scaleType.bindToPreference(preferences.imageScaleType(), 1) {
|
with(binding) {
|
||||||
|
scaleType.bindToPreference(preferences.imageScaleType(), 1) {
|
||||||
val mangaViewer = (context as? ReaderActivity)?.presenter?.getMangaViewer() ?: 0
|
val mangaViewer = (context as? ReaderActivity)?.presenter?.getMangaViewer() ?: 0
|
||||||
val isWebtoonView = mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS
|
val isWebtoonView =
|
||||||
|
mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS
|
||||||
updatePagedGroup(!isWebtoonView)
|
updatePagedGroup(!isWebtoonView)
|
||||||
}
|
}
|
||||||
binding.zoomStart.bindToPreference(preferences.zoomStart(), 1)
|
zoomStart.bindToPreference(preferences.zoomStart(), 1)
|
||||||
binding.cropBorders.bindToPreference(preferences.cropBorders())
|
cropBorders.bindToPreference(preferences.cropBorders())
|
||||||
binding.pageTransitions.bindToPreference(preferences.pageTransitions())
|
pageTransitions.bindToPreference(preferences.pageTransitions())
|
||||||
binding.pagerNav.bindToPreference(preferences.navigationModePager())
|
pagerNav.bindToPreference(preferences.navigationModePager())
|
||||||
binding.pagerInvert.bindToPreference(preferences.pagerNavInverted())
|
pagerInvert.bindToPreference(preferences.pagerNavInverted())
|
||||||
binding.extendPastCutout.bindToPreference(preferences.pagerCutoutBehavior())
|
extendPastCutout.bindToPreference(preferences.pagerCutoutBehavior())
|
||||||
binding.pageLayout.bindToPreference(preferences.pageLayout())
|
pageLayout.bindToPreference(preferences.pageLayout()) {
|
||||||
|
val mangaViewer = (context as? ReaderActivity)?.presenter?.getMangaViewer() ?: 0
|
||||||
|
val isWebtoonView =
|
||||||
|
mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS
|
||||||
|
updatePagedGroup(!isWebtoonView)
|
||||||
|
}
|
||||||
|
invertDoublePages.bindToPreference(preferences.invertDoublePages())
|
||||||
|
|
||||||
binding.pageLayout.title = binding.pageLayout.title.toString().addBetaTag(context)
|
pageLayout.title = pageLayout.title.toString().addBetaTag(context)
|
||||||
|
|
||||||
val mangaViewer = (context as? ReaderActivity)?.presenter?.getMangaViewer() ?: 0
|
val mangaViewer = (context as? ReaderActivity)?.presenter?.getMangaViewer() ?: 0
|
||||||
val isWebtoonView = mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS
|
val isWebtoonView =
|
||||||
|
mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS
|
||||||
val hasMargins = mangaViewer == ReaderActivity.VERTICAL_PLUS
|
val hasMargins = mangaViewer == ReaderActivity.VERTICAL_PLUS
|
||||||
binding.cropBordersWebtoon.bindToPreference(if (hasMargins) preferences.cropBorders() else preferences.cropBordersWebtoon())
|
cropBordersWebtoon.bindToPreference(if (hasMargins) preferences.cropBorders() else preferences.cropBordersWebtoon())
|
||||||
binding.webtoonSidePadding.bindToIntPreference(
|
webtoonSidePadding.bindToIntPreference(
|
||||||
preferences.webtoonSidePadding(),
|
preferences.webtoonSidePadding(),
|
||||||
R.array.webtoon_side_padding_values
|
R.array.webtoon_side_padding_values
|
||||||
)
|
)
|
||||||
binding.webtoonEnableZoomOut.bindToPreference(preferences.webtoonEnableZoomOut())
|
webtoonEnableZoomOut.bindToPreference(preferences.webtoonEnableZoomOut())
|
||||||
binding.webtoonNav.bindToPreference(preferences.navigationModeWebtoon())
|
webtoonNav.bindToPreference(preferences.navigationModeWebtoon())
|
||||||
binding.webtoonInvert.bindToPreference(preferences.webtoonNavInverted())
|
webtoonInvert.bindToPreference(preferences.webtoonNavInverted())
|
||||||
|
|
||||||
updatePagedGroup(!isWebtoonView)
|
updatePagedGroup(!isWebtoonView)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun updatePrefs() {
|
fun updatePrefs() {
|
||||||
val mangaViewer = activity.presenter.getMangaViewer()
|
val mangaViewer = activity.presenter.getMangaViewer()
|
||||||
@ -84,6 +96,7 @@ class ReaderPagedView @JvmOverloads constructor(context: Context, attrs: Attribu
|
|||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
binding.extendPastCutout.visibleIf(show && isFullFit && hasCutout)
|
binding.extendPastCutout.isVisible = show && isFullFit && hasCutout
|
||||||
|
binding.invertDoublePages.isVisible = show && preferences.pageLayout().get() != PageLayout.SINGLE_PAGE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,8 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var invertDoublePages = false
|
||||||
|
|
||||||
var autoDoublePages = preferences.pageLayout().get() == PageLayout.AUTOMATIC
|
var autoDoublePages = preferences.pageLayout().get() == PageLayout.AUTOMATIC
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -87,6 +89,9 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
|||||||
preferences.readerTheme()
|
preferences.readerTheme()
|
||||||
.register({ readerTheme = it }, { imagePropertyChangedListener?.invoke() })
|
.register({ readerTheme = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
|
||||||
|
preferences.invertDoublePages()
|
||||||
|
.register({ invertDoublePages = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
|
||||||
preferences.pageLayout()
|
preferences.pageLayout()
|
||||||
.asFlow()
|
.asFlow()
|
||||||
.drop(1)
|
.drop(1)
|
||||||
|
@ -689,7 +689,7 @@ class PagerPageHolder(
|
|||||||
val result = Bitmap.createBitmap(width + width2, max(height, height2), Bitmap.Config.ARGB_8888)
|
val result = Bitmap.createBitmap(width + width2, max(height, height2), Bitmap.Config.ARGB_8888)
|
||||||
val canvas = Canvas(result)
|
val canvas = Canvas(result)
|
||||||
canvas.drawColor(if (viewer.config.readerTheme >= 2 || viewer.config.readerTheme == 0) Color.WHITE else Color.BLACK)
|
canvas.drawColor(if (viewer.config.readerTheme >= 2 || viewer.config.readerTheme == 0) Color.WHITE else Color.BLACK)
|
||||||
val isLTR = viewer !is R2LPagerViewer
|
val isLTR = (viewer !is R2LPagerViewer).xor(viewer.config.invertDoublePages)
|
||||||
val upperPart = Rect(
|
val upperPart = Rect(
|
||||||
if (isLTR) 0 else width2,
|
if (isLTR) 0 else width2,
|
||||||
(maxHeight - imageBitmap.height) / 2,
|
(maxHeight - imageBitmap.height) / 2,
|
||||||
|
@ -244,6 +244,11 @@ class SettingsReaderController : SettingsController() {
|
|||||||
infoPreference(R.string.automatic_can_still_switch).apply {
|
infoPreference(R.string.automatic_can_still_switch).apply {
|
||||||
preferences.pageLayout().asImmediateFlow { isVisible = it == PageLayout.AUTOMATIC }.launchIn(viewScope)
|
preferences.pageLayout().asImmediateFlow { isVisible = it == PageLayout.AUTOMATIC }.launchIn(viewScope)
|
||||||
}
|
}
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.invertDoublePages
|
||||||
|
titleRes = R.string.invert_double_pages
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.webtoon
|
titleRes = R.string.webtoon
|
||||||
|
@ -64,6 +64,14 @@
|
|||||||
app:title="@string/zoom_start_position"
|
app:title="@string/zoom_start_position"
|
||||||
android:entries="@array/zoom_start" />
|
android:entries="@array/zoom_start" />
|
||||||
|
|
||||||
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
android:id="@+id/invert_double_pages"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="@string/invert_double_pages"
|
||||||
|
android:textColor="?android:attr/textColorPrimary" />
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/crop_borders"
|
android:id="@+id/crop_borders"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -322,6 +322,7 @@
|
|||||||
<string name="amount_of_pages_to_preload">The amount of pages to preload when reading. Higher values will result in a smoother reading experience, at the cost of higher cache and network usage.</string>
|
<string name="amount_of_pages_to_preload">The amount of pages to preload when reading. Higher values will result in a smoother reading experience, at the cost of higher cache and network usage.</string>
|
||||||
<string name="reduces_banding_impacts_performance">Reduces banding, but impacts
|
<string name="reduces_banding_impacts_performance">Reduces banding, but impacts
|
||||||
performance</string>
|
performance</string>
|
||||||
|
<string name="invert_double_pages">Invert double pages</string>
|
||||||
<string name="crop_borders">Crop borders</string>
|
<string name="crop_borders">Crop borders</string>
|
||||||
<string name="use_custom_brightness">Use custom brightness</string>
|
<string name="use_custom_brightness">Use custom brightness</string>
|
||||||
<string name="use_custom_color_filter">Use custom color filter</string>
|
<string name="use_custom_color_filter">Use custom color filter</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user