Added Auto Webtoon Mode
This commit is contained in:
parent
e4d8fea138
commit
43098aa61b
@ -236,4 +236,6 @@ object PreferenceKeys {
|
||||
const val eh_is_hentai_enabled = "eh_is_hentai_enabled"
|
||||
|
||||
const val eh_use_new_manga_interface = "eh_use_new_manga_interface"
|
||||
|
||||
const val eh_use_auto_webtoon = "eh_use_auto_webtoon"
|
||||
}
|
||||
|
@ -346,4 +346,6 @@ class PreferencesHelper(val context: Context) {
|
||||
fun eh_preload_size() = flowPrefs.getInt(Keys.eh_preload_size, 4)
|
||||
|
||||
fun eh_useNewMangaInterface() = flowPrefs.getBoolean(Keys.eh_use_new_manga_interface, true)
|
||||
|
||||
fun eh_useAutoWebtoon() = flowPrefs.getBoolean(Keys.eh_use_auto_webtoon, true)
|
||||
}
|
||||
|
@ -115,7 +115,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
|
||||
private var autoscrollSubscription: Subscription? = null
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
|
||||
private val logger = XLog.tag("ReaderActivity")
|
||||
// <-- EH
|
||||
|
@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.util.lang.takeBytes
|
||||
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
||||
import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||
import eu.kanade.tachiyomi.util.updateCoverLastModified
|
||||
import exh.util.defaultReaderType
|
||||
import java.io.File
|
||||
import java.util.Date
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -447,7 +448,13 @@ class ReaderPresenter(
|
||||
*/
|
||||
fun getMangaViewer(): Int {
|
||||
val manga = manga ?: return preferences.defaultViewer()
|
||||
return if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
|
||||
return if (manga.viewer == 0 && preferences.eh_useAutoWebtoon().get()) {
|
||||
manga.defaultReaderType() ?: if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
|
||||
} else if (manga.viewer == 0) {
|
||||
preferences.defaultViewer()
|
||||
} else {
|
||||
manga.viewer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.util.view.invisible
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.always_show_chapter_transition
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.auto_webtoon_mode
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.background_color
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.crop_borders
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.crop_borders_webtoon
|
||||
@ -90,6 +91,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
keepscreen.bindToPreference(preferences.keepScreenOn())
|
||||
long_tap.bindToPreference(preferences.readWithLongTap())
|
||||
always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition())
|
||||
auto_webtoon_mode.bindToPreference(preferences.eh_useAutoWebtoon())
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
true_color.visible()
|
||||
|
@ -210,6 +210,12 @@ class SettingsReaderController : SettingsController() {
|
||||
title = "Preserve reading position on read manga"
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.eh_use_auto_webtoon
|
||||
title = "Auto Webtoon Mode"
|
||||
summary = "Use auto webtoon mode for manga that are detected to likely use the long strip format"
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
|
@ -33,6 +33,9 @@ fun Manga.mangaType(): MangaType {
|
||||
return if (currentTags.any { tag -> tag.contains("japanese", ignoreCase = true) || isMangaTag(tag) }) {
|
||||
Log.d("MangaType", "isManga")
|
||||
MangaType.TYPE_MANGA
|
||||
} else if (currentTags.any { tag -> isWebtoonTag(tag) } || isWebtoonSource(sourceName)) {
|
||||
Log.d("MangaType", "isWebtoon")
|
||||
MangaType.TYPE_WEBTOON
|
||||
} else if (currentTags.any { tag -> tag.contains("english", ignoreCase = true) || isComicTag(tag) } || isComicSource(sourceName)) {
|
||||
Log.d("MangaType", "isComic")
|
||||
MangaType.TYPE_COMIC
|
||||
@ -42,9 +45,6 @@ fun Manga.mangaType(): MangaType {
|
||||
} else if (currentTags.any { tag -> tag.contains("korean", ignoreCase = true) || isManhwaTag(tag) } || isManhwaSource(sourceName)) {
|
||||
Log.d("MangaType", "isManhwa")
|
||||
MangaType.TYPE_MANHWA
|
||||
} else if (currentTags.any { tag -> isWebtoonTag(tag) } || isWebtoonSource(sourceName)) {
|
||||
Log.d("MangaType", "isWebtoon")
|
||||
MangaType.TYPE_WEBTOON
|
||||
} else {
|
||||
Log.d("MangaType", "ended up as isManga")
|
||||
MangaType.TYPE_MANGA
|
||||
@ -55,14 +55,14 @@ fun Manga.mangaType(): MangaType {
|
||||
* The type the reader should use. Different from manga type as certain manga has different
|
||||
* read types
|
||||
*/
|
||||
fun Manga.defaultReaderType(): Int {
|
||||
val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
|
||||
fun Manga.defaultReaderType(): Int? {
|
||||
// val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
|
||||
val type = mangaType()
|
||||
return if (type == MangaType.TYPE_MANHWA || type == MangaType.TYPE_WEBTOON) {
|
||||
ReaderActivity.WEBTOON
|
||||
} else if (type == MangaType.TYPE_MANHUA || (type == MangaType.TYPE_COMIC && !sourceName.contains("tapastic", ignoreCase = true))) {
|
||||
ReaderActivity.LEFT_TO_RIGHT
|
||||
} else 0
|
||||
/* } else if (type == MangaType.TYPE_MANHUA || (type == MangaType.TYPE_COMIC && !sourceName.contains("tapastic", ignoreCase = true))) {
|
||||
ReaderActivity.LEFT_TO_RIGHT*/
|
||||
} else null
|
||||
}
|
||||
|
||||
private fun isMangaTag(tag: String): Boolean {
|
||||
|
@ -171,11 +171,19 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/true_color" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/auto_webtoon_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/eh_auto_webtoon_mode"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/always_show_chapter_transition" />
|
||||
|
||||
<android.widget.Space
|
||||
android:id="@+id/end_general_preferences"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/always_show_chapter_transition" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/auto_webtoon_mode" />
|
||||
|
||||
<!-- Pager preferences -->
|
||||
|
||||
|
@ -105,6 +105,7 @@
|
||||
<string name="eh_batch_add_button">Add Galleries</string>
|
||||
<string name="eh_batch_add_adding_galleries">Adding galleries…</string>
|
||||
<string name="eh_batch_add_finish">Finish</string>
|
||||
<string name="eh_auto_webtoon_mode">Auto Webtoon Mode Detection</string>
|
||||
|
||||
<!-- AZ -->
|
||||
<string name="az_recommends">See Recommendations</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user