Code Monkey home page Code Monkey logo

cordova-plugin-android-window-background's Introduction

โ„๏ธ cordova-plugin-android-window-background ๐ŸŽจ ๐Ÿญ

Latest Stable Version Total Downloads License Made by WINTER

This is a simple plugin for Android which will set the window background color for you app's MainActivity to a color of your choice. This allows you to avoid the standard dark grey background which will flash for a second before your splash screen appears. Set the color to the same background as your splash screen for a smoother start-up effect.

Installation

You'll need to set your desired window background color while installing the plugin by supplying the WINDOW_BACKGROUND_COLOR variable. Set it to whatever you want, preferrably the same color as your splash screen.

cordova plugin add cordova-plugin-android-window-background --variable WINDOW_BACKGROUND_COLOR=#ff69b4 --save

Or install directly from this repo:

cordova plugin add https://github.com/winteragency/cordova-plugin-android-window-background.git --variable WINDOW_BACKGROUND_COLOR=#ff69b4 --save

Supported Platforms

  • Android (cordova-android 7.0.0+)

Configuration

A custom WINDOW_BACKGROUND_COLOR variable will be added to your app's config.xml after installation with the value you selected (provided you included the --save flag). You can change it whenever you want, but you'll need to remove and re-add the Android platform from your project in order for the change to go through.

<plugin name="cordova-plugin-window-background">
    <variable name="WINDOW_BACKGROUND_COLOR" value="#B4D455" />
</plugin>

To re-add the Android platform:

cordova platform remove android
cordova platform add android

TODO

  • Set status bar and/or navigation bar color in the theme as well. The standard Cordova Status Bar plugin will set the status bar color only after the app has initalized, resulting in an ugly translucent status bar while the splash screen is showing.
  • Allow an image background to be used as windowBackground? Perhaps set it to the same image as the splash screen automatically?
  • Find a way to make changes to config.xml automatically update without having to re-add the platform.

License

The MIT License

Copyright (c) 2018, WINTER AGENCY

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cordova-plugin-android-window-background's People

Contributors

marcusforsberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cordova-plugin-android-window-background's Issues

Update plugin to support Navbar color

Hello.
This plugin works great for updating the app background color on startup. Great job!!
On the plugin todo list, i notice there are plans to add support for changing the navbar color as well; this addition would be excellent. Would really love to see this.
Please any timeline on when this feature will be implemented?

Thanks for all your open source work

Plugin does not clean up platform changes when removed

When removing this plugin with cordova plugin remove cordova-plugin-android-window-background the Android project can no longer build.

It appears the plugin has left behind modifications to android:theme in AndroidManifest.xml.

Fixing this requires either a remove/add of the Android platform or manual modification of AndroidManifest.xml.

:processDebugResourcesC:\Projects\kudos-boards-pwa-cordova\platforms\android\build\intermediates\manifests\full\debug\AndroidManifest.xml:28: AAPT: error: resource style/CordovaWindowBackgroundTheme (aka com.kudosboards.pwa:style/CordovaWindowBackgroundTheme) not found.

C:\Projects\kudos-boards-pwa-cordova\platforms\android\build\intermediates\manifests\full\debug\AndroidManifest.xml:28: error: resource style/CordovaWindowBackgroundTheme (aka com.kudosboards.pwa:style/CordovaWindowBackgroundTheme) not found.
error: failed processing manifest.

Doesn't work on Phonegap Build

It doesn't work on Phonegap Build cli-7.1.0 (Android Cordova 6.3.0). After the following additions to config.xml the 1 second gray screen (before splashscreen) is still there.

<plugin name="cordova-plugin-android-window-background" spec="*">
	<variable name="WINDOW_BACKGROUND_COLOR" value="#0078d7" />
</plugin>

Also I tried to added the following, but with no effect:

<preference name="WINDOW_BACKGROUND_COLOR" value="#0078d7" />

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.