Skip to content
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

Statusbar Color not applied immediately if you have a splash screen #145

Open
3 tasks done
AssetKid opened this issue Jul 21, 2019 · 8 comments
Open
3 tasks done

Comments

@AssetKid
Copy link

Bug Report

Problem

If you have a splash screen, the status bar color is only applied after the app loads... Not on startup.

Similar report #104

What is expected to happen?

Status bar color should be applied immediately.

What does actually happen?

Status bar color is not applied immediately.

Information

GCj9dpNFfb

Command or Code

npm run android

Environment, Platform, Device

Tested on Android 8.0 & 9.0 (Device & Emulator)

Version information

CLI

  • Cordova 9.0.0 (cordova-lib@9.0.1)

Platfrom

  • Android

Plugins

  • cordova-plugin-whitelist
  • cordova-plugin-statusbar
  • cordova-plugin-splashscreen

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@janpio
Copy link
Member

janpio commented Jul 21, 2019

How did you set up the splashscreen?

Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md

@AssetKid
Copy link
Author

AssetKid commented Jul 21, 2019

Repo - https://github.com/AssetKid/cordova-statusbar-repro

The project is made using vue.js and vue-cli-plugin-cordova. Not sure if that might be the issue.

Setup

  • npm install to install dependencies
  • npm run cordova-prepare to install cordova plugins and platform
  • npm run cordova-serve-android to start the development server
  • npm run cordova-build-android to build for production

@breautek
Copy link
Contributor

breautek commented Jul 22, 2019

Confirmed this is an issue.

If the status bar color is being set via JavaScript API such as StatusBar.backgroundColorByHexString, then I would have expected this behaviour however; if the status bar color is being set via config.xml, then I would have expected to apply the style as soon as the splashscreen is shown which it does not appear to do so.

Just for assurance... I am going to test this on a vanilla cordova project. Confirmed this is also an issue on a vanilla cordova project with cordova-plugin-splashscreen & cordova-plugin-statusbar plugins added. The statusbar plugin only appears to apply the change after the splashscreen delay.

Note I only tested on Android.

@janpio
Copy link
Member

janpio commented Jul 22, 2019

Is this more a statusbar or more a splashscreen problem @breautek?

@breautek
Copy link
Contributor

I had a quick look at the source code last night before bed and it wasn't immediately obvious @janpio . statusbar makes calls to read from config.xml and to set the status bar styling/colors during the initialize method which as far as I know is the earliest a plugin can execute code.

This leads me to believe that perhaps something in splashscreen is blocking execution of other plugins during its splashscreen delay but I haven't proven that theory, nor did anything jumped out at me at a quick glance at its source code.

@jcesarmobile
Copy link
Member

I think the way the native splash view is built and presented doesn’t allow to style the status bar

@breautek
Copy link
Contributor

breautek commented Oct 1, 2019

There's actually a pending PR in splashscreen that appears to address this issue.

apache/cordova-plugin-splashscreen#124

@stritchi
Copy link

This problem still exists and I tried to find where the black bars are coming from.

a. in the file splashscreen.java the defaut theme android.R.style.Theme_Translucent_NoTitleBar is loaded to build the dialogue and this of course overwrites everything that you have set up before. I solved it to overwrite this file to access my own module style.

            // Create and show the dialog
            splashDialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants