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
This commit is contained in:
Ivan Iskandar 2021-06-27 22:39:26 +07:00 committed by GitHub
parent 60890147c3
commit e2cf157857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -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) {

View File

@ -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)
}
}
/**

View File

@ -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