Giter Site home page Giter Site logo

dejvid / cordova-fullscreen-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mesmotronic/cordova-plugin-fullscreen

0.0 2.0 0.0 108 KB

Plugin for Cordova (or PhoneGap) to enable true full screen on Android

License: BSD 3-Clause "New" or "Revised" License

Java 82.90% JavaScript 17.10%

cordova-fullscreen-plugin's Introduction

Full Screen Plugin for Cordova

Plugin for Cordova (or PhoneGap) 3.0+ to enable true full screen on Android, ported from our popular ANE for Adobe AIR.

How does it work?

This plugin enables developers to offer users a true full screen experience in the Cordova and PhoneGap apps for Android.

Using Android 4.0+, you can use true full screen in "lean mode", the way you see in apps like YouTube, expanding the app right to the edges of the screen, hiding the status and navigation bars until the user next interacts. This is ideally suited to video or cut-scene content.

In Android 4.4+, however, you can now enter true full screen, fully interactive immersive mode. In this mode, your app will remain in true full screen until you choose otherwise; users can swipe down from the top of the screen to temporarily display the system UI.

If you find that the plugin doesn't work as you might like on a specific device or Android configuration you're using, don't forget that this project is open source, so feel free to fork the project and adapt it to work in any way you like!

Installation

Cordova

cordova plugin add https://github.com/mesmotronic/cordova-fullscreen-plugin.git

PhoneGap

phonegap local plugin add https://github.com/mesmotronic/cordova-fullscreen-plugin.git

Configuration

If you are intending to use immersive mode, add <preference name="Fullscreen" value="true" /> to your config.xml to ensure the status bar is hidden correctly.

Code example

Using the plugin in your app couldn't be easier:

function successFunction() 
{
	console.log("It worked!");
}

function errorFunction(error)
{
    console.log(error);
}

function trace(value)
{
	console.log(value);
}

// Is fullscreen supported?
AndroidFullScreen.isSupported(trace, errorFunction);

// Is immersive mode supported?
AndroidFullScreen.isImmersiveModeSupported(trace, errorFunction);

// The width of the screen in immersive mode
AndroidFullScreen.immersiveWidth(trace, errorFunction);

// The height of the screen in immersive mode
AndroidFullScreen.immersiveHeight(trace, errorFunction);

// Hide system UI until user interacts
AndroidFullScreen.hideSystemUI(successFunction, errorFunction);

// Show system UI
AndroidFullScreen.showSystemUI(successFunction, errorFunction);

// Extend your app underneath the system UI (Android 4.4+ only)
AndroidFullScreen.showUnderSystemUI(successFunction, errorFunction);

// Hide system UI and keep it hidden (Android 4.4+ only)
AndroidFullScreen.immersiveMode(successFunction, errorFunction);

All methods will call the successFunction callback if the action was successful and the errorFunction if it wasn't (or isn't supported); if you're using the plugin in an app for a platform other than Android, all methods will fail.

The immersiveWidth and immersiveHeight properties return the screen width and height available in immersive mode (or with the system UI hidden), where supported.

Getting the immersive screen size

You can use the immersiveWidth and immersiveHeight methods to find out the dimensions of the screen with the system UI hidden, regardless of the current screen state.

License

This project has been released under BSD license; see LICENSE for details.

cordova-fullscreen-plugin's People

Contributors

agamemnus avatar dejvid avatar neilrackett avatar

Watchers

 avatar  avatar

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.