Explorar el Código

Fix crash in single-page chapters

arkon hace 3 años
padre
commit
675c0cefc3

+ 3 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt

@@ -84,6 +84,7 @@ import timber.log.Timber
 import uy.kohesive.injekt.injectLazy
 import java.io.File
 import kotlin.math.abs
+import kotlin.math.max
 
 /**
  * Activity containing the reader of Tachiyomi. This activity is mostly a container of the
@@ -729,7 +730,8 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
         }
 
         // Set slider progress
-        binding.pageSlider.valueTo = pages.lastIndex.toFloat()
+        binding.pageSlider.isEnabled = pages.size > 1
+        binding.pageSlider.valueTo = max(pages.lastIndex.toFloat(), 1f)
         binding.pageSlider.value = page.index.toFloat()
     }