mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
Crop borders for webtoons. Closes #904
This commit is contained in:
parent
d3cbfbdb59
commit
aa46c52eee
@ -63,6 +63,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
|
|||||||
setMinimumTileDpi(180)
|
setMinimumTileDpi(180)
|
||||||
setRegionDecoderClass(webtoonReader.regionDecoderClass)
|
setRegionDecoderClass(webtoonReader.regionDecoderClass)
|
||||||
setBitmapDecoderClass(webtoonReader.bitmapDecoderClass)
|
setBitmapDecoderClass(webtoonReader.bitmapDecoderClass)
|
||||||
|
setCropBorders(webtoonReader.cropBorders)
|
||||||
setVerticalScrollingParent(true)
|
setVerticalScrollingParent(true)
|
||||||
setOnTouchListener(adapter.touchListener)
|
setOnTouchListener(adapter.touchListener)
|
||||||
setOnLongClickListener { webtoonReader.onLongClick(page) }
|
setOnLongClickListener { webtoonReader.onLongClick(page) }
|
||||||
|
@ -53,6 +53,12 @@ class WebtoonReader : BaseReader() {
|
|||||||
lateinit var layoutManager: PreCachingLayoutManager
|
lateinit var layoutManager: PreCachingLayoutManager
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to crop image borders.
|
||||||
|
*/
|
||||||
|
var cropBorders: Boolean = false
|
||||||
|
private set
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gesture detector for image touch events.
|
* Gesture detector for image touch events.
|
||||||
*/
|
*/
|
||||||
@ -109,16 +115,24 @@ class WebtoonReader : BaseReader() {
|
|||||||
.doOnNext { setDecoderClass(it) }
|
.doOnNext { setDecoderClass(it) }
|
||||||
.skip(1)
|
.skip(1)
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.subscribe {
|
.subscribe { refreshAdapter() })
|
||||||
val activePage = layoutManager.findFirstVisibleItemPosition()
|
|
||||||
recycler.adapter = adapter
|
subscriptions.add(readerActivity.preferences.cropBorders()
|
||||||
setActivePage(activePage)
|
.asObservable()
|
||||||
})
|
.doOnNext { cropBorders = it }
|
||||||
|
.skip(1)
|
||||||
|
.distinctUntilChanged()
|
||||||
|
.subscribe { refreshAdapter() })
|
||||||
|
|
||||||
setPagesOnAdapter()
|
setPagesOnAdapter()
|
||||||
return recycler
|
return recycler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun refreshAdapter() {
|
||||||
|
val activePage = layoutManager.findFirstVisibleItemPosition()
|
||||||
|
recycler.adapter = adapter
|
||||||
|
setActivePage(activePage)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses two ways to scroll to the last page read.
|
* Uses two ways to scroll to the last page read.
|
||||||
|
Loading…
Reference in New Issue
Block a user