mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Called too early
This commit is contained in:
parent
a2e1b766c7
commit
8fd4ce30b9
3 changed files with 9 additions and 6 deletions
|
@ -55,16 +55,15 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
|||
val elapsed = System.currentTimeMillis() - startTime
|
||||
elapsed <= SPLASH_MIN_DURATION || (!appState.ready && elapsed <= SPLASH_MAX_DURATION)
|
||||
}
|
||||
setSplashScreenExitAnimation(splashScreen)
|
||||
|
||||
return splashScreen
|
||||
}
|
||||
|
||||
private fun setSplashScreenExitAnimation(splashScreen: SplashScreen?) {
|
||||
fun SplashScreen.setSplashScreenExitAnimation() {
|
||||
val root = findViewById<View>(android.R.id.content)
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S && splashScreen != null) {
|
||||
splashScreen.setOnExitAnimationListener { splashProvider ->
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
this.setOnExitAnimationListener { splashProvider ->
|
||||
// For some reason the SplashScreen applies (incorrect) Y translation to the iconView
|
||||
splashProvider.iconView.translationY = 0F
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
maybeInstallSplashScreen(savedInstanceState)
|
||||
val splashScreen = maybeInstallSplashScreen(savedInstanceState)
|
||||
|
||||
// Set up shared element transition and disable overlay so views don't show above system bars
|
||||
window.requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
|
||||
|
@ -652,6 +652,8 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
|
|||
(router.backstack.lastOrNull()?.controller as? BaseLegacyController<*>)?.setTitle()
|
||||
(router.backstack.lastOrNull()?.controller as? SettingsController)?.setTitle()
|
||||
|
||||
splashScreen?.setSplashScreenExitAnimation()
|
||||
|
||||
getExtensionUpdates(true)
|
||||
|
||||
preferences.extensionUpdatesCount()
|
||||
|
|
|
@ -275,7 +275,7 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
|||
* Called when the activity is created. Initializes the view model and configuration.
|
||||
*/
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
maybeInstallSplashScreen(savedInstanceState)
|
||||
val splashScreen = maybeInstallSplashScreen(savedInstanceState)
|
||||
|
||||
// Setup shared element transitions
|
||||
if (intent.extras?.getString(TRANSITION_NAME) != null) {
|
||||
|
@ -301,6 +301,8 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
|||
a.recycle()
|
||||
setCutoutMode()
|
||||
|
||||
splashScreen?.setSplashScreenExitAnimation()
|
||||
|
||||
wic.isAppearanceLightStatusBars = lightStatusBar
|
||||
wic.isAppearanceLightNavigationBars = lightStatusBar
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue