|
@@ -10,6 +10,7 @@ import androidx.core.view.isGone
|
|
|
import androidx.core.view.isVisible
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import androidx.recyclerview.widget.WebtoonLayoutManager
|
|
|
+import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|
|
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
|
|
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
|
@@ -20,6 +21,8 @@ import kotlinx.coroutines.MainScope
|
|
|
import kotlinx.coroutines.cancel
|
|
|
import rx.subscriptions.CompositeSubscription
|
|
|
import timber.log.Timber
|
|
|
+import uy.kohesive.injekt.Injekt
|
|
|
+import uy.kohesive.injekt.api.get
|
|
|
import kotlin.math.max
|
|
|
import kotlin.math.min
|
|
|
|
|
@@ -70,6 +73,12 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|
|
*/
|
|
|
val subscriptions = CompositeSubscription()
|
|
|
|
|
|
+ private val threshold: Int =
|
|
|
+ Injekt.get<PreferencesHelper>()
|
|
|
+ .readerHideTreshold()
|
|
|
+ .get()
|
|
|
+ .threshold
|
|
|
+
|
|
|
init {
|
|
|
recycler.isVisible = false // Don't let the recycler layout yet
|
|
|
recycler.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
|
|
@@ -81,7 +90,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
onScrolled()
|
|
|
|
|
|
- if ((dy > 37 || dy < -37) && activity.menuVisible) {
|
|
|
+ if ((dy > threshold || dy < -threshold) && activity.menuVisible) {
|
|
|
activity.hideMenu()
|
|
|
}
|
|
|
|