File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
app/src/main/java/eu/kanade/tachiyomi/ui Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -49,17 +49,19 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
4949 appState.isSplashShown = true
5050 }
5151
52- val splashScreen = installSplashScreen()
52+ return installSplashScreen()
53+ }
54+
55+ fun SplashScreen.configure () {
5356 val startTime = System .currentTimeMillis()
54- splashScreen .setKeepOnScreenCondition {
57+ this .setKeepOnScreenCondition {
5558 val elapsed = System .currentTimeMillis() - startTime
5659 elapsed <= SPLASH_MIN_DURATION || (! appState.ready && elapsed <= SPLASH_MAX_DURATION )
5760 }
58-
59- return splashScreen
61+ this .setSplashScreenExitAnimation()
6062 }
6163
62- fun SplashScreen.setSplashScreenExitAnimation () {
64+ private fun SplashScreen.setSplashScreenExitAnimation () {
6365 val root = findViewById<View >(android.R .id.content)
6466
6567 if (Build .VERSION .SDK_INT < Build .VERSION_CODES .S ) {
Original file line number Diff line number Diff line change @@ -242,6 +242,8 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
242242 }
243243
244244 override fun onCreate (savedInstanceState : Bundle ? ) {
245+ val splashScreen = maybeInstallSplashScreen(savedInstanceState)
246+
245247 // Set up shared element transition and disable overlay so views don't show above system bars
246248 window.requestFeature(Window .FEATURE_ACTIVITY_TRANSITIONS )
247249 setExitSharedElementCallback(
@@ -266,8 +268,6 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
266268 )
267269 window.sharedElementsUseOverlay = false
268270
269- val splashScreen = maybeInstallSplashScreen(savedInstanceState)
270-
271271 super .onCreate(savedInstanceState)
272272
273273 backPressedCallback = object : OnBackPressedCallback (enabled = true ) {
@@ -652,7 +652,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
652652 (router.backstack.lastOrNull()?.controller as ? BaseLegacyController <* >)?.setTitle()
653653 (router.backstack.lastOrNull()?.controller as ? SettingsController )?.setTitle()
654654
655- splashScreen?.setSplashScreenExitAnimation ()
655+ splashScreen?.configure ()
656656
657657 getExtensionUpdates(true )
658658
Original file line number Diff line number Diff line change @@ -275,6 +275,8 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
275275 * Called when the activity is created. Initializes the view model and configuration.
276276 */
277277 override fun onCreate (savedInstanceState : Bundle ? ) {
278+ val splashScreen = maybeInstallSplashScreen(savedInstanceState)
279+
278280 // Setup shared element transitions
279281 if (intent.extras?.getString(TRANSITION_NAME ) != null ) {
280282 window.requestFeature(Window .FEATURE_ACTIVITY_TRANSITIONS )
@@ -291,8 +293,6 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
291293 }
292294 }
293295
294- val splashScreen = maybeInstallSplashScreen(savedInstanceState)
295-
296296 super .onCreate(savedInstanceState)
297297 binding = ReaderActivityBinding .inflate(layoutInflater)
298298 setContentView(binding.root)
@@ -301,7 +301,7 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
301301 a.recycle()
302302 setCutoutMode()
303303
304- splashScreen?.setSplashScreenExitAnimation ()
304+ splashScreen?.configure ()
305305
306306 wic.isAppearanceLightStatusBars = lightStatusBar
307307 wic.isAppearanceLightNavigationBars = lightStatusBar
You can’t perform that action at this time.
0 commit comments