IDEMSInternational / open-app-builder

PLH App Frontend
GNU General Public License v3.0
6 stars 25 forks source link

[BUG] Splash screen inconsistently applied #2438

Open chrismclarke opened 3 weeks ago

chrismclarke commented 3 weeks ago

Describe the bug As part of API changes to Android 12, splash screens running on Android 12 or higher (API 31+) devices display differently to those running on lower versions https://developer.android.com/develop/ui/views/launch/splash-screen#how

The new behaviour by default displays the app logo on a plain background. This is likely inconsistent if a custom splash screen has been specified

To Reproduce Describe the steps to reproduce this bug.

Screenshots and videos Android 11 - Legacy splash screen shows

android-api-30.webm

Android 12+ - App icon shows

android-api-34.webm

Sidenote - It would be good to remove the content-specific splash screens from the default app branch and replace with placeholder ones used in debug repo.

Discussion

The API 12 changes come both with new functionality but also limitations. Splash icons can now be Animated Vector Drawable format which supports a form of animated SVG, however the size of the icon is tightly constrained (fits within a 192dp diameter circle within a 288dp square).

These diagrams are however not compatible on Android 11 and below, so that gives a couple options to ensure consistency:

1. Icon-based splash Remove support for custom splash screen images and request content teams instead use the app logo (ideally provided as SVG). We could provide an additional authoring option to control background color on the splash screen as a means to enhance the logo. This svg can be converted into a standard vector asset and displayed in all android versions.

2. Animated Icon with Fallback Alternatively we could allow support for content teams to pass their own custom XML that defines animated vector drawings to show on android 12+ and use a separate fallback image defined as previous. We could also consider wrapping a couple common animation styles and exposing as a utility to automatically generate animation from the initial SVG (e.g. fade in, scale in etc.).

3. Custom splash activity A third option would be to display a mostly blank initial splash, and then launch an activity which shows a custom splash screen after on all devices. If launched from within the app itself then this could be templated in a standard way (but would likely be slow to launch), or could be implemented at the android level with whatever functionality we can expose (e.g. lottie animation files, images etc.).

Assuming the initial splash background matches the new activity background this could still be fairly seamless, just a little bit slower depending on implementation (initial splash dismisses after signal from main activity that it is ready to render, usually around 300-500ms or so, but can be configured for longer). Example at https://github.com/vcaen/splashscreen-sample

Additional context

image Android 12 and higher currently accounts for roughly 50% of users. Looking at analytics we have for existing apps we have roughly a 30/70 split for android devices above/below v12+ image

Resources [ShapeShifter - Create animated vector drawable from SVGhttps://shapeshifter.design]() (I also think it's possible to export from after-effects using same bodymovin plugin that generates lottie files, but not tested)

Example guide creating animated vector drawable

Demo code - Combining Lottie animation activity and splash icon

Android 12 splashscreen docs Android core compat splashscreen docs

chrismclarke commented 1 week ago

Short term priority: