@capawesome/capacitor-android-edge-to-edge-support 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Robin Genz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @capawesome/capacitor-android-edge-to-edge-support
2
+
3
+ Capacitor plugin to support edge-to-edge display on Android.
4
+
5
+ | Before | After | Before | After |
6
+ | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
7
+ | <image src="https://github.com/user-attachments/assets/1c42aa63-1191-4b9b-860f-ffc47881d815" width="200" /> | <image src="https://github.com/user-attachments/assets/a4df4e58-0c21-45b5-aadd-ca197308016a" width="200" /> | <image src="https://github.com/user-attachments/assets/22c94f95-a0c4-4ace-8a3b-3a0feabf9191" width="200" /> | <image src="https://github.com/user-attachments/assets/21ece022-fb74-4067-889b-6922ecd0e2a5" width="200" /> |
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @capawesome/capacitor-android-edge-to-edge-support
13
+ npx cap sync
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ The plugin **only needs to be installed**. It applies insets to the web view to support edge-to-edge display on Android. The plugin also provides a method to set the background color of the status bar and navigation bar. It's recommended to use this method in combination with the [Status Bar](https://capacitorjs.com/docs/apis/status-bar) plugin.
19
+
20
+ ```typescript
21
+ import { EdgeToEdge } from '@capawesome/capacitor-android-edge-to-edge-support';
22
+ import { StatusBar, Style } from '@capacitor/status-bar';
23
+
24
+ const setBackgroundColor = async () => {
25
+ await EdgeToEdge.setBackgroundColor({ color: '#ffffff' });
26
+ await StatusBar.setStyle({ style: Style.Light });
27
+ };
28
+ ```
29
+
30
+ ## API
31
+
32
+ <docgen-index>
33
+
34
+ * [`setBackgroundColor(...)`](#setbackgroundcolor)
35
+ * [Interfaces](#interfaces)
36
+
37
+ </docgen-index>
38
+
39
+ <docgen-api>
40
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
41
+
42
+ ### setBackgroundColor(...)
43
+
44
+ ```typescript
45
+ setBackgroundColor(options: SetBackgroundColorOptions) => Promise<void>
46
+ ```
47
+
48
+ Set the background color of the status bar and navigation bar.
49
+
50
+ Only available on Android.
51
+
52
+ | Param | Type |
53
+ | ------------- | ------------------------------------------------------------------------------- |
54
+ | **`options`** | <code><a href="#setbackgroundcoloroptions">SetBackgroundColorOptions</a></code> |
55
+
56
+ **Since:** 7.0.0
57
+
58
+ --------------------
59
+
60
+
61
+ ### Interfaces
62
+
63
+
64
+ #### SetBackgroundColorOptions
65
+
66
+ | Prop | Type | Description | Since |
67
+ | ----------- | ------------------- | ------------------------------------------------------------------------------------------ | ----- |
68
+ | **`color`** | <code>string</code> | The hexadecimal color to set as the background color of the status bar and navigation bar. | 7.0.0 |
69
+
70
+ </docgen-api>
71
+
72
+ ## Changelog
73
+
74
+ See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/android-edge-to-edge-support/CHANGELOG.md).
75
+
76
+ ## License
77
+
78
+ See [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/android-edge-to-edge-support/LICENSE).
@@ -0,0 +1,58 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:8.7.2'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ namespace "io.capawesome.capacitorjs.plugins.androidedgetoedge"
22
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
23
+ defaultConfig {
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
26
+ versionCode 1
27
+ versionName "1.0"
28
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29
+ }
30
+ buildTypes {
31
+ release {
32
+ minifyEnabled false
33
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34
+ }
35
+ }
36
+ lintOptions {
37
+ abortOnError false
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_21
41
+ targetCompatibility JavaVersion.VERSION_21
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ google()
47
+ mavenCentral()
48
+ }
49
+
50
+
51
+ dependencies {
52
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
53
+ implementation project(':capacitor-android')
54
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ testImplementation "junit:junit:$junitVersion"
56
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,54 @@
1
+ package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
2
+
3
+ import android.graphics.Color;
4
+ import android.view.View;
5
+ import android.view.ViewGroup;
6
+ import androidx.annotation.NonNull;
7
+ import androidx.core.graphics.Insets;
8
+ import androidx.core.view.ViewCompat;
9
+ import androidx.core.view.WindowInsetsCompat;
10
+
11
+ public class EdgeToEdge {
12
+
13
+ @NonNull
14
+ private final EdgeToEdgePlugin plugin;
15
+
16
+ public EdgeToEdge(@NonNull EdgeToEdgePlugin plugin) {
17
+ this.plugin = plugin;
18
+ // Apply insets to disable the edge-to-edge feature
19
+ applyInsets();
20
+ }
21
+
22
+ public void setBackgroundColor(String color) {
23
+ View view = plugin.getBridge().getWebView();
24
+ if (view == null) {
25
+ return;
26
+ }
27
+ // Get parent view
28
+ ViewGroup parent = (ViewGroup) view.getParent();
29
+ // Set background color to black
30
+ parent.setBackgroundColor(Color.parseColor(color));
31
+ }
32
+
33
+ private void applyInsets() {
34
+ View view = plugin.getBridge().getWebView();
35
+ if (view == null) {
36
+ return;
37
+ }
38
+ // Get parent view
39
+ ViewGroup parent = (ViewGroup) view.getParent();
40
+ // Set background color to black
41
+ parent.setBackgroundColor(Color.WHITE);
42
+ // Apply insets to disable the edge-to-edge feature
43
+ ViewCompat.setOnApplyWindowInsetsListener(view, (v, windowInsets) -> {
44
+ Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
45
+ ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
46
+ mlp.bottomMargin = insets.bottom;
47
+ mlp.leftMargin = insets.left;
48
+ mlp.rightMargin = insets.right;
49
+ mlp.topMargin = insets.top;
50
+ v.setLayoutParams(mlp);
51
+ return WindowInsetsCompat.CONSUMED;
52
+ });
53
+ }
54
+ }
@@ -0,0 +1,33 @@
1
+ package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
2
+
3
+ import androidx.annotation.Nullable;
4
+ import com.getcapacitor.Plugin;
5
+ import com.getcapacitor.PluginCall;
6
+ import com.getcapacitor.PluginMethod;
7
+ import com.getcapacitor.annotation.CapacitorPlugin;
8
+
9
+ @CapacitorPlugin(name = "EdgeToEdge")
10
+ public class EdgeToEdgePlugin extends Plugin {
11
+
12
+ private static final String ERROR_COLOR_MISSING = "color must be provided.";
13
+ private static final String TAG = "EdgeToEdge";
14
+
15
+ @Nullable
16
+ private EdgeToEdge implementation;
17
+
18
+ @Override
19
+ public void load() {
20
+ implementation = new EdgeToEdge(this);
21
+ }
22
+
23
+ @PluginMethod
24
+ public void setBackgroundColor(PluginCall call) {
25
+ String color = call.getString("color");
26
+ if (color == null) {
27
+ call.reject(ERROR_COLOR_MISSING);
28
+ return;
29
+ }
30
+ implementation.setBackgroundColor(color);
31
+ call.resolve();
32
+ }
33
+ }
File without changes
package/dist/docs.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "api": {
3
+ "name": "EdgeToEdgePlugin",
4
+ "slug": "edgetoedgeplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "setBackgroundColor",
10
+ "signature": "(options: SetBackgroundColorOptions) => Promise<void>",
11
+ "parameters": [
12
+ {
13
+ "name": "options",
14
+ "docs": "",
15
+ "type": "SetBackgroundColorOptions"
16
+ }
17
+ ],
18
+ "returns": "Promise<void>",
19
+ "tags": [
20
+ {
21
+ "name": "since",
22
+ "text": "7.0.0"
23
+ }
24
+ ],
25
+ "docs": "Set the background color of the status bar and navigation bar.\n\nOnly available on Android.",
26
+ "complexTypes": [
27
+ "SetBackgroundColorOptions"
28
+ ],
29
+ "slug": "setbackgroundcolor"
30
+ }
31
+ ],
32
+ "properties": []
33
+ },
34
+ "interfaces": [
35
+ {
36
+ "name": "SetBackgroundColorOptions",
37
+ "slug": "setbackgroundcoloroptions",
38
+ "docs": "",
39
+ "tags": [
40
+ {
41
+ "text": "7.0.0",
42
+ "name": "since"
43
+ }
44
+ ],
45
+ "methods": [],
46
+ "properties": [
47
+ {
48
+ "name": "color",
49
+ "tags": [
50
+ {
51
+ "text": "7.0.0",
52
+ "name": "since"
53
+ },
54
+ {
55
+ "text": "\"#ffffff\"",
56
+ "name": "example"
57
+ },
58
+ {
59
+ "text": "\"#000000\"",
60
+ "name": "example"
61
+ }
62
+ ],
63
+ "docs": "The hexadecimal color to set as the background color of the status bar and navigation bar.",
64
+ "complexTypes": [],
65
+ "type": "string"
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "enums": [],
71
+ "typeAliases": [],
72
+ "pluginConfigs": []
73
+ }
@@ -0,0 +1,23 @@
1
+ export interface EdgeToEdgePlugin {
2
+ /**
3
+ * Set the background color of the status bar and navigation bar.
4
+ *
5
+ * Only available on Android.
6
+ *
7
+ * @since 7.0.0
8
+ */
9
+ setBackgroundColor(options: SetBackgroundColorOptions): Promise<void>;
10
+ }
11
+ /**
12
+ * @since 7.0.0
13
+ */
14
+ export interface SetBackgroundColorOptions {
15
+ /**
16
+ * The hexadecimal color to set as the background color of the status bar and navigation bar.
17
+ *
18
+ * @since 7.0.0
19
+ * @example "#ffffff"
20
+ * @example "#000000"
21
+ */
22
+ color: string;
23
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface EdgeToEdgePlugin {\n /**\n * Set the background color of the status bar and navigation bar.\n *\n * Only available on Android.\n *\n * @since 7.0.0\n */\n setBackgroundColor(options: SetBackgroundColorOptions): Promise<void>;\n}\n\n/**\n * @since 7.0.0\n */\nexport interface SetBackgroundColorOptions {\n /**\n * The hexadecimal color to set as the background color of the status bar and navigation bar.\n *\n * @since 7.0.0\n * @example \"#ffffff\"\n * @example \"#000000\"\n */\n color: string;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { EdgeToEdgePlugin } from './definitions';
2
+ declare const EdgeToEdge: EdgeToEdgePlugin;
3
+ export * from './definitions';
4
+ export { EdgeToEdge };
@@ -0,0 +1,5 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const EdgeToEdge = registerPlugin('EdgeToEdge', {});
3
+ export * from './definitions';
4
+ export { EdgeToEdge };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE,EAAE,CAAC,CAAC;AAEtE,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { EdgeToEdgePlugin } from './definitions';\n\nconst EdgeToEdge = registerPlugin<EdgeToEdgePlugin>('EdgeToEdge', {});\n\nexport * from './definitions';\nexport { EdgeToEdge };\n"]}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const EdgeToEdge = core.registerPlugin('EdgeToEdge', {});
6
+
7
+ exports.EdgeToEdge = EdgeToEdge;
8
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst EdgeToEdge = registerPlugin('EdgeToEdge', {});\nexport * from './definitions';\nexport { EdgeToEdge };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE,EAAE;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,11 @@
1
+ var capacitorEdgeToEdge = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const EdgeToEdge = core.registerPlugin('EdgeToEdge', {});
5
+
6
+ exports.EdgeToEdge = EdgeToEdge;
7
+
8
+ return exports;
9
+
10
+ })({}, capacitorExports);
11
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst EdgeToEdge = registerPlugin('EdgeToEdge', {});\nexport * from './definitions';\nexport { EdgeToEdge };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;AACK,OAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE,EAAE;;;;;;;;;;"}
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@capawesome/capacitor-android-edge-to-edge-support",
3
+ "version": "7.0.0",
4
+ "description": "Capacitor plugin to support edge-to-edge display on Android.",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/"
13
+ ],
14
+ "author": "Robin Genz <mail@robingenz.dev>",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/capawesome-team/capacitor-plugins.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/capawesome-team/capacitor-plugins/issues"
22
+ },
23
+ "funding": [
24
+ {
25
+ "type": "github",
26
+ "url": "https://github.com/sponsors/capawesome-team/"
27
+ },
28
+ {
29
+ "type": "opencollective",
30
+ "url": "https://opencollective.com/capawesome"
31
+ }
32
+ ],
33
+ "homepage": "https://capawesome.io/plugins/android-edge-to-edge-support/",
34
+ "keywords": [
35
+ "capacitor",
36
+ "plugin",
37
+ "native"
38
+ ],
39
+ "scripts": {
40
+ "verify": "npm run verify:android && npm run verify:web",
41
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
42
+ "verify:web": "npm run build",
43
+ "lint": "npm run prettier -- --check",
44
+ "fmt": "npm run prettier -- --write",
45
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
46
+ "docgen": "docgen --api EdgeToEdgePlugin --output-readme README.md --output-json dist/docs.json",
47
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
48
+ "clean": "rimraf ./dist",
49
+ "watch": "tsc --watch",
50
+ "prepublishOnly": "npm run build"
51
+ },
52
+ "devDependencies": {
53
+ "@capacitor/android": "7.0.0",
54
+ "@capacitor/cli": "7.0.0",
55
+ "@capacitor/core": "7.0.0",
56
+ "@capacitor/docgen": "0.3.0",
57
+ "prettier": "3.4.2",
58
+ "prettier-plugin-java": "2.6.7",
59
+ "rimraf": "6.0.1",
60
+ "rollup": "4.30.1",
61
+ "typescript": "4.1.5"
62
+ },
63
+ "peerDependencies": {
64
+ "@capacitor/core": ">=7.0.0"
65
+ },
66
+ "capacitor": {
67
+ "android": {
68
+ "src": "android"
69
+ }
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ }
74
+ }