├── .gitignore
├── LICENSE
├── README.md
├── example
├── README.md
├── config.xml
├── hooks
│ └── README.md
└── www
│ └── index.html
├── package.json
├── plugin.xml
├── src
└── android
│ └── com
│ └── mesmotronic
│ └── plugins
│ └── FullScreenPlugin.java
└── www
└── AndroidFullScreen.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /example/platforms
2 | /example/plugins
3 | /src/.settings
4 | /src/bin
5 | /src/.classpath
6 | /src/.project
7 | package-lock.json
8 | node_modules
9 | .gradle
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, Mesmotronic Limited
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice, this
11 | list of conditions and the following disclaimer in the documentation and/or
12 | other materials provided with the distribution.
13 |
14 | * Neither the name of the {organization} nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Full Screen Plugin for Cordova
2 | ==============================
3 |
4 | Plugin for Cordova (or PhoneGap) 3.0+ to enable true full screen on Android devices using lean and immersive modes, ported from our popular [ANE for Adobe AIR](https://github.com/mesmotronic/air-ane-fullscreen).
5 |
6 | Released under BSD license; see LICENSE for details.
7 |
8 | How does it work?
9 | -----------------
10 |
11 | This plugin enables developers to offer users a true full screen experience in their Cordova and PhoneGap apps for Android.
12 |
13 | 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.
14 |
15 | 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.
16 |
17 | 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!
18 |
19 | Installation
20 | ------------
21 |
22 | **Cordova**
23 |
24 | `cordova plugin add cordova-plugin-fullscreen`
25 |
26 | **PhoneGap**
27 |
28 | `phonegap local plugin add cordova-plugin-fullscreen`
29 |
30 | Notes
31 | -----
32 |
33 | From version 1.0.2, the plugin ID has changed to `cordova-plugin-fullscreen` in line with the official Cordova plugin naming coventions following the switch to NPM. We therefore recommend that any previous version be uninstalled before upgrading to this release.
34 |
35 | Since the release of `android@5.0.0`, setting `` in `config.xml` will use immersive mode, where available, even without this plugin.
36 |
37 | Code example
38 | ------------
39 |
40 | Using the plugin in your app couldn't be easier:
41 |
42 | ```js
43 | function successFunction()
44 | {
45 | console.info("It worked!");
46 | }
47 |
48 | function errorFunction(error)
49 | {
50 | console.error(error);
51 | }
52 |
53 | function trace(value)
54 | {
55 | console.log(value);
56 | }
57 |
58 | // Is this plugin supported?
59 | AndroidFullScreen.isSupported(successFunction, errorFunction);
60 |
61 | // Is immersive mode supported?
62 | AndroidFullScreen.isImmersiveModeSupported(successFunction, errorFunction);
63 |
64 | // The width of the screen in immersive mode
65 | AndroidFullScreen.immersiveWidth(trace, errorFunction);
66 |
67 | // The height of the screen in immersive mode
68 | AndroidFullScreen.immersiveHeight(trace, errorFunction);
69 |
70 | // Hide system UI until user interacts
71 | AndroidFullScreen.leanMode(successFunction, errorFunction);
72 |
73 | // Show system UI
74 | AndroidFullScreen.showSystemUI(successFunction, errorFunction);
75 |
76 | // Extend your app underneath the status bar (Android 4.4+ only)
77 | AndroidFullScreen.showUnderStatusBar(successFunction, errorFunction);
78 |
79 | // Extend your app underneath the system UI (Android 4.4+ only)
80 | AndroidFullScreen.showUnderSystemUI(successFunction, errorFunction);
81 |
82 | // Hide system UI and keep it hidden (Android 4.4+ only)
83 | AndroidFullScreen.immersiveMode(successFunction, errorFunction);
84 |
85 | // Custom full screen mode
86 | // See https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
87 | AndroidFullScreen.setSystemUiVisibility(AndroidFullScreen.SYSTEM_UI_FLAG_FULLSCREEN | AndroidFullScreen.SYSTEM_UI_FLAG_LOW_PROFILE, successFunction, errorFunction);
88 | ```
89 |
90 | 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.
91 |
92 | The `immersiveWidth` and `immersiveHeight` properties return the screen width and height available in immersive mode (or with the system UI hidden), where supported.
93 |
94 | Getting the immersive screen size
95 | ---------------------------------
96 |
97 | 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.
98 |
99 | Make a donation
100 | ---------------
101 |
102 | If you find this project useful, why not buy us a coffee (or as many as you think it's worth)?
103 |
104 | [](http://bit.ly/2W0K8iE)
105 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | You need to add the Android platform and install the plugin before running the example:
2 |
3 | ```
4 | cordova platform add android
5 | cordova plugin add https://github.com/mesmotronic/cordova-plugin-fullscreen.git
6 | cordova run android
7 | ```
8 |
--------------------------------------------------------------------------------
/example/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Cordova Full Screen Test
4 |
5 | A sample Apache Cordova application that responds to the deviceready event.
6 |
7 |
8 | Apache Cordova Team
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/hooks/README.md:
--------------------------------------------------------------------------------
1 |
21 | # Cordova Hooks
22 |
23 | This directory may contain scripts used to customize cordova commands. This
24 | directory used to exist at `.cordova/hooks`, but has now been moved to the
25 | project root. Any scripts you add to these directories will be executed before
26 | and after the commands corresponding to the directory name. Useful for
27 | integrating your own build systems or integrating with version control systems.
28 |
29 | __Remember__: Make your scripts executable.
30 |
31 | ## Hook Directories
32 | The following subdirectories will be used for hooks:
33 |
34 | after_build/
35 | after_compile/
36 | after_docs/
37 | after_emulate/
38 | after_platform_add/
39 | after_platform_rm/
40 | after_platform_ls/
41 | after_plugin_add/
42 | after_plugin_ls/
43 | after_plugin_rm/
44 | after_plugin_search/
45 | after_prepare/
46 | after_run/
47 | after_serve/
48 | before_build/
49 | before_compile/
50 | before_docs/
51 | before_emulate/
52 | before_platform_add/
53 | before_platform_rm/
54 | before_platform_ls/
55 | before_plugin_add/
56 | before_plugin_ls/
57 | before_plugin_rm/
58 | before_plugin_search/
59 | before_prepare/
60 | before_run/
61 | before_serve/
62 | pre_package/ <-- Windows 8 and Windows Phone only.
63 |
64 | ## Script Interface
65 |
66 | All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
67 |
68 | * CORDOVA_VERSION - The version of the Cordova-CLI.
69 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
70 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
71 | * CORDOVA_HOOK - Path to the hook that is being executed.
72 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
73 |
74 | If a script returns a non-zero exit code, then the parent cordova command will be aborted.
75 |
76 |
77 | ## Writing hooks
78 |
79 | We highly recommend writting your hooks using Node.js so that they are
80 | cross-platform. Some good examples are shown here:
81 |
82 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
83 |
84 |
--------------------------------------------------------------------------------
/example/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |