From e2cf15785766f5a386c536154d055e18970adfac Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Sun, 27 Jun 2021 22:39:26 +0700 Subject: [PATCH] Reader fixes after #5450 (#5465) * Fix ReaderActivity system bars behavior * Fix ReaderActivity transition view text color * Don't change reader navbar color when windowLightNavigationBar is not available --- .../eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 7 ++++--- .../ui/reader/viewer/ReaderTransitionView.kt | 11 +++++++++++ app/src/main/res/layout/reader_transition_view.xml | 2 +- 3 files changed, 16 insertions(+), 4 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 754d1295f..3e6210bd6 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 @@ -142,8 +142,6 @@ class ReaderActivity : BaseRxActivity() binding = ReaderActivityBinding.inflate(layoutInflater) setContentView(binding.root) - windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE - if (presenter.needsInit()) { val manga = intent.extras!!.getLong("manga", -1) val chapter = intent.extras!!.getLong("chapter", -1) @@ -365,7 +363,9 @@ class ReaderActivity : BaseRxActivity() val systemBarsColor = (binding.toolbarBottom.background as ColorDrawable).color window.statusBarColor = systemBarsColor - window.navigationBarColor = systemBarsColor + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { + window.navigationBarColor = systemBarsColor + } (binding.toolbar.background as MaterialShapeDrawable).fillColor = ColorStateList.valueOf(systemBarsColor) // Set initial visibility @@ -513,6 +513,7 @@ class ReaderActivity : BaseRxActivity() } else { if (preferences.fullscreen().get()) { windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()) + windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE } if (animate) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt index 2cb040e3f..d1d8a541c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt @@ -8,8 +8,11 @@ import androidx.core.text.bold import androidx.core.text.buildSpannedString import androidx.core.view.isVisible import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.ReaderTransitionViewBinding import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get class ReaderTransitionView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout(context, attrs) { @@ -28,6 +31,14 @@ class ReaderTransitionView @JvmOverloads constructor(context: Context, attrs: At } missingChapterWarning(transition) + + val color = when (Injekt.get().readerTheme().get()) { + 0 -> context.getColor(android.R.color.black) + else -> context.getColor(android.R.color.white) + } + listOf(binding.upperText, binding.warningText, binding.lowerText).forEach { + it.setTextColor(color) + } } /** diff --git a/app/src/main/res/layout/reader_transition_view.xml b/app/src/main/res/layout/reader_transition_view.xml index d40d40e7e..b55a5da64 100644 --- a/app/src/main/res/layout/reader_transition_view.xml +++ b/app/src/main/res/layout/reader_transition_view.xml @@ -28,7 +28,7 @@ android:layout_marginEnd="8dp" android:scaleType="fitCenter" app:srcCompat="@drawable/ic_warning_white_24dp" - app:tint="?attr/colorOnBackground" + app:tint="?attr/colorError" tools:ignore="ContentDescription" />