mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 02:21:51 +01:00
Crop borders for continous viewer now uses the same pref as paged
also renamed the webtoon continous variable because it confused me
This commit is contained in:
parent
e0f639c801
commit
3eb1cc1f17
@ -441,7 +441,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
RIGHT_TO_LEFT -> R2LPagerViewer(this)
|
RIGHT_TO_LEFT -> R2LPagerViewer(this)
|
||||||
VERTICAL -> VerticalPagerViewer(this)
|
VERTICAL -> VerticalPagerViewer(this)
|
||||||
WEBTOON -> WebtoonViewer(this)
|
WEBTOON -> WebtoonViewer(this)
|
||||||
VERTICAL_PLUS -> WebtoonViewer(this, isContinuous = false)
|
VERTICAL_PLUS -> WebtoonViewer(this, hasMargins = true)
|
||||||
else -> L2RPagerViewer(this)
|
else -> L2RPagerViewer(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +87,9 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
|
|||||||
|
|
||||||
initGeneralPreferences()
|
initGeneralPreferences()
|
||||||
|
|
||||||
when (activity.viewer) {
|
when (val view = activity.viewer) {
|
||||||
is PagerViewer -> initPagerPreferences()
|
is PagerViewer -> initPagerPreferences()
|
||||||
is WebtoonViewer -> initWebtoonPreferences()
|
is WebtoonViewer -> initWebtoonPreferences(view.hasMargins)
|
||||||
}
|
}
|
||||||
|
|
||||||
setBottomEdge(constraint_layout, activity)
|
setBottomEdge(constraint_layout, activity)
|
||||||
@ -115,7 +115,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
|
|||||||
|
|
||||||
val mangaViewer = activity.presenter.getMangaViewer()
|
val mangaViewer = activity.presenter.getMangaViewer()
|
||||||
if (mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS) {
|
if (mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS) {
|
||||||
initWebtoonPreferences()
|
initWebtoonPreferences(mangaViewer == ReaderActivity.VERTICAL_PLUS)
|
||||||
} else {
|
} else {
|
||||||
initPagerPreferences()
|
initPagerPreferences()
|
||||||
}
|
}
|
||||||
@ -145,10 +145,10 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
|
|||||||
/**
|
/**
|
||||||
* Init the preferences for the webtoon reader.
|
* Init the preferences for the webtoon reader.
|
||||||
*/
|
*/
|
||||||
private fun initWebtoonPreferences() {
|
private fun initWebtoonPreferences(hasMargins: Boolean) {
|
||||||
webtoon_prefs_group.visible()
|
webtoon_prefs_group.visible()
|
||||||
pager_prefs_group.gone()
|
pager_prefs_group.gone()
|
||||||
crop_borders_webtoon.bindToPreference(preferences.cropBordersWebtoon())
|
crop_borders_webtoon.bindToPreference(if (hasMargins) preferences.cropBorders() else preferences.cropBordersWebtoon())
|
||||||
webtoon_side_padding.bindToIntPreference(preferences.webtoonSidePadding(), R.array.webtoon_side_padding_values)
|
webtoon_side_padding.bindToIntPreference(preferences.webtoonSidePadding(), R.array.webtoon_side_padding_values)
|
||||||
webtoon_disable_zoom.bindToPreference(preferences.webtoonDisableZoom())
|
webtoon_disable_zoom.bindToPreference(preferences.webtoonDisableZoom())
|
||||||
}
|
}
|
||||||
@ -157,6 +157,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
|
|||||||
* Binds a checkbox or switch view with a boolean preference.
|
* Binds a checkbox or switch view with a boolean preference.
|
||||||
*/
|
*/
|
||||||
private fun CompoundButton.bindToPreference(pref: Preference<Boolean>) {
|
private fun CompoundButton.bindToPreference(pref: Preference<Boolean>) {
|
||||||
|
setOnCheckedChangeListener(null)
|
||||||
isChecked = pref.get()
|
isChecked = pref.get()
|
||||||
setOnCheckedChangeListener { _, isChecked -> pref.set(isChecked) }
|
setOnCheckedChangeListener { _, isChecked -> pref.set(isChecked) }
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,10 @@ import uy.kohesive.injekt.api.get
|
|||||||
*/
|
*/
|
||||||
class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) : ViewerConfig(preferences) {
|
class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) : ViewerConfig(preferences) {
|
||||||
|
|
||||||
var imageCropBorders = false
|
var webtoonCropBorders = false
|
||||||
|
private set
|
||||||
|
|
||||||
|
var verticalCropBorders = false
|
||||||
private set
|
private set
|
||||||
|
|
||||||
var sidePadding = 0
|
var sidePadding = 0
|
||||||
@ -22,7 +25,10 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) : ViewerConfi
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
preferences.cropBordersWebtoon()
|
preferences.cropBordersWebtoon()
|
||||||
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
.register({ webtoonCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
|
||||||
|
preferences.cropBorders()
|
||||||
|
.register({ verticalCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
|
||||||
preferences.webtoonSidePadding()
|
preferences.webtoonSidePadding()
|
||||||
.register({ sidePadding = it }, { imagePropertyChangedListener?.invoke() })
|
.register({ sidePadding = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
@ -127,7 +127,7 @@ class WebtoonPageHolder(
|
|||||||
marginEnd = margin.toInt()
|
marginEnd = margin.toInt()
|
||||||
marginStart = margin.toInt()
|
marginStart = margin.toInt()
|
||||||
}
|
}
|
||||||
if (!viewer.isContinuous) {
|
if (viewer.hasMargins) {
|
||||||
frame.updatePaddingRelative(bottom = 15.dpToPx)
|
frame.updatePaddingRelative(bottom = 15.dpToPx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,7 +359,7 @@ class WebtoonPageHolder(
|
|||||||
setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH)
|
setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH)
|
||||||
setMinimumDpi(90)
|
setMinimumDpi(90)
|
||||||
setMinimumTileDpi(180)
|
setMinimumTileDpi(180)
|
||||||
setCropBorders(config.imageCropBorders)
|
setCropBorders(if (viewer.hasMargins) config.verticalCropBorders else config.webtoonCropBorders)
|
||||||
setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
|
setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
|
||||||
override fun onReady() {
|
override fun onReady() {
|
||||||
onImageDecoded()
|
onImageDecoded()
|
||||||
|
@ -22,7 +22,7 @@ import kotlin.math.min
|
|||||||
/**
|
/**
|
||||||
* Implementation of a [BaseViewer] to display pages with a [RecyclerView].
|
* Implementation of a [BaseViewer] to display pages with a [RecyclerView].
|
||||||
*/
|
*/
|
||||||
class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = true) : BaseViewer {
|
class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = false) : BaseViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recycler view used by this viewer.
|
* Recycler view used by this viewer.
|
||||||
|
@ -280,7 +280,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:constraint_referenced_ids="pager_prefs,scale_type,scale_type_text,
|
app:constraint_referenced_ids="pager_prefs,scale_type,scale_type_text,
|
||||||
zoom_start_text,zoom_start,crop_borders,page_transitions,background_color,background_color_label"
|
zoom_start_text,zoom_start,crop_borders,page_transitions,background_color,background_color_label,background_color_label,background_color"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Group
|
<androidx.constraintlayout.widget.Group
|
||||||
|
Loading…
Reference in New Issue
Block a user