-
-
Notifications
You must be signed in to change notification settings - Fork 310
Modernize Android splash screen #1884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Great stuff! Thanks for this.
You can find logo svg sources here: https://github.com/lichess-org/lila/tree/master/public/logo. (Note the logo looks good in your screenshots). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judging from the screenshots this is better than before, so these changes look good to me.
However you might want to have a look at: https://pub.dev/packages/flutter_native_splash
We're using this package in the application, see:
Line 138 in d283f64
flutter_native_splash:
This is needed to continue to show the splash screen while flutter is loading, so the splash screens defined here should be the same as the ones defined on android side.
# Conflicts: # android/app/src/main/res/values/colors.xml
|
Oh I see, what I removed is all codegen. Sorry, I'm new to Flutter. From what I can tell, I you'd like to replace what |
Actually I don't remember how this package works, as it was a long time ago. From what I remember the reason I used this is to avoid an empty screen during the loading time of Flutter engine. As long as the trick of delaying the removal of splash screen, as done here: Line 30 in c825724
If I understand you correctly, we can use |
|
Looking at the implementation for
Running |
|
Applied official logo in df717db |
|
Configured |
| <!-- Specifies an Android theme to apply to this Activity as soon as | ||
| the Android process has started. This theme is visible to the user | ||
| while the Flutter UI initializes. After that, this theme continues | ||
| to determine the Window background behind the Flutter UI. --> | ||
| <meta-data | ||
| android:name="io.flutter.embedding.android.NormalTheme" | ||
| android:resource="@style/NormalTheme"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to no longer be necessary with Flutter 2.5 based on a note here. This meta data is not applied in the corresponding sample app.
| <style name="SplashTheme" parent="SplashTheme.NightAdjusted"> | ||
| <item name="windowSplashScreenBackground">@color/bg_splash</item> | ||
| <item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash</item> | ||
| <item name="postSplashScreenTheme">@style/NormalTheme</item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what tells Android to switch themes once the app is loaded.
|
Tested on 3 different devices with Android 9, 10, 11, and an emulator with Android 15. Thanks again! |
Visually, there shouldn't be much difference, but this does allow for the clean up a number of
.pngassets and (now) redundant styles. These changes leverage Android's splash screen compatibility library, which backports Android 12's splash screen features to API 23+.The splash screen's theme now extends the framework
Theme.SplashScreenand is applied to the main Activity in essentially the same way it was before. It utilizes a single vector drawable for the logo across all API levels(derived from here, so please let me know if there's a better one I should use). I referenced these docs for new asset's dimensions. I just noticed while taking screenshots for this PR that the existing app crops the horse's ear on API 31+.For reference, the Flutter samples apply a splash screen in a similar manner to this PR.
API 30 (30 and lower now using compat lib)
API 36 (31+ mostly unchanged)