Implement #1042
Since this View-based reader will never be actively maintained, and we are to rewrite it with Compose, Forgive me messing up the code...
This commit is contained in:
1 parent
a6a3219d1e
commit
f770ac9ac9
9 files changed
+25
-5
No files matched your search
@@ -22,6 +22,7 @@ import androidx.annotation.IntDef
|
||||
import com.davemorrissey.labs.subscaleview.decoder.Decoder
|
||||
import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder
|
||||
import com.davemorrissey.labs.subscaleview.provider.InputProvider
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -462,6 +463,7 @@ open class SubsamplingScaleImageView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||
if (!ReaderActivity.readerPreferences.doubleTapToZoom().get()) return false
|
||||
if (isZoomEnabled && isReady && vTranslate != null) {
|
||||
// Hacky solution for #15 - after a double tap the GestureDetector gets in a state
|
||||
// where the next fling is ignored, so here we replace it with a new one.
|
||||
|
||||
@@ -36,6 +36,7 @@ class ReaderGeneralSettings @JvmOverloads constructor(context: Context, attrs: A
|
||||
binding.backgroundColor.bindToIntPreference(readerPreferences.readerTheme(), R.array.reader_themes_values)
|
||||
binding.showPageNumber.bindToPreference(readerPreferences.showPageNumber())
|
||||
binding.showReaderSeekbar.bindToPreference(readerPreferences.showReaderSeekbar())
|
||||
binding.doubleTapToZoom.bindToPreference(readerPreferences.doubleTapToZoom())
|
||||
binding.fullscreen.bindToPreference(readerPreferences.fullscreen())
|
||||
readerPreferences.fullscreen()
|
||||
.asHotFlow {
|
||||
|
||||
@@ -15,6 +15,7 @@ class ReaderPreferences(private val preferenceStore: PreferenceStore) {
|
||||
fun showPageNumber() = preferenceStore.getBoolean("pref_show_page_number_key", true)
|
||||
|
||||
fun showReaderSeekbar() = preferenceStore.getBoolean("pref_show_reader_seekbar", true)
|
||||
fun doubleTapToZoom() = preferenceStore.getBoolean("pref_double_tap_to_zoom", true)
|
||||
|
||||
fun trueColor() = preferenceStore.getBoolean("pref_true_color_key", false)
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.Companion.EASE_OUT_QUAD
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.Companion.SCALE_TYPE_CENTER_INSIDE
|
||||
import com.github.chrisbanes.photoview.PhotoView
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView
|
||||
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
||||
import eu.kanade.tachiyomi.util.view.isVisibleOnScreen
|
||||
@@ -277,10 +278,12 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||
setOnDoubleTapListener(
|
||||
object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||
if (scale > 1F) {
|
||||
setScale(1F, e.x, e.y, true)
|
||||
} else {
|
||||
setScale(2F, e.x, e.y, true)
|
||||
if (ReaderActivity.readerPreferences.doubleTapToZoom().get()) {
|
||||
if (scale > 1F) {
|
||||
setScale(1F, e.x, e.y, true)
|
||||
} else {
|
||||
setScale(2F, e.x, e.y, true)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ import android.view.animation.DecelerateInterpolator
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.GestureDetectorWithLongTap
|
||||
import kotlin.math.abs
|
||||
|
||||
@@ -208,7 +209,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onDoubleTap(ev: MotionEvent): Boolean {
|
||||
detector.isDoubleTapping = true
|
||||
if (ReaderActivity.readerPreferences.doubleTapToZoom().get()) detector.isDoubleTapping = true
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
android:text="@string/pref_show_reader_seekbar"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/double_tap_to_zoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="16dp"
|
||||
android:text="@string/pref_double_tap_to_zoom"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -549,6 +549,7 @@
|
||||
<string name="pref_page_transitions">页面过渡动画</string>
|
||||
<string name="pref_show_page_number">显示页码</string>
|
||||
<string name="pref_show_reader_seekbar">显示跳页拖动条</string>
|
||||
<string name="pref_double_tap_to_zoom">双击缩放</string>
|
||||
<string name="pref_custom_brightness">自定义亮度</string>
|
||||
<string name="pref_custom_color_filter">自定义滤镜</string>
|
||||
<string name="pref_keep_screen_on">保持屏幕常亮</string>
|
||||
|
||||
@@ -548,6 +548,7 @@
|
||||
<string name="pref_page_transitions">翻頁轉場動畫</string>
|
||||
<string name="pref_show_page_number">顯示頁碼</string>
|
||||
<string name="pref_show_reader_seekbar">顯示跳頁拖動條</string>
|
||||
<string name="pref_double_tap_to_zoom">雙擊縮放</string>
|
||||
<string name="pref_custom_brightness">自訂亮度</string>
|
||||
<string name="pref_custom_color_filter">色彩濾鏡</string>
|
||||
<string name="pref_keep_screen_on">保持螢幕恆亮</string>
|
||||
|
||||
@@ -629,6 +629,7 @@
|
||||
<string name="pref_page_transitions">Animate page transitions</string>
|
||||
<string name="pref_show_page_number">Show page number</string>
|
||||
<string name="pref_show_reader_seekbar">Show page jumping seekbar</string>
|
||||
<string name="pref_double_tap_to_zoom">Double tap to zoom</string>
|
||||
<string name="pref_custom_brightness">Custom brightness</string>
|
||||
<string name="pref_grayscale">Grayscale</string>
|
||||
<string name="pref_inverted_colors">Inverted</string>
|
||||
|
||||
Reference in new issue
Block a user