Status Update
Comments
el...@ziklo.com <el...@ziklo.com> #2
The splash screen is dismissed as soon as the app is drawn and doesn't wait for the animation to finish which might be the reason why the animation doesn't repeat.
At most, the icon will animate for the value set in windowSplashScreenAnimationDuration
.
If that's not the case, can you please share your theme values and icon file? or at least a reproduction sample?
ad...@google.com <ad...@google.com>
ad...@google.com <ad...@google.com> #3
windowSplashScreenBackground is #fff and #000 for dark theme.
The animation duration of Animated Vector Drawable is 1600.
I might not be able to share the icon since it is the one we are going to use in production. Is there any working Animated Vector Drawable you can provide from your side for us to compare? Anything from unit test?
al...@google.com <al...@google.com>
ca...@google.com <ca...@google.com> #4
el...@ziklo.com <el...@ziklo.com> #5
In the <objectAnimator
tag, you need the repeat*
attributes
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:valueTo="200"
android:valueType="floatType"
android:propertyName="y"
android:repeatCount="1"
android:repeatMode="reverse"/>
ca...@google.com <ca...@google.com> #6
cr...@gmail.com <cr...@gmail.com> #7
ca...@google.com <ca...@google.com> #8
In that case, you'd need to manually make you application repeat using other ObjecAnimator. Since the splash screen is supposed to be short lived, an animation shouldn't need to be repeated.
If the loading time of your application is too high and require the use of some progress indicator, then I suggest to implement that in the app directly, ideally using skeletons loaders (
[Deleted User] <[Deleted User]> #9
ar...@soundcloud.com <ar...@soundcloud.com> #10
That's definitely something worth discussing internally, I've added it to the list of thing to consider for the next version. Thanks for your feedback.
[Deleted User] <[Deleted User]> #11
[Deleted User] <[Deleted User]> #12
ca...@google.com <ca...@google.com> #13
ca...@google.com <ca...@google.com> #14
On Android 12 the splash screen icon won't be shown from when launching from Studio and notification. For deep links it will depend on the browser behavior (see
This is out of control for the library and will be changed for Android T.
[Deleted User] <[Deleted User]> #15
We have seen it happening also in prod out there.
ol...@gmail.com <ol...@gmail.com> #16
I am currently keeping the splashScreen visible until login state has been checked, then I either remove it and show login or perform an animation on the splashScreenView icon before starting the next activity. I believe the solution mentioned above would not let my animation finish?
See my current code below, is there a way to identify when the 'OnExitAnimationListener' will not be called and just do the same stuff (minus animation) after the loading is done? Id didn't find a way for an activity to see what options it was launched with for getting the value of 'android.activity.splashScreenStyle'.
installSplashScreen().let { splashScreen ->
splashScreen.setKeepOnScreenCondition {
!isLoadingDone
}
splashScreen.setOnExitAnimationListener { splashScreenView ->
if (isLoggedIn) {
val animSet = createSplashIconAnimSet(splashScreenView)
animSet.doOnEnd {
startMainActivityAndFinish()
}
animSet.start()
} else {
splashScreenView.remove()
}
}
}
ca...@google.com <ca...@google.com> #17
I would do something like this instead, where you keep the splash screen visible and handle the animation on your main activity:
LoginActivity:
onCreate() {
val splashScreen = installSplashScreen()
splashScreen.setKeepOnScreenCondition {
!isLoadingDone
}
doLoadingStuff()....
}
fun doLoadingStuff() {
...
if(isLoggedIn) {
startMainActivityAndFinish()
} else {
isLoadingDone = true
// Splash Screen will be removed autmatically
}
}
MainActivity:
onCreate() {
val splashScreen = installSplashScreen()
splashScreen.setOnExitAnimationListener { splashScreenView ->
val animSet = createSplashIconAnimSet(splashScreenView)
animSet.start()
de...@gmail.com <de...@gmail.com> #18
If you're never setting the content view, then setOnAnimationExitListener will never be called since your activity doesn't draw, so the splash screen isn't removed. In that case, just call call first handleRouting() and then installSplashScreen(). It should work like you intend."
I am not sure about this, I tried it on Android L and it works. Why wouldn't that work on Android S???
r....@fenrir.co.jp <r....@fenrir.co.jp> #19
11...@gmail.com <11...@gmail.com> #20
I use 'getSplashScreen().setOnExitAnimationListener' instead of 'androidx.core:core-splashscreen'.
I just would like to set up duration of sprashscreen's fade-out animation to 200ms.
Does anyone know the default duration of fade-out animation?
ee...@gmail.com <ee...@gmail.com> #21
And also, as other developers noted, this is really really a pain in the butt to develop, having to manually kill the app and launch it manually every time, instead of just launching the app from Android Studio.
Right now I decided to not use this library as this is ridiculous. With `windowDrawable` we didn't have this many problems! Why fix something that is not broken?
la...@gmail.com <la...@gmail.com> #22
de...@gmail.com <de...@gmail.com> #23
BaseActivity
```
override fun onCreate(savedInstanceState: Bundle?) {
installSplash()
super.onCreate(savedInstanceState)
_binding = bindingInflater().invoke(layoutInflater)
setContentView(binding.root)
initViews(binding)
subscribeUI()
}
```
Child Activity
```
override fun installSplash() {
splashScreen = installSplashScreen().apply {
setOnExitAnimationListener { // Never called on SDK 31 and 32
// Do nothing so the splash screen will remain visible
splashScreenViewProvider = it
// Navigate to Activity after some process
navigateToActivity()
}
}
}
```
This works well except for SDK 31 and 32. Clearly this is a bug but no one seems to care of fixing it properly.
ri...@gmail.com <ri...@gmail.com> #24
Does anyone have an elegant solution?
ri...@gmail.com <ri...@gmail.com> #25
Most of this discussion is centered around the feature not working in Debug mode. Well, from my experience, this is NOT limited to Debug mode; it is happening on a Production device.
The device is a Blu G33 running Android Go (Android 13 - SDK 33). The symptoms are identical to what is discussed in this thread. White launch screen devoid of the Splash Screen icon and the the listener never fires. It doesn't matter whether I call installSplashScreen() before or after onCreate() and it doesn't matter whether I set the content view in the Main activity.
It would appear that the Splash API is not supported in Android Go? If that is the case, are there any suggestions or guidance on how to get around the white screen that pops up on the screen? I have implemented a one second delay in the Main to fire and resume the start up sequence if the listener doesn't fire. This is a kluge and can be problematic on other devices after a cold boot.
jo...@gmail.com <jo...@gmail.com> #26
Yep. Cop out is accurate.
This is not working on Android 12 / 13 on prod builds and we are setting the content view.
This is a one-activity, full-compose app.
As a result our users on Samsung devices cannot get past our splash screen on Android 12 and 13.
A fix for this is necessary.
de...@gmail.com <de...@gmail.com> #27
setOnExitAnimationListener
will still get called even when declared before setContentView
. It's just that in Android 12 and 13 when the app was launched via IDE or instrumentation the setOnExitAnimationListener
will never get called, the worst part of this is it doesn't happen on Android 14 and above. So always check your app against each of the Android version you are covering since the new Android teams like to deliver breaking changes feature with half-baked solution just like the new edge to edge enforcement.
Description
I'm using dependency
"androidx.core:core-splashscreen:1.0.0-alpha01"
for my splash screen. Using Android Gradle Plugin 7.0.1 (with Android Studio Arctic Fox 2020.3.1 Patch 1), Kotlin 1.5.20 and Java 11 setup in the IDE and for the project.I use my own SplashActivity required for routing the user to different activities depending on the situation (doing anti-root checks, authentication checks etc).
My
onCreate()
has the following:and I'm never calling
setContentView()
.Everything else is setup according to the migration guidelines:
https://developer.android.com/about/versions/12/splash-screen-migration
The problem is, when I run my app through Android Studio in debug mode the
windowSplashScreenAnimatedIcon
drawable set in theTheme.App.Starting
theme is never shown andsetOnExitAnimationListener
is never called. So my application stays stuck in SplashActivity and the routing can never occur. When I run my app again using the app launcher manually, it runs as expected and both the drawable is visible and the routing is successful as the listener works as expected.I'm running the app on a physical device, Google Pixel 4 XL. Using the latest Android 12 Build (from 5 aug). I've attached the project to reproduce it, created a new one from the Login template with the addition of the SplashScreen and SplashActivity.