diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/ReaderGeneralView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/ReaderGeneralView.kt index d8cd84b647..ec49f53905 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/ReaderGeneralView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/ReaderGeneralView.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader.settings import android.content.Context import android.util.AttributeSet +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.ReaderGeneralLayoutBinding import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.bindToPreference @@ -32,6 +33,12 @@ class ReaderGeneralView @JvmOverloads constructor(context: Context, attrs: Attri binding.alwaysShowChapterTransition.bindToPreference(preferences.alwaysShowChapterTransition()) } + fun checkIfShouldDisableReadingMode() { + if (activity.presenter.manga?.isLongStrip() == true) { + binding.viewerSeries.setDisabledState(R.string.webtoon_cannot_change) + } + } + /** * Init the preferences for the webtoon reader. */ diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt index 36b20c7feb..a3611a2819 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt @@ -60,6 +60,7 @@ class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) : generalView.activity = readerActivity pagedView.activity = readerActivity filterView.activity = readerActivity + generalView.checkIfShouldDisableReadingMode() filterView.window = window generalView.sheet = this 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 c70cc6400e..c79d0e8c72 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt @@ -9,6 +9,7 @@ import android.view.LayoutInflater import android.view.MenuItem import android.widget.FrameLayout import androidx.annotation.ArrayRes +import androidx.annotation.StringRes import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.widget.PopupMenu import androidx.core.content.ContextCompat @@ -19,6 +20,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.MaterialSpinnerViewBinding import eu.kanade.tachiyomi.util.lang.tintText import eu.kanade.tachiyomi.util.system.getResourceColor +import eu.kanade.tachiyomi.util.system.toast import kotlin.math.max class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: AttributeSet?) : @@ -86,6 +88,17 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att binding.detailView.text = entries.getOrNull(selection).orEmpty() } + fun setDisabledState(@StringRes messageRes: Int = 0) { + alpha = 0.5f + popup = null + setOnTouchListener(null) + setOnClickListener { + if (messageRes != 0) { + context.toast(messageRes) + } + } + } + fun bindToPreference(pref: Preference, offset: Int = 0, block: ((Int) -> Unit)? = null) { setSelection(pref.get() - offset) this.pref = pref diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f44ed6bf7c..2e87e88784 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -406,6 +406,7 @@ Page layout While using automatic page layout, you can still switch between layouts while reading without overriding this setting Automatic (based on orientation) + Cannot change reading mode from webtoon. Edit the series type first to change. %1$d page %1$d pages