From 31800027a1fadf37b0ccf1c64af3cf2e911f9496 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 4 May 2020 18:38:27 -0400 Subject: [PATCH] Setting webtoon view background to always black closes #262 --- .../kanade/tachiyomi/ui/reader/ReaderActivity.kt | 8 ++++++++ .../tachiyomi/ui/reader/ReaderSettingsSheet.kt | 15 +++++++++------ .../viewer/webtoon/WebtoonTransitionHolder.kt | 2 ++ .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 2 ++ app/src/main/res/layout/reader_settings_sheet.xml | 3 ++- 5 files changed, 23 insertions(+), 7 deletions(-) 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 522ded9bc9..737f3ec124 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 @@ -459,6 +459,14 @@ class ReaderActivity : BaseRxActivity(), viewer = newViewer viewer_container.addView(newViewer.getView()) + viewer_container.setBackgroundColor( + if (viewer is WebtoonViewer) { + Color.BLACK + } else { + getResourceColor(android.R.attr.colorBackground) + } + ) + toolbar.title = manga.title page_seekbar.isRTL = newViewer is R2LPagerViewer diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt index d011e60084..1248d467b0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt @@ -92,12 +92,8 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : is WebtoonViewer -> initWebtoonPreferences() } - val bottomEdgeView = when (activity.viewer is PagerViewer) { - true -> page_transitions - false -> webtoon_side_padding - } - - setBottomEdge(bottomEdgeView, activity) + setBottomEdge(page_transitions, activity) + setBottomEdge(webtoon_side_padding, activity) close_button.setOnClickListener { dismiss() @@ -117,6 +113,13 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : private fun initGeneralPreferences() { viewer.onItemSelectedListener = IgnoreFirstSpinnerListener { position -> activity.presenter.setMangaViewer(position) + + val mangaViewer = activity.presenter.getMangaViewer() + if (mangaViewer == ReaderActivity.WEBTOON || mangaViewer == ReaderActivity.VERTICAL_PLUS) { + initWebtoonPreferences() + } else { + initPagerPreferences() + } } viewer.setSelection(activity.presenter.manga?.viewer ?: 0, false) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt index 47996f2e21..bb8050d757 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon +import android.graphics.Color import android.graphics.Typeface import android.text.SpannableStringBuilder import android.text.Spanned @@ -38,6 +39,7 @@ class WebtoonTransitionHolder( */ private var textView = TextView(context).apply { textSize = 17.5F + setTextColor(Color.WHITE) wrapContent() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index e61b3afd80..3633902957 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon +import android.graphics.Color import android.view.KeyEvent import android.view.MotionEvent import android.view.View @@ -64,6 +65,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr val subscriptions = CompositeSubscription() init { + recycler.setBackgroundColor(Color.BLACK) recycler.visibility = View.GONE // Don't let the recycler layout yet recycler.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT) recycler.itemAnimator = null diff --git a/app/src/main/res/layout/reader_settings_sheet.xml b/app/src/main/res/layout/reader_settings_sheet.xml index a18f91b185..4adbdff6b5 100644 --- a/app/src/main/res/layout/reader_settings_sheet.xml +++ b/app/src/main/res/layout/reader_settings_sheet.xml @@ -81,6 +81,7 @@ app:layout_constraintTop_toBottomOf="@id/viewer" />