apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.66k stars 1.55k forks source link

Splash screen background color is always black if dark mode is on #1485

Open geshub opened 2 years ago

geshub commented 2 years ago

Bug Report

Problem

With the new splash screen API configured correctly I always get a black background color on the splash screen if my device is in dark mode.

What is expected to happen?

I expect to have my splash screen background color set to AndroidWindowSplashScreenBackground or have another way to set it for dark mode.

What does actually happen?

Background color is correct when dark mode is off but always black if on.

Information

Tested on device

Environment, Platform, Device

Mi 11 - Android 12

Version information

Using Ionic framework

Checklist

breautek commented 2 years ago

Android documentation for anyone willing to explore implementing DayNight themes for proper dark mode support: https://developer.android.com/develop/ui/views/theming/darktheme#launch_screens

geshub commented 2 years ago

I've just tested in an Android 12 simulator and splash screen got the correct color on light / dark mode. The problem occurs on device ( Xiaomi 11 - Android 12 ), so it might be related to MIUI. Could anyone confirms if the slash screen background color is working on a Xiaomi device with dark mode activated ?

SidiBecker commented 2 years ago

Same issue here, Xiaomi, Redmi Note 10 Pro

SidiBecker commented 2 years ago

In the same device, the .png image I set in AndroidWindowSplashScreenAnimatedIcon appears square instead of circular, like on other devices.

niravparsana94 commented 1 year ago

Xiaomi - Redmi Note 10 Pro. "AndroidWindowSplashScreenBackground" value is not respected. How can I have a same color for both light and dark mode?

daniel-gm-santos commented 1 year ago

Xiaomi - Redmi Note 10 Pro. "AndroidWindowSplashScreenBackground" value is not respected. How can I have a same color for both light and dark mode?

Seems to be a common problem for Xiaomi mobiles... Would also love to know how to work around this...

jeanribeirov commented 1 year ago

Same issue here, Xiaomi Redmi Note 11... I would like a possible solution

geshub commented 1 year ago

Setting the android:windowBackground to the desired color in the splash screen theme fixes the issue (Tested on a Redmi note 10s).

Are you on Android 12 ?

geshub commented 1 year ago

yes, on android 12 with miui 13

Thanks, do you have any other variables set for dark mode, because I've got android:windowBackground set in a theme.xml and it's still black when dark mode is on ?

rsteimen commented 1 year ago

We could reproduce this issue on Xiaomi Redmi 9A (M2006C3LG) with Android 11 (RP1A.200720.011), and both MIUI 12.5.3, 12.5.7. Our app works fine in light mode.

Suggested fix by @DeVictorVH didn't worked. The custom color for android:windowBackground was shown in light mode but in dark mode the display remained black. As a workaround we disabled dark mode for our app in "Settings - Display - More dark mode options" on problematic devices.

MoraesFausto commented 1 year ago

Same issue here, both splash screen color and png image are showing the expected behaviour on light mode. Although, the image is being displayed in a square format and the screen color gets black when on dark mode. Does anyone know a way to prevent dark mode from being activated in this case?

SWRHARD commented 1 year ago

Same issue, try to add: uiManager.setApplicationNightMode(MODE_NIGHT_NO) or setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO), but nothing is changed Device info: Redmi Note 10S MIUI Global 14.0.1 Android 13

ubarua123 commented 11 months ago

This is a huge issue in Miui.. and no user goes in the system settings and turns off dark mode for a single app. So now my app looks broken right at the splash screen. Any working solution would be welcome here.

riamon-v commented 1 month ago

this might work https://stackoverflow.com/questions/69034252/android-colors-in-dark-mode