mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 20:21:48 +01:00
Fix light navigation bar not applied on first launch (#5582)
No need to touch light system bars when running the splash screen since they're not that noticeable, and it also breaks on some ROMs.
This commit is contained in:
parent
fece92e15a
commit
116fec208b
@ -17,7 +17,6 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
|||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
||||||
@ -294,12 +293,6 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
window.statusBarColor = Color.TRANSPARENT
|
window.statusBarColor = Color.TRANSPARENT
|
||||||
window.navigationBarColor = Color.TRANSPARENT
|
window.navigationBarColor = Color.TRANSPARENT
|
||||||
|
|
||||||
val wicc = WindowInsetsControllerCompat(window, window.decorView)
|
|
||||||
val isLightStatusBars = wicc.isAppearanceLightStatusBars
|
|
||||||
val isLightNavigationBars = wicc.isAppearanceLightNavigationBars
|
|
||||||
wicc.isAppearanceLightStatusBars = false
|
|
||||||
wicc.isAppearanceLightNavigationBars = false
|
|
||||||
|
|
||||||
splashScreen.setOnExitAnimationListener { splashProvider ->
|
splashScreen.setOnExitAnimationListener { splashProvider ->
|
||||||
// For some reason the SplashScreen applies (incorrect) Y translation to the iconView
|
// For some reason the SplashScreen applies (incorrect) Y translation to the iconView
|
||||||
splashProvider.iconView.translationY = 0F
|
splashProvider.iconView.translationY = 0F
|
||||||
@ -313,19 +306,12 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var barColorRestored = false
|
|
||||||
val splashAnim = ValueAnimator.ofFloat(1F, 0F).apply {
|
val splashAnim = ValueAnimator.ofFloat(1F, 0F).apply {
|
||||||
interpolator = FastOutSlowInInterpolator()
|
interpolator = FastOutSlowInInterpolator()
|
||||||
duration = SPLASH_EXIT_ANIM_DURATION
|
duration = SPLASH_EXIT_ANIM_DURATION
|
||||||
addUpdateListener { va ->
|
addUpdateListener { va ->
|
||||||
val value = va.animatedValue as Float
|
val value = va.animatedValue as Float
|
||||||
splashProvider.view.alpha = value
|
splashProvider.view.alpha = value
|
||||||
|
|
||||||
if (!barColorRestored && value <= 0.5F) {
|
|
||||||
barColorRestored = true
|
|
||||||
wicc.isAppearanceLightStatusBars = isLightStatusBars
|
|
||||||
wicc.isAppearanceLightNavigationBars = isLightNavigationBars
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
doOnEnd {
|
doOnEnd {
|
||||||
splashProvider.remove()
|
splashProvider.remove()
|
||||||
|
Loading…
Reference in New Issue
Block a user