diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index e48d9de7c8..b9f267d218 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -832,11 +832,11 @@ class ReaderActivity : val noDefault = manga.viewer == -1 val mangaViewer = presenter.getMangaViewer() val newViewer = when (mangaViewer) { - RIGHT_TO_LEFT -> R2LPagerViewer(this) + LEFT_TO_RIGHT -> L2RPagerViewer(this) VERTICAL -> VerticalPagerViewer(this) WEBTOON -> WebtoonViewer(this) VERTICAL_PLUS -> WebtoonViewer(this, hasMargins = true) - else -> L2RPagerViewer(this) + else -> R2LPagerViewer(this) } if (noDefault && presenter.manga?.viewer!! > 0) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt index 2730879588..5263c823d0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt @@ -102,14 +102,18 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att } fun setSelection(selection: Int) { - popup?.menu?.get(selectedPosition)?.let { - it.icon = ContextCompat.getDrawable(context, R.drawable.ic_blank_24dp) - it.title = entries[selectedPosition] + if (selectedPosition >= 0 && selectedPosition < popup?.menu?.size() ?: 0) { + popup?.menu?.get(selectedPosition)?.let { + it.icon = ContextCompat.getDrawable(context, R.drawable.ic_blank_24dp) + it.title = entries[selectedPosition] + } } selectedPosition = selection - popup?.menu?.get(selectedPosition)?.let { - it.icon = tintedCheck() - it.title = it.title?.tintText(blendedAccent) + if (selectedPosition >= 0 && selectedPosition < popup?.menu?.size() ?: 0) { + popup?.menu?.get(selectedPosition)?.let { + it.icon = tintedCheck() + it.title = it.title?.tintText(blendedAccent) + } } binding.detailView.text = entries.getOrNull(selection).orEmpty() }