What I do is in the mainactivity where screens are...
# compose
m
What I do is in the mainactivity where screens are dispatched make one of them being the setup screen, and perform all initializations on that screen when they are done I set the current screen to the main one .... But I'm a little bit concerned about startup times of compose app, I'm not sure 100% but I feel they have sensible increased in the last two betas .
g
It’s really bad solution, it slowdonws app startup, and it’s not unique for compose
splash screen for older versions of android should be just a background of you theme, in this case system will show it during app creation and them will let you show anything on your main activity
m
maybe, but at install time I want write things like SetUp loading this...loading that, an not left the user in front of a dumb screen.
g
install time?
I mean there are cases when app should init something after start, but instead of “splash screen” just show proper UI with loader and message to user
m
First time you install the app ...
g
splash screen is like low level loader visible during app init, before you able to show any ui, when app is loaded there is no reason for splash screen
you show nothing during app installation, right, you probably mean first app start after installation, but why it should be a splash screen instead of just element of ui?
m
well, to avoid the white screen?
g
yes, this “white screen” is actually activvity with default theme, and you can improve it if set proper default theme to it
it can be just windowBackground
but there is no way to render any text on it, for example see how it works on Android 12 which has special API for this, but it essentially just improved default behaviour: https://developer.android.com/about/versions/12/features/splash-screen
You can achieve very similar results by just setting windowBackground to your default background
m
that's what I do
g
screens are dispatched make one of them being the setup screen
maybe I misunderstood you
but not sure how your original comment implies this
also you mentioned “compose”, which is irrelevant in this case, because this default background is visible before any of your activities even created
m
Jesus I'm talking about splash screen in compose not in anything else
And I'm more concerned about the experimented delay in app startup in recent releases, though O my be wrong
g
talking about splash screen in compose
But there is no need to any kind splash screen in compose
splash screen is required only for stage when system loads your app and before your main activity onCreate
m
then call it set up screen, the one shown to the users in case you have to perform relevant time tasks
g
yes, but isn’t it just standard compose ui? @Compose fun renderUi() { if (inited) showMainUi else showSetUpUi() }
m
Copy code
if(sApp.currentScreen.value==Screens.SetUpScreen) { setupscreen(); return }
else the rest of app
And at that time since nothing has been set, no matherial theme no anything, you can indeed write to the background screen
Just in case you want to know what I'm talking about