浏览代码

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
Ivan Iskandar 3 年之前
父节点
当前提交
e2cf157857

+ 4 - 3
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt

@@ -142,8 +142,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
         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<ReaderActivityBinding, ReaderPresenter>()
 
         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<ReaderActivityBinding, ReaderPresenter>()
         } else {
             if (preferences.fullscreen().get()) {
                 windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
+                windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
             }
 
             if (animate) {

+ 11 - 0
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<PreferencesHelper>().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)
+        }
     }
 
     /**

+ 1 - 1
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" />
 
         <TextView