Add option to change double tap animation speed in the reader (#974)

* Add option to change double tap animation speed in the reader

* address requests from review
This commit is contained in:
Joel Shapiro
2018-01-26 13:22:31 -06:00
committed by Bram van de Kerkhof
parent a65a71df5d
commit f88dd28c51
8 changed files with 38 additions and 0 deletions
@@ -62,6 +62,7 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
with(image_view) {
setMaxTileSize((reader.activity as ReaderActivity).maxBitmapSize)
setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED)
setDoubleTapZoomDuration(reader.doubleTapAnimDuration.toInt())
setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE)
setMinimumScaleType(reader.scaleType)
setMinimumDpi(90)
@@ -85,6 +85,12 @@ abstract class PagerReader : BaseReader() {
var cropBorders: Boolean = false
private set
/**
* Duration of the double tap animation
*/
var doubleTapAnimDuration = 500
private set
/**
* Scale type (fit width, fit screen, etc).
*/
@@ -166,6 +172,10 @@ abstract class PagerReader : BaseReader() {
.skip(1)
.distinctUntilChanged()
.subscribe { refreshAdapter() })
add(preferences.doubleTapAnimSpeed()
.asObservable()
.subscribe { doubleTapAnimDuration = it })
}
setPagesOnAdapter()
@@ -57,6 +57,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
with(image_view) {
setMaxTileSize(readerActivity.maxBitmapSize)
setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED)
setDoubleTapZoomDuration(webtoonReader.doubleTapAnimDuration.toInt())
setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE)
setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH)
setMinimumDpi(90)
@@ -59,6 +59,12 @@ class WebtoonReader : BaseReader() {
var cropBorders: Boolean = false
private set
/**
* Duration of the double tap animation
*/
var doubleTapAnimDuration = 500
private set
/**
* Gesture detector for image touch events.
*/
@@ -124,6 +130,10 @@ class WebtoonReader : BaseReader() {
.distinctUntilChanged()
.subscribe { refreshAdapter() })
subscriptions.add(readerActivity.preferences.doubleTapAnimSpeed()
.asObservable()
.subscribe { doubleTapAnimDuration = it })
setPagesOnAdapter()
return recycler
}