mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Disable reading mode for webtoons in settings
Comes with a popup to say change manga type if anything
This commit is contained in:
parent
eabf5e2a8b
commit
3cd5043e67
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader.settings
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.databinding.ReaderGeneralLayoutBinding
|
import eu.kanade.tachiyomi.databinding.ReaderGeneralLayoutBinding
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
import eu.kanade.tachiyomi.util.bindToPreference
|
import eu.kanade.tachiyomi.util.bindToPreference
|
||||||
@ -32,6 +33,12 @@ class ReaderGeneralView @JvmOverloads constructor(context: Context, attrs: Attri
|
|||||||
binding.alwaysShowChapterTransition.bindToPreference(preferences.alwaysShowChapterTransition())
|
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.
|
* Init the preferences for the webtoon reader.
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +60,7 @@ class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
|||||||
generalView.activity = readerActivity
|
generalView.activity = readerActivity
|
||||||
pagedView.activity = readerActivity
|
pagedView.activity = readerActivity
|
||||||
filterView.activity = readerActivity
|
filterView.activity = readerActivity
|
||||||
|
generalView.checkIfShouldDisableReadingMode()
|
||||||
filterView.window = window
|
filterView.window = window
|
||||||
generalView.sheet = this
|
generalView.sheet = this
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.annotation.ArrayRes
|
import androidx.annotation.ArrayRes
|
||||||
|
import androidx.annotation.StringRes
|
||||||
import androidx.appcompat.view.menu.MenuBuilder
|
import androidx.appcompat.view.menu.MenuBuilder
|
||||||
import androidx.appcompat.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
@ -19,6 +20,7 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.databinding.MaterialSpinnerViewBinding
|
import eu.kanade.tachiyomi.databinding.MaterialSpinnerViewBinding
|
||||||
import eu.kanade.tachiyomi.util.lang.tintText
|
import eu.kanade.tachiyomi.util.lang.tintText
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: AttributeSet?) :
|
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()
|
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<Int>, offset: Int = 0, block: ((Int) -> Unit)? = null) {
|
fun bindToPreference(pref: Preference<Int>, offset: Int = 0, block: ((Int) -> Unit)? = null) {
|
||||||
setSelection(pref.get() - offset)
|
setSelection(pref.get() - offset)
|
||||||
this.pref = pref
|
this.pref = pref
|
||||||
|
@ -406,6 +406,7 @@
|
|||||||
<string name="page_layout">Page layout</string>
|
<string name="page_layout">Page layout</string>
|
||||||
<string name="automatic_can_still_switch">While using automatic page layout, you can still switch between layouts while reading without overriding this setting</string>
|
<string name="automatic_can_still_switch">While using automatic page layout, you can still switch between layouts while reading without overriding this setting</string>
|
||||||
<string name="automatic_orientation">Automatic (based on orientation)</string>
|
<string name="automatic_orientation">Automatic (based on orientation)</string>
|
||||||
|
<string name="webtoon_cannot_change">Cannot change reading mode from webtoon. Edit the series type first to change.</string>
|
||||||
<plurals name="pages_plural">
|
<plurals name="pages_plural">
|
||||||
<item quantity="one">%1$d page</item>
|
<item quantity="one">%1$d page</item>
|
||||||
<item quantity="other">%1$d pages</item>
|
<item quantity="other">%1$d pages</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user