mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 00:01:54 +01:00
Remove insert page when dual page split get turned off (#4739)
This commit is contained in:
parent
0437703cbf
commit
bdbdf211e2
@ -20,6 +20,8 @@ class PagerConfig(
|
|||||||
preferences: PreferencesHelper = Injekt.get()
|
preferences: PreferencesHelper = Injekt.get()
|
||||||
) : ViewerConfig(preferences, scope) {
|
) : ViewerConfig(preferences, scope) {
|
||||||
|
|
||||||
|
var dualPageSplitChangedListener: ((Boolean) -> Unit)? = null
|
||||||
|
|
||||||
var imageScaleType = 1
|
var imageScaleType = 1
|
||||||
private set
|
private set
|
||||||
|
|
||||||
@ -52,7 +54,13 @@ class PagerConfig(
|
|||||||
)
|
)
|
||||||
|
|
||||||
preferences.dualPageSplitPaged()
|
preferences.dualPageSplitPaged()
|
||||||
.register({ dualPageSplit = it }, { imagePropertyChangedListener?.invoke() })
|
.register(
|
||||||
|
{ dualPageSplit = it },
|
||||||
|
{
|
||||||
|
imagePropertyChangedListener?.invoke()
|
||||||
|
dualPageSplitChangedListener?.invoke(it)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
preferences.dualPageInvertPaged()
|
preferences.dualPageInvertPaged()
|
||||||
.register({ dualPageInvert = it }, { imagePropertyChangedListener?.invoke() })
|
.register({ dualPageInvert = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
@ -116,6 +116,12 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.dualPageSplitChangedListener = { enabled ->
|
||||||
|
if (!enabled) {
|
||||||
|
cleanupPageSplit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
config.imagePropertyChangedListener = {
|
config.imagePropertyChangedListener = {
|
||||||
refreshAdapter()
|
refreshAdapter()
|
||||||
}
|
}
|
||||||
@ -381,4 +387,8 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
fun onPageSplit(currentPage: ReaderPage, newPage: InsertPage) {
|
fun onPageSplit(currentPage: ReaderPage, newPage: InsertPage) {
|
||||||
adapter.onPageSplit(currentPage, newPage, this::class.java)
|
adapter.onPageSplit(currentPage, newPage, this::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun cleanupPageSplit() {
|
||||||
|
adapter.cleanupPageSplit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,4 +151,10 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
|
|||||||
|
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun cleanupPageSplit() {
|
||||||
|
val insertPages = items.filterIsInstance(InsertPage::class.java)
|
||||||
|
items.removeAll(insertPages)
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user