mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 01:55:06 +01:00
Added Reader type for manga to seperate manga type
Using manhwa wording again Fixes for swipe refresh in manga page Fixed layout when expaning detials in manga info
This commit is contained in:
parent
d58923acbf
commit
dace5b4de7
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.data.database.models
|
|||||||
|
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@ -38,11 +39,9 @@ interface Manga : SManga {
|
|||||||
val currentTags = currentGenres()?.split(",")?.map { it.trim().toLowerCase(Locale.US) }
|
val currentTags = currentGenres()?.split(",")?.map { it.trim().toLowerCase(Locale.US) }
|
||||||
return if (currentTags?.any
|
return if (currentTags?.any
|
||||||
{ tag ->
|
{ tag ->
|
||||||
tag == "long strip" || tag == "manhwa" ||
|
tag.startsWith("english") || tag == "comic"
|
||||||
tag.contains("webtoon")
|
} == true)
|
||||||
} == true ||
|
TYPE_COMIC
|
||||||
sourceManager.getOrStub(source).name.contains("webtoon", true))
|
|
||||||
TYPE_WEBTOON
|
|
||||||
else if (currentTags?.any
|
else if (currentTags?.any
|
||||||
{ tag ->
|
{ tag ->
|
||||||
tag.startsWith("chinese") || tag == "manhua"
|
tag.startsWith("chinese") || tag == "manhua"
|
||||||
@ -50,12 +49,33 @@ interface Manga : SManga {
|
|||||||
TYPE_MANHUA
|
TYPE_MANHUA
|
||||||
else if (currentTags?.any
|
else if (currentTags?.any
|
||||||
{ tag ->
|
{ tag ->
|
||||||
tag.startsWith("english") || tag == "comic"
|
tag == "long strip" || tag == "manhwa" ||
|
||||||
} == true)
|
tag.contains("webtoon")
|
||||||
TYPE_COMIC
|
} == true ||
|
||||||
|
sourceManager.getOrStub(source).name.contains("webtoon", true))
|
||||||
|
TYPE_MANHWA
|
||||||
else TYPE_MANGA
|
else TYPE_MANGA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun defaultReaderType(): Int {
|
||||||
|
val sourceManager: SourceManager by injectLazy()
|
||||||
|
val currentTags = currentGenres()?.split(",")?.map { it.trim().toLowerCase(Locale.US) }
|
||||||
|
return if (currentTags?.any
|
||||||
|
{ tag ->
|
||||||
|
tag == "long strip" || tag == "manhwa" ||
|
||||||
|
tag.contains("webtoon")
|
||||||
|
} == true ||
|
||||||
|
sourceManager.getOrStub(source).name.contains("webtoon", true))
|
||||||
|
ReaderActivity.WEBTOON
|
||||||
|
else if (currentTags?.any
|
||||||
|
{ tag ->
|
||||||
|
tag.startsWith("chinese") || tag == "manhua" ||
|
||||||
|
tag.startsWith("english") || tag == "comic"
|
||||||
|
} == true)
|
||||||
|
ReaderActivity.LEFT_TO_RIGHT
|
||||||
|
else 0
|
||||||
|
}
|
||||||
|
|
||||||
// Used to display the chapter's title one way or another
|
// Used to display the chapter's title one way or another
|
||||||
var displayMode: Int
|
var displayMode: Int
|
||||||
get() = chapter_flags and DISPLAY_MASK
|
get() = chapter_flags and DISPLAY_MASK
|
||||||
@ -106,8 +126,12 @@ interface Manga : SManga {
|
|||||||
const val DISPLAY_NUMBER = 0x00100000
|
const val DISPLAY_NUMBER = 0x00100000
|
||||||
const val DISPLAY_MASK = 0x00100000
|
const val DISPLAY_MASK = 0x00100000
|
||||||
|
|
||||||
|
const val READ_WEBTOON = 0
|
||||||
|
const val READ_LTR = 1
|
||||||
|
const val READ_RTL = 2
|
||||||
|
|
||||||
const val TYPE_MANGA = 0
|
const val TYPE_MANGA = 0
|
||||||
const val TYPE_WEBTOON = 1
|
const val TYPE_MANHWA = 1
|
||||||
const val TYPE_MANHUA = 2
|
const val TYPE_MANHUA = 2
|
||||||
const val TYPE_COMIC = 3
|
const val TYPE_COMIC = 3
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ class LibraryPresenter(
|
|||||||
if ((filterMangaType == Manga.TYPE_MANHUA) && mangaType != Manga.TYPE_MANHUA)
|
if ((filterMangaType == Manga.TYPE_MANHUA) && mangaType != Manga.TYPE_MANHUA)
|
||||||
return@f false
|
return@f false
|
||||||
if ((filterMangaType == Manga.TYPE_COMIC) && mangaType != Manga.TYPE_COMIC) return@f false
|
if ((filterMangaType == Manga.TYPE_COMIC) && mangaType != Manga.TYPE_COMIC) return@f false
|
||||||
if ((filterMangaType == Manga.TYPE_WEBTOON) && mangaType != Manga.TYPE_WEBTOON) return@f false
|
if ((filterMangaType == Manga.TYPE_MANHWA) && mangaType != Manga.TYPE_MANHWA) return@f false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
|||||||
}
|
}
|
||||||
val librryManga = db.getLibraryMangas().executeAsBlocking()
|
val librryManga = db.getLibraryMangas().executeAsBlocking()
|
||||||
val types = mutableListOf<Int>()
|
val types = mutableListOf<Int>()
|
||||||
if (librryManga.any { it.mangaType() == Manga.TYPE_WEBTOON }) types.add(R.string.webtoon_viewer)
|
if (librryManga.any { it.mangaType() == Manga.TYPE_MANHWA }) types.add(R.string.manhwa)
|
||||||
if (librryManga.any { it.mangaType() == Manga.TYPE_MANHUA }) types.add(R.string.manhua)
|
if (librryManga.any { it.mangaType() == Manga.TYPE_MANHUA }) types.add(R.string.manhua)
|
||||||
if (librryManga.any { it.mangaType() == Manga.TYPE_COMIC }) types.add(R.string.comic)
|
if (librryManga.any { it.mangaType() == Manga.TYPE_COMIC }) types.add(R.string.comic)
|
||||||
if (types.isNotEmpty()) {
|
if (types.isNotEmpty()) {
|
||||||
|
@ -57,6 +57,7 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|||||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
||||||
import eu.kanade.tachiyomi.util.view.getText
|
import eu.kanade.tachiyomi.util.view.getText
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
@ -235,7 +236,7 @@ class MangaChaptersController : BaseController,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun showError(message: String) {
|
fun showError(message: String) {
|
||||||
swipe_refresh.isRefreshing = false
|
swipe_refresh?.isRefreshing = false
|
||||||
view?.snack(message)
|
view?.snack(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +278,7 @@ class MangaChaptersController : BaseController,
|
|||||||
adapter?.updateDataSet(listOf(ChapterItem(Chapter.createH(), presenter.manga)))
|
adapter?.updateDataSet(listOf(ChapterItem(Chapter.createH(), presenter.manga)))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
swipe_refresh.isRefreshing = false
|
swipe_refresh?.isRefreshing = false
|
||||||
adapter?.updateDataSet(
|
adapter?.updateDataSet(
|
||||||
listOf(ChapterItem(Chapter.createH(), presenter.manga)) + presenter.chapters
|
listOf(ChapterItem(Chapter.createH(), presenter.manga)) + presenter.chapters
|
||||||
)
|
)
|
||||||
@ -286,8 +287,9 @@ class MangaChaptersController : BaseController,
|
|||||||
|
|
||||||
|
|
||||||
fun updateChapters(chapters: List<ChapterItem>) {
|
fun updateChapters(chapters: List<ChapterItem>) {
|
||||||
swipe_refresh.isRefreshing = false
|
swipe_refresh?.isRefreshing = false
|
||||||
if (presenter.chapters.isEmpty() && fromCatalogue && !presenter.hasRequested) {
|
if (presenter.chapters.isEmpty() && fromCatalogue && !presenter.hasRequested) {
|
||||||
|
launchUI { swipe_refresh?.isRefreshing = true }
|
||||||
presenter.fetchChaptersFromSource()
|
presenter.fetchChaptersFromSource()
|
||||||
}
|
}
|
||||||
adapter?.updateDataSet(listOf(ChapterItem(Chapter.createH(), presenter.manga)) + chapters)
|
adapter?.updateDataSet(listOf(ChapterItem(Chapter.createH(), presenter.manga)) + chapters)
|
||||||
|
@ -31,7 +31,7 @@ class MangaHeaderHolder(
|
|||||||
init {
|
init {
|
||||||
start_reading_button.setOnClickListener { adapter.coverListener?.readNextChapter() }
|
start_reading_button.setOnClickListener { adapter.coverListener?.readNextChapter() }
|
||||||
top_view.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
top_view.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||||
topMargin = adapter.coverListener?.topCoverHeight() ?: 0
|
height = adapter.coverListener?.topCoverHeight() ?: 0
|
||||||
}
|
}
|
||||||
more_button.setOnClickListener { expandDesc() }
|
more_button.setOnClickListener { expandDesc() }
|
||||||
manga_summary.setOnClickListener { expandDesc() }
|
manga_summary.setOnClickListener { expandDesc() }
|
||||||
@ -86,11 +86,13 @@ class MangaHeaderHolder(
|
|||||||
if (manga_summary.lineCount < 3 && manga.currentGenres().isNullOrBlank()) {
|
if (manga_summary.lineCount < 3 && manga.currentGenres().isNullOrBlank()) {
|
||||||
more_button_group.gone()
|
more_button_group.gone()
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
more_button_group.visible()
|
||||||
}
|
}
|
||||||
manga_summary_label.text = itemView.context.getString(R.string.about_this,
|
manga_summary_label.text = itemView.context.getString(R.string.about_this,
|
||||||
itemView.context.getString(
|
itemView.context.getString(
|
||||||
when {
|
when {
|
||||||
manga.mangaType() == Manga.TYPE_WEBTOON -> R.string.webtoon_viewer
|
manga.mangaType() == Manga.TYPE_MANHWA -> R.string.manhwa
|
||||||
manga.mangaType() == Manga.TYPE_MANHUA -> R.string.manhua
|
manga.mangaType() == Manga.TYPE_MANHUA -> R.string.manhua
|
||||||
manga.mangaType() == Manga.TYPE_COMIC -> R.string.comic
|
manga.mangaType() == Manga.TYPE_COMIC -> R.string.comic
|
||||||
else -> R.string.manga
|
else -> R.string.manga
|
||||||
@ -149,7 +151,7 @@ class MangaHeaderHolder(
|
|||||||
chapters_title.text = itemView.resources.getQuantityString(R.plurals.chapters, count, count)
|
chapters_title.text = itemView.resources.getQuantityString(R.plurals.chapters, count, count)
|
||||||
|
|
||||||
top_view.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
top_view.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||||
topMargin = adapter.coverListener?.topCoverHeight() ?: 0
|
height = adapter.coverListener?.topCoverHeight() ?: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_status.text = (itemView.context.getString( when (manga.status) {
|
manga_status.text = (itemView.context.getString( when (manga.status) {
|
||||||
@ -173,11 +175,16 @@ class MangaHeaderHolder(
|
|||||||
|
|
||||||
fun setTopHeight(newHeight: Int) {
|
fun setTopHeight(newHeight: Int) {
|
||||||
top_view.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
top_view.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||||
topMargin = newHeight
|
height = newHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBackDrop(color: Int) {
|
fun setBackDrop(color: Int) {
|
||||||
true_backdrop.setBackgroundColor(color)
|
true_backdrop.setBackgroundColor(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onLongClick(view: View?): Boolean {
|
||||||
|
super.onLongClick(view)
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.manga
|
package eu.kanade.tachiyomi.ui.manga
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
import eu.kanade.tachiyomi.data.database.models.Category
|
||||||
@ -17,6 +18,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
|||||||
import eu.kanade.tachiyomi.ui.manga.chapter.ChapterItem
|
import eu.kanade.tachiyomi.ui.manga.chapter.ChapterItem
|
||||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||||
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
||||||
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -50,10 +52,17 @@ class MangaPresenter(private val controller: MangaChaptersController,
|
|||||||
fun onCreate() {
|
fun onCreate() {
|
||||||
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
|
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
|
||||||
downloadManager.addListener(this)
|
downloadManager.addListener(this)
|
||||||
if (!manga.initialized)
|
if (!manga.initialized) {
|
||||||
fetchMangaFromSource()
|
controller.updateHeader()
|
||||||
updateChapters()
|
launchUI {
|
||||||
controller.updateChapters(this.chapters)
|
controller.setRefresh(true)
|
||||||
|
}
|
||||||
|
refreshAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateChapters()
|
||||||
|
controller.updateChapters(this.chapters)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onDestroy() {
|
fun onDestroy() {
|
||||||
@ -363,7 +372,9 @@ class MangaPresenter(private val controller: MangaChaptersController,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun trimException(e: java.lang.Exception): String {
|
private fun trimException(e: java.lang.Exception): String {
|
||||||
return e.message?.split(": ")?.drop(1)?.joinToString(": ") ?: "Error"
|
return (if (e.message?.contains(": ") == true)
|
||||||
|
e.message?.split(": ")?.drop(1)?.joinToString(": ")
|
||||||
|
else e.message) ?: preferences.context.getString(R.string.unknown_error)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +23,7 @@ import android.widget.SeekBar
|
|||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -49,6 +50,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
|
|||||||
import eu.kanade.tachiyomi.util.system.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
|
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
|
||||||
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
||||||
@ -64,6 +66,7 @@ import rx.subscriptions.CompositeSubscription
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.Locale
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
@ -125,6 +128,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
private var progressDialog: ProgressDialog? = null
|
private var progressDialog: ProgressDialog? = null
|
||||||
|
|
||||||
|
private var snackbar:Snackbar? = null
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
const val LEFT_TO_RIGHT = 1
|
const val LEFT_TO_RIGHT = 1
|
||||||
@ -196,6 +201,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
bottomSheet = null
|
bottomSheet = null
|
||||||
progressDialog?.dismiss()
|
progressDialog?.dismiss()
|
||||||
progressDialog = null
|
progressDialog = null
|
||||||
|
snackbar?.dismiss()
|
||||||
|
snackbar = null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -323,6 +330,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
menuVisible = visible
|
menuVisible = visible
|
||||||
if (visible) coroutine?.cancel()
|
if (visible) coroutine?.cancel()
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
snackbar?.dismiss()
|
||||||
systemUi?.show()
|
systemUi?.show()
|
||||||
reader_menu.visibility = View.VISIBLE
|
reader_menu.visibility = View.VISIBLE
|
||||||
reader_menu_bottom.visibility = View.VISIBLE
|
reader_menu_bottom.visibility = View.VISIBLE
|
||||||
@ -370,13 +378,34 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
*/
|
*/
|
||||||
fun setManga(manga: Manga) {
|
fun setManga(manga: Manga) {
|
||||||
val prevViewer = viewer
|
val prevViewer = viewer
|
||||||
val newViewer = when (presenter.getMangaViewer()) {
|
val noDefault = manga.viewer == -1
|
||||||
|
val mangaViewer = presenter.getMangaViewer()
|
||||||
|
val newViewer = when (mangaViewer) {
|
||||||
RIGHT_TO_LEFT -> R2LPagerViewer(this)
|
RIGHT_TO_LEFT -> R2LPagerViewer(this)
|
||||||
VERTICAL -> VerticalPagerViewer(this)
|
VERTICAL -> VerticalPagerViewer(this)
|
||||||
WEBTOON -> WebtoonViewer(this)
|
WEBTOON -> WebtoonViewer(this)
|
||||||
else -> L2RPagerViewer(this)
|
else -> L2RPagerViewer(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (noDefault && presenter.manga?.viewer!! > 0) {
|
||||||
|
snackbar = reader_layout.snack(
|
||||||
|
getString(
|
||||||
|
R.string.reading_mode, getString(
|
||||||
|
when (mangaViewer) {
|
||||||
|
RIGHT_TO_LEFT -> R.string.right_to_left_viewer
|
||||||
|
VERTICAL -> R.string.vertical_viewer
|
||||||
|
WEBTOON -> R.string.webtoon_style
|
||||||
|
else -> R.string.left_to_right_viewer
|
||||||
|
}
|
||||||
|
).toLowerCase(Locale.getDefault())
|
||||||
|
), 8000
|
||||||
|
) {
|
||||||
|
setAction(R.string.action_use_default) {
|
||||||
|
presenter.setMangaViewer(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy previous viewer if there was one
|
// Destroy previous viewer if there was one
|
||||||
if (prevViewer != null) {
|
if (prevViewer != null) {
|
||||||
prevViewer.destroy()
|
prevViewer.destroy()
|
||||||
|
@ -397,12 +397,7 @@ class ReaderPresenter(
|
|||||||
fun getMangaViewer(): Int {
|
fun getMangaViewer(): Int {
|
||||||
val manga = manga ?: return preferences.defaultViewer()
|
val manga = manga ?: return preferences.defaultViewer()
|
||||||
if (manga.viewer == -1) {
|
if (manga.viewer == -1) {
|
||||||
val type = when(manga.mangaType()) {
|
manga.viewer = manga.defaultReaderType()
|
||||||
Manga.TYPE_WEBTOON -> ReaderActivity.WEBTOON
|
|
||||||
Manga.TYPE_COMIC, Manga.TYPE_MANHUA -> ReaderActivity.LEFT_TO_RIGHT
|
|
||||||
else -> 0
|
|
||||||
}
|
|
||||||
manga.viewer = type
|
|
||||||
db.updateMangaViewer(manga).asRxObservable().subscribe()
|
db.updateMangaViewer(manga).asRxObservable().subscribe()
|
||||||
}
|
}
|
||||||
return if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
|
return if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
|
||||||
|
@ -65,7 +65,7 @@ Unit)? = null): Snackbar {
|
|||||||
snack.f()
|
snack.f()
|
||||||
}
|
}
|
||||||
val theme = Injekt.get<PreferencesHelper>().theme()
|
val theme = Injekt.get<PreferencesHelper>().theme()
|
||||||
if (theme == 3 || theme == 6) {
|
if (theme == 3) {
|
||||||
val textView: TextView =
|
val textView: TextView =
|
||||||
snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
|
snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
|
||||||
val button: Button? =
|
val button: Button? =
|
||||||
|
@ -6,30 +6,15 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/guideline"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginTop="52dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/true_backdrop" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
|
||||||
android:id="@+id/guideline2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintGuide_begin="137dp" />
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/true_backdrop"
|
android:id="@+id/true_backdrop"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/bottom_line"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHeight_min="200dp"
|
app:layout_constraintHeight_min="200dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/bottom_line"
|
||||||
app:layout_constraintVertical_bias="0.0"
|
app:layout_constraintVertical_bias="0.0"
|
||||||
tools:background="@color/material_red_400" />
|
tools:background="@color/material_red_400" />
|
||||||
|
|
||||||
@ -56,46 +41,22 @@
|
|||||||
<View
|
<View
|
||||||
android:id="@+id/top_view"
|
android:id="@+id/top_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="100dp"
|
||||||
android:layout_marginTop="100dp"
|
android:layout_marginTop="0dp"
|
||||||
app:layout_constraintBottom_toTopOf="@id/top_line"
|
app:layout_constraintBottom_toTopOf="@id/cover_card"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:layout_constraintVertical_bias="0.48000002" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Barrier
|
|
||||||
android:id="@+id/top_line"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:barrierDirection="top"
|
|
||||||
app:constraint_referenced_ids="cover_card,manga_layout"
|
|
||||||
tools:layout_editor_absoluteY="93dp" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/manga_layout"
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/guideline"
|
|
||||||
app:layout_constraintDimensionRatio="h,7:10"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/cover_card"
|
android:id="@+id/cover_card"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/manga_layout"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/top_view"
|
app:layout_constraintTop_toBottomOf="@id/top_view"
|
||||||
app:layout_constraintTop_toTopOf="@id/true_backdrop"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintVertical_bias="1.0">
|
app:layout_constraintVertical_bias="1.0">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -123,19 +84,20 @@
|
|||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/manga_layout"
|
app:layout_constraintStart_toEndOf="@id/cover_card"
|
||||||
app:layout_constraintTop_toTopOf="@id/cover_card"
|
app:layout_constraintTop_toTopOf="@id/cover_card"
|
||||||
tools:text="Title Example" />
|
tools:text="Title Example" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_author"
|
android:id="@+id/manga_author"
|
||||||
android:textAppearance="@style/TextAppearance.Regular.Body1.SemiBold"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:layout_marginEnd="16dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="2"
|
||||||
android:text="@string/manga_info_author_label"
|
android:text="@string/manga_info_author_label"
|
||||||
|
android:textAppearance="@style/TextAppearance.Regular.Body1.SemiBold"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/manga_full_title"
|
app:layout_constraintStart_toStartOf="@id/manga_full_title"
|
||||||
@ -158,6 +120,7 @@
|
|||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
@ -173,7 +136,7 @@
|
|||||||
android:layout_margin="6dp"
|
android:layout_margin="6dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:barrierDirection="bottom"
|
app:barrierDirection="bottom"
|
||||||
app:constraint_referenced_ids="manga_source,manga_layout,cover_card" />
|
app:constraint_referenced_ids="manga_source,cover_card" />
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -241,8 +204,9 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:maxLines="3"
|
android:maxLines="3"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintBottom_toTopOf="@id/start_reading_button"
|
app:layout_constraintBottom_toTopOf="@id/manga_genres_tags"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
tools:maxLines="10"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/manga_summary_label"
|
app:layout_constraintTop_toBottomOf="@id/manga_summary_label"
|
||||||
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />
|
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />
|
||||||
@ -301,6 +265,8 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"
|
||||||
|
tools:layout_height="100dp"
|
||||||
app:atg_backgroundColor="@android:color/transparent"
|
app:atg_backgroundColor="@android:color/transparent"
|
||||||
app:atg_borderColor="@color/md_blue_A400"
|
app:atg_borderColor="@color/md_blue_A400"
|
||||||
app:atg_borderStrokeWidth="1dp"
|
app:atg_borderStrokeWidth="1dp"
|
||||||
@ -314,12 +280,15 @@
|
|||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/less_button"
|
android:id="@+id/less_button"
|
||||||
style="@style/Theme.Widget.Button.TextButton"
|
style="@style/Theme.Widget.Button.TextButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/less"
|
android:text="@string/less"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
android:textAlignment="textEnd"
|
android:textAlignment="textEnd"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/start_reading_button"
|
app:layout_constraintBottom_toTopOf="@id/start_reading_button"
|
||||||
app:layout_constraintTop_toBottomOf="@id/manga_genres_tags"
|
app:layout_constraintTop_toBottomOf="@id/manga_genres_tags"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/reader_layout"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:id="@+id/action_mark_as_read"
|
||||||
|
android:title="@string/action_mark_as_read" />
|
||||||
|
|
||||||
|
<item android:id="@+id/action_mark_as_unread"
|
||||||
|
android:title="@string/action_mark_as_unread" />
|
||||||
|
|
||||||
<item android:id="@+id/action_bookmark"
|
<item android:id="@+id/action_bookmark"
|
||||||
android:title="@string/action_bookmark"
|
android:title="@string/action_bookmark"
|
||||||
android:visible="true" />
|
android:visible="true" />
|
||||||
@ -9,14 +15,4 @@
|
|||||||
<item android:id="@+id/action_remove_bookmark"
|
<item android:id="@+id/action_remove_bookmark"
|
||||||
android:title="@string/action_remove_bookmark"
|
android:title="@string/action_remove_bookmark"
|
||||||
android:visible="true" />
|
android:visible="true" />
|
||||||
|
|
||||||
<item android:id="@+id/action_mark_as_read"
|
|
||||||
android:title="@string/action_mark_as_read" />
|
|
||||||
|
|
||||||
<item android:id="@+id/action_mark_as_unread"
|
|
||||||
android:title="@string/action_mark_as_unread" />
|
|
||||||
|
|
||||||
<item android:id="@+id/action_mark_multiple"
|
|
||||||
android:title="@string/action_mark_multiple"/>
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -114,6 +114,7 @@
|
|||||||
<string name="action_save">Save</string>
|
<string name="action_save">Save</string>
|
||||||
<string name="action_reset">Reset</string>
|
<string name="action_reset">Reset</string>
|
||||||
<string name="action_undo">Undo</string>
|
<string name="action_undo">Undo</string>
|
||||||
|
<string name="action_use_default">Use Default</string>
|
||||||
<string name="action_create">Create</string>
|
<string name="action_create">Create</string>
|
||||||
<string name="action_restore">Restore</string>
|
<string name="action_restore">Restore</string>
|
||||||
<string name="action_webview_back">Back</string>
|
<string name="action_webview_back">Back</string>
|
||||||
@ -610,6 +611,8 @@
|
|||||||
<string name="transition_pages_loading">Loading pages…</string>
|
<string name="transition_pages_loading">Loading pages…</string>
|
||||||
<string name="transition_pages_error">Failed to load pages: %1$s</string>
|
<string name="transition_pages_error">Failed to load pages: %1$s</string>
|
||||||
<string name="reader_pull_up_for_more_options">Pull up for more options</string>
|
<string name="reader_pull_up_for_more_options">Pull up for more options</string>
|
||||||
|
<string name="reading_mode">Reading %1$s</string>
|
||||||
|
<string name="webtoon_style">webtoon style</string>
|
||||||
|
|
||||||
<!-- Recent manga fragment -->
|
<!-- Recent manga fragment -->
|
||||||
<string name="recent_manga_source">%1$s - Ch.%2$s</string>
|
<string name="recent_manga_source">%1$s - Ch.%2$s</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user