diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 5e677eacf..4ba22ee84 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -11,6 +11,8 @@ object PreferenceKeys { const val enableTransitions = "pref_enable_transitions_key" + const val doubleTapAnimationSpeed = "pref_double_tap_anim_speed" + const val showPageNumber = "pref_show_page_number_key" const val fullscreen = "fullscreen" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index a367c6c11..c6f3e638c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -39,6 +39,8 @@ class PreferencesHelper(val context: Context) { fun pageTransitions() = rxPrefs.getBoolean(Keys.enableTransitions, true) + fun doubleTapAnimSpeed() = rxPrefs.getInteger(Keys.doubleTapAnimationSpeed, 500) + fun showPageNumber() = rxPrefs.getBoolean(Keys.showPageNumber, true) fun fullscreen() = rxPrefs.getBoolean(Keys.fullscreen, true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PageView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PageView.kt index 1b0fef4ce..7143b8d0c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PageView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PageView.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReader.kt index 1bd7b0b80..e35ba8f8a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReader.kt @@ -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() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.kt index dedccad24..34488d65e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt index 83d3f88df..d2164f9e7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt index 03ec76a74..aa3188f03 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt @@ -62,6 +62,14 @@ class SettingsReaderController : SettingsController() { defaultValue = "0" summary = "%s" } + intListPreference { + key = Keys.doubleTapAnimationSpeed + titleRes = R.string.pref_double_tap_anim_speed + entries = arrayOf(context.getString(R.string.double_tap_anim_speed_0), context.getString(R.string.double_tap_anim_speed_fast), context.getString(R.string.double_tap_anim_speed_normal)) + entryValues = arrayOf("1", "250", "500") // using a value of 0 breaks the image viewer, so min is 1 + defaultValue = "500" + summary = "%s" + } switchPreference { key = Keys.fullscreen titleRes = R.string.pref_fullscreen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fc534a47c..d71c098f7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -148,6 +148,7 @@ Fullscreen Lock orientation Page transitions + Double tap animation speed Show page number Crop borders Use custom brightness @@ -179,6 +180,9 @@ Left Right Center + No animation + Normal + Fast Rotation Free Lock