Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Crop borders for webtoons. Closes #904

Cette révision appartient à :
len 2017-07-26 20:35:31 +02:00
Parent d3cbfbdb59
révision aa46c52eee
2 fichiers modifiés avec 20 ajouts et 5 suppressions

Voir le fichier

@ -63,6 +63,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
setMinimumTileDpi(180)
setRegionDecoderClass(webtoonReader.regionDecoderClass)
setBitmapDecoderClass(webtoonReader.bitmapDecoderClass)
setCropBorders(webtoonReader.cropBorders)
setVerticalScrollingParent(true)
setOnTouchListener(adapter.touchListener)
setOnLongClickListener { webtoonReader.onLongClick(page) }

Voir le fichier

@ -53,6 +53,12 @@ class WebtoonReader : BaseReader() {
lateinit var layoutManager: PreCachingLayoutManager
private set
/**
* Whether to crop image borders.
*/
var cropBorders: Boolean = false
private set
/**
* Gesture detector for image touch events.
*/
@ -109,16 +115,24 @@ class WebtoonReader : BaseReader() {
.doOnNext { setDecoderClass(it) }
.skip(1)
.distinctUntilChanged()
.subscribe {
val activePage = layoutManager.findFirstVisibleItemPosition()
recycler.adapter = adapter
setActivePage(activePage)
})
.subscribe { refreshAdapter() })
subscriptions.add(readerActivity.preferences.cropBorders()
.asObservable()
.doOnNext { cropBorders = it }
.skip(1)
.distinctUntilChanged()
.subscribe { refreshAdapter() })
setPagesOnAdapter()
return recycler
}
fun refreshAdapter() {
val activePage = layoutManager.findFirstVisibleItemPosition()
recycler.adapter = adapter
setActivePage(activePage)
}
/**
* Uses two ways to scroll to the last page read.