@capawesome/capacitor-android-edge-to-edge-support 7.0.1 → 7.1.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/README.md CHANGED
@@ -13,6 +13,49 @@ npm install @capawesome/capacitor-android-edge-to-edge-support
13
13
  npx cap sync
14
14
  ```
15
15
 
16
+ ## Configuration
17
+
18
+ <docgen-config>
19
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
20
+
21
+ | Prop | Type | Description | Since |
22
+ | --------------------- | ------------------- | ------------------------------------------------------------------------------------------ | ----- |
23
+ | **`backgroundColor`** | <code>string</code> | The hexadecimal color to set as the background color of the status bar and navigation bar. | 7.1.0 |
24
+
25
+ ### Examples
26
+
27
+ In `capacitor.config.json`:
28
+
29
+ ```json
30
+ {
31
+ "plugins": {
32
+ "EdgeToEdge": {
33
+ "backgroundColor": "#ffffff"
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ In `capacitor.config.ts`:
40
+
41
+ ```ts
42
+ /// <reference types="@capawesome/capacitor-android-edge-to-edge-support" />
43
+
44
+ import { CapacitorConfig } from '@capacitor/cli';
45
+
46
+ const config: CapacitorConfig = {
47
+ plugins: {
48
+ EdgeToEdge: {
49
+ backgroundColor: "#ffffff",
50
+ },
51
+ },
52
+ };
53
+
54
+ export default config;
55
+ ```
56
+
57
+ </docgen-config>
58
+
16
59
  ## Usage
17
60
 
18
61
  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.
@@ -11,10 +11,14 @@ import androidx.core.view.WindowInsetsCompat;
11
11
 
12
12
  public class EdgeToEdge {
13
13
 
14
+ @NonNull
15
+ private final EdgeToEdgeConfig config;
16
+
14
17
  @NonNull
15
18
  private final EdgeToEdgePlugin plugin;
16
19
 
17
- public EdgeToEdge(@NonNull EdgeToEdgePlugin plugin) {
20
+ public EdgeToEdge(@NonNull EdgeToEdgePlugin plugin, @NonNull EdgeToEdgeConfig config) {
21
+ this.config = config;
18
22
  this.plugin = plugin;
19
23
  // Apply insets to disable the edge-to-edge feature
20
24
  applyInsets();
@@ -39,7 +43,7 @@ public class EdgeToEdge {
39
43
  // Get parent view
40
44
  ViewGroup parent = (ViewGroup) view.getParent();
41
45
  // Set background color to black
42
- parent.setBackgroundColor(Color.WHITE);
46
+ parent.setBackgroundColor(this.config.getBackgroundColor());
43
47
  // Apply insets to disable the edge-to-edge feature
44
48
  ViewCompat.setOnApplyWindowInsetsListener(view, (v, windowInsets) -> {
45
49
  Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
@@ -0,0 +1,16 @@
1
+ package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
2
+
3
+ import android.graphics.Color;
4
+
5
+ public class EdgeToEdgeConfig {
6
+
7
+ private int backgroundColor = Color.WHITE;
8
+
9
+ public int getBackgroundColor() {
10
+ return this.backgroundColor;
11
+ }
12
+
13
+ public void setBackgroundColor(int backgroundColor) {
14
+ this.backgroundColor = backgroundColor;
15
+ }
16
+ }
@@ -1,5 +1,6 @@
1
1
  package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
2
2
 
3
+ import android.graphics.Color;
3
4
  import androidx.annotation.Nullable;
4
5
  import com.getcapacitor.Plugin;
5
6
  import com.getcapacitor.PluginCall;
@@ -17,7 +18,8 @@ public class EdgeToEdgePlugin extends Plugin {
17
18
 
18
19
  @Override
19
20
  public void load() {
20
- implementation = new EdgeToEdge(this);
21
+ EdgeToEdgeConfig config = getEdgeToEdgeConfig();
22
+ implementation = new EdgeToEdge(this, config);
21
23
  }
22
24
 
23
25
  @PluginMethod
@@ -30,4 +32,14 @@ public class EdgeToEdgePlugin extends Plugin {
30
32
  implementation.setBackgroundColor(color);
31
33
  call.resolve();
32
34
  }
35
+
36
+ private EdgeToEdgeConfig getEdgeToEdgeConfig() {
37
+ EdgeToEdgeConfig config = new EdgeToEdgeConfig();
38
+
39
+ String backgroundColor = getConfig().getString("backgroundColor");
40
+ if (backgroundColor != null) {
41
+ config.setBackgroundColor(Color.parseColor(backgroundColor));
42
+ }
43
+ return config;
44
+ }
33
45
  }
package/dist/docs.json CHANGED
@@ -69,5 +69,29 @@
69
69
  ],
70
70
  "enums": [],
71
71
  "typeAliases": [],
72
- "pluginConfigs": []
72
+ "pluginConfigs": [
73
+ {
74
+ "name": "EdgeToEdge",
75
+ "slug": "edgetoedge",
76
+ "properties": [
77
+ {
78
+ "name": "backgroundColor",
79
+ "tags": [
80
+ {
81
+ "text": "7.1.0",
82
+ "name": "since"
83
+ },
84
+ {
85
+ "text": "\"#ffffff\"",
86
+ "name": "example"
87
+ }
88
+ ],
89
+ "docs": "The hexadecimal color to set as the background color of the status bar and navigation bar.",
90
+ "complexTypes": [],
91
+ "type": "string | undefined"
92
+ }
93
+ ],
94
+ "docs": ""
95
+ }
96
+ ]
73
97
  }
@@ -1,3 +1,16 @@
1
+ declare module '@capacitor/cli' {
2
+ interface PluginsConfig {
3
+ EdgeToEdge?: {
4
+ /**
5
+ * The hexadecimal color to set as the background color of the status bar and navigation bar.
6
+ *
7
+ * @since 7.1.0
8
+ * @example "#ffffff"
9
+ */
10
+ backgroundColor?: string;
11
+ };
12
+ }
13
+ }
1
14
  export interface EdgeToEdgePlugin {
2
15
  /**
3
16
  * Set the background color of the status bar and navigation bar.
@@ -1,2 +1,3 @@
1
+ /// <reference types="@capacitor/cli" />
1
2
  export {};
2
3
  //# sourceMappingURL=definitions.js.map
@@ -1 +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"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n EdgeToEdge?: {\n /**\n * The hexadecimal color to set as the background color of the status bar and navigation bar.\n *\n * @since 7.1.0\n * @example \"#ffffff\"\n */\n backgroundColor?: string;\n };\n }\n}\n\nexport 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-android-edge-to-edge-support",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "Capacitor plugin to support edge-to-edge display on Android.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",