@falconeta/capacitor-android-full-view 8.0.1 → 8.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
@@ -32,6 +32,8 @@ const { value } = await AndroidFullView.top();
32
32
 
33
33
  * [`top()`](#top)
34
34
  * [`bottom()`](#bottom)
35
+ * [`setResizeOnFullScreenEnabled(...)`](#setresizeonfullscreenenabled)
36
+ * [`getResizeOnFullScreenEnabled()`](#getresizeonfullscreenenabled)
35
37
  * [Interfaces](#interfaces)
36
38
 
37
39
  </docgen-index>
@@ -65,6 +67,34 @@ Returns bottom offset of the status bar
65
67
  --------------------
66
68
 
67
69
 
70
+ ### setResizeOnFullScreenEnabled(...)
71
+
72
+ ```typescript
73
+ setResizeOnFullScreenEnabled(options: ResizeOnFullScreenEnabledOptions) => Promise<void>
74
+ ```
75
+
76
+ Enables or disables the Android keyboard resize workaround used in fullscreen mode.
77
+
78
+ | Param | Type |
79
+ | ------------- | --------------------------------------------------------------------------------------------- |
80
+ | **`options`** | <code><a href="#resizeonfullscreenenabledoptions">ResizeOnFullScreenEnabledOptions</a></code> |
81
+
82
+ --------------------
83
+
84
+
85
+ ### getResizeOnFullScreenEnabled()
86
+
87
+ ```typescript
88
+ getResizeOnFullScreenEnabled() => Promise<ResizeOnFullScreenEnabledResult>
89
+ ```
90
+
91
+ Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.
92
+
93
+ **Returns:** <code>Promise&lt;<a href="#resizeonfullscreenenabledresult">ResizeOnFullScreenEnabledResult</a>&gt;</code>
94
+
95
+ --------------------
96
+
97
+
68
98
  ### Interfaces
69
99
 
70
100
 
@@ -74,4 +104,18 @@ Returns bottom offset of the status bar
74
104
  | ----------- | ------------------- |
75
105
  | **`value`** | <code>number</code> |
76
106
 
107
+
108
+ #### ResizeOnFullScreenEnabledOptions
109
+
110
+ | Prop | Type |
111
+ | ------------- | -------------------- |
112
+ | **`enabled`** | <code>boolean</code> |
113
+
114
+
115
+ #### ResizeOnFullScreenEnabledResult
116
+
117
+ | Prop | Type |
118
+ | ------------- | -------------------- |
119
+ | **`enabled`** | <code>boolean</code> |
120
+
77
121
  </docgen-api>
@@ -1,14 +1,37 @@
1
1
  package com.falconeta.plugin.android.fullview;
2
2
 
3
+ import android.graphics.Rect;
3
4
  import android.util.DisplayMetrics;
4
5
  import android.view.View;
6
+ import android.view.Window;
7
+ import android.widget.FrameLayout;
8
+
9
+ import androidx.annotation.NonNull;
5
10
  import androidx.appcompat.app.AppCompatActivity;
11
+ import androidx.core.view.ViewCompat;
12
+ import androidx.core.view.WindowInsetsAnimationCompat;
13
+ import androidx.core.view.WindowInsetsCompat;
14
+
15
+ import com.getcapacitor.Bridge;
16
+ import com.getcapacitor.Logger;
17
+ import com.getcapacitor.PluginHandle;
18
+
19
+ import java.lang.reflect.Method;
20
+ import java.util.List;
6
21
 
7
22
  public class AndroidFullView {
8
23
 
9
- private AppCompatActivity activity;
24
+ private final Bridge bridge;
25
+ private final AppCompatActivity activity;
26
+ private boolean resizeOnFullScreenEnabled = true;
27
+ private boolean hooksInstalled = false;
28
+ private final View rootView;
29
+ private final View childOfContent;
30
+ private final FrameLayout.LayoutParams frameLayoutParams;
31
+ private int usableHeightPrevious = FrameLayout.LayoutParams.MATCH_PARENT;
10
32
 
11
- public AndroidFullView(AppCompatActivity activity) {
33
+ public AndroidFullView(Bridge bridge, AppCompatActivity activity) {
34
+ this.bridge = bridge;
12
35
  this.activity = activity;
13
36
  activity
14
37
  .getWindow()
@@ -19,6 +42,13 @@ public class AndroidFullView {
19
42
  View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR |
20
43
  View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
21
44
  );
45
+
46
+ FrameLayout content = activity.getWindow().getDecorView().findViewById(android.R.id.content);
47
+ rootView = content.getRootView();
48
+ childOfContent = content.getChildAt(0);
49
+ frameLayoutParams = childOfContent != null
50
+ ? (FrameLayout.LayoutParams) childOfContent.getLayoutParams()
51
+ : null;
22
52
  }
23
53
 
24
54
  public float getTop() {
@@ -43,4 +73,168 @@ public class AndroidFullView {
43
73
  }
44
74
  return (int) (navigationBarHeight / metrics.density);
45
75
  }
76
+
77
+ public void setResizeOnFullScreenEnabled(boolean enabled) {
78
+ resizeOnFullScreenEnabled = enabled;
79
+ ensureHooksInstalled();
80
+
81
+ if (!resizeOnFullScreenEnabled) {
82
+ restoreFullHeight();
83
+ }
84
+ }
85
+
86
+ public boolean isResizeOnFullScreenEnabled() {
87
+ return resizeOnFullScreenEnabled;
88
+ }
89
+
90
+ private void ensureHooksInstalled() {
91
+ if (hooksInstalled || rootView == null || frameLayoutParams == null) {
92
+ return;
93
+ }
94
+
95
+ ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
96
+ WindowInsetsCompat rootInsets = ViewCompat.getRootWindowInsets(rootView);
97
+
98
+ if (rootInsets == null) {
99
+ return insets;
100
+ }
101
+
102
+ boolean showingKeyboard = rootInsets.isVisible(WindowInsetsCompat.Type.ime());
103
+
104
+ if (showingKeyboard && resizeOnFullScreenEnabled) {
105
+ possiblyResizeChildOfContent(true);
106
+ } else if (!resizeOnFullScreenEnabled) {
107
+ restoreFullHeight();
108
+ }
109
+
110
+ return insets;
111
+ });
112
+
113
+ ViewCompat.setWindowInsetsAnimationCallback(
114
+ rootView,
115
+ new WindowInsetsAnimationCompat.Callback(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) {
116
+ @NonNull
117
+ @Override
118
+ public WindowInsetsCompat onProgress(
119
+ @NonNull WindowInsetsCompat insets,
120
+ @NonNull List<WindowInsetsAnimationCompat> runningAnimations
121
+ ) {
122
+ return insets;
123
+ }
124
+
125
+ @NonNull
126
+ @Override
127
+ public WindowInsetsAnimationCompat.BoundsCompat onStart(
128
+ @NonNull WindowInsetsAnimationCompat animation,
129
+ @NonNull WindowInsetsAnimationCompat.BoundsCompat bounds
130
+ ) {
131
+ WindowInsetsCompat rootInsets = ViewCompat.getRootWindowInsets(rootView);
132
+
133
+ if (rootInsets == null) {
134
+ return super.onStart(animation, bounds);
135
+ }
136
+
137
+ boolean showingKeyboard = rootInsets.isVisible(WindowInsetsCompat.Type.ime());
138
+ int imeHeight = rootInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
139
+ DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
140
+
141
+ if (resizeOnFullScreenEnabled) {
142
+ possiblyResizeChildOfContent(showingKeyboard);
143
+ } else {
144
+ restoreFullHeight();
145
+ }
146
+
147
+ dispatchKeyboardEvent(
148
+ showingKeyboard ? "keyboardWillShow" : "keyboardWillHide",
149
+ Math.round(imeHeight / displayMetrics.density)
150
+ );
151
+
152
+ return super.onStart(animation, bounds);
153
+ }
154
+
155
+ @Override
156
+ public void onEnd(@NonNull WindowInsetsAnimationCompat animation) {
157
+ super.onEnd(animation);
158
+
159
+ WindowInsetsCompat rootInsets = ViewCompat.getRootWindowInsets(rootView);
160
+
161
+ if (rootInsets == null) {
162
+ return;
163
+ }
164
+
165
+ boolean showingKeyboard = rootInsets.isVisible(WindowInsetsCompat.Type.ime());
166
+ int imeHeight = rootInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
167
+ DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
168
+
169
+ if (!showingKeyboard) {
170
+ restoreFullHeight();
171
+ }
172
+
173
+ dispatchKeyboardEvent(
174
+ showingKeyboard ? "keyboardDidShow" : "keyboardDidHide",
175
+ Math.round(imeHeight / displayMetrics.density)
176
+ );
177
+ }
178
+ }
179
+ );
180
+
181
+ hooksInstalled = true;
182
+ }
183
+
184
+ private void dispatchKeyboardEvent(String eventName, int size) {
185
+ try {
186
+ PluginHandle keyboardPluginHandle = bridge.getPlugin("Keyboard");
187
+
188
+ if (keyboardPluginHandle == null || keyboardPluginHandle.getInstance() == null) {
189
+ return;
190
+ }
191
+
192
+ Method onKeyboardEvent = keyboardPluginHandle
193
+ .getInstance()
194
+ .getClass()
195
+ .getDeclaredMethod("onKeyboardEvent", String.class, int.class);
196
+
197
+ onKeyboardEvent.setAccessible(true);
198
+ onKeyboardEvent.invoke(keyboardPluginHandle.getInstance(), eventName, size);
199
+ } catch (Exception exception) {
200
+ Logger.debug("Unable to forward keyboard event: " + exception.getMessage());
201
+ }
202
+ }
203
+
204
+ private void possiblyResizeChildOfContent(boolean keyboardShown) {
205
+ int usableHeightNow = keyboardShown ? computeUsableHeight() : FrameLayout.LayoutParams.MATCH_PARENT;
206
+
207
+ if (usableHeightPrevious != usableHeightNow) {
208
+ frameLayoutParams.height = usableHeightNow;
209
+ childOfContent.requestLayout();
210
+ usableHeightPrevious = usableHeightNow;
211
+ }
212
+ }
213
+
214
+ private void restoreFullHeight() {
215
+ if (frameLayoutParams == null || childOfContent == null) {
216
+ return;
217
+ }
218
+
219
+ frameLayoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
220
+ childOfContent.requestLayout();
221
+ usableHeightPrevious = FrameLayout.LayoutParams.MATCH_PARENT;
222
+ }
223
+
224
+ private int computeUsableHeight() {
225
+ Rect rect = new Rect();
226
+ childOfContent.getWindowVisibleDisplayFrame(rect);
227
+
228
+ return isOverlayingStatusBar() ? rect.bottom : rect.height();
229
+ }
230
+
231
+ @SuppressWarnings("deprecation")
232
+ private boolean isOverlayingStatusBar() {
233
+ Window window = activity.getWindow();
234
+
235
+ return (
236
+ (window.getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) ==
237
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
238
+ );
239
+ }
46
240
  }
@@ -1,6 +1,5 @@
1
1
  package com.falconeta.plugin.android.fullview;
2
2
 
3
- import android.app.Activity;
4
3
  import com.getcapacitor.JSObject;
5
4
  import com.getcapacitor.Plugin;
6
5
  import com.getcapacitor.PluginCall;
@@ -14,7 +13,7 @@ public class AndroidFullViewPlugin extends Plugin {
14
13
 
15
14
  @Override
16
15
  public void load() {
17
- this.implementation = new AndroidFullView(getActivity());
16
+ this.implementation = new AndroidFullView(getBridge(), getActivity());
18
17
  }
19
18
 
20
19
  @PluginMethod
@@ -34,4 +33,22 @@ public class AndroidFullViewPlugin extends Plugin {
34
33
  ret.put("value", navigationBarHeight);
35
34
  call.resolve(ret);
36
35
  }
36
+
37
+ @PluginMethod
38
+ public void setResizeOnFullScreenEnabled(PluginCall call) {
39
+ boolean enabled = call.getBoolean("enabled", true);
40
+
41
+ getBridge().executeOnMainThread(() -> {
42
+ implementation.setResizeOnFullScreenEnabled(enabled);
43
+ call.resolve();
44
+ });
45
+ }
46
+
47
+ @PluginMethod
48
+ public void getResizeOnFullScreenEnabled(PluginCall call) {
49
+ JSObject ret = new JSObject();
50
+
51
+ ret.put("enabled", implementation.isResizeOnFullScreenEnabled());
52
+ call.resolve(ret);
53
+ }
37
54
  }
package/dist/docs.json CHANGED
@@ -28,6 +28,36 @@
28
28
  "TopBottomReturn"
29
29
  ],
30
30
  "slug": "bottom"
31
+ },
32
+ {
33
+ "name": "setResizeOnFullScreenEnabled",
34
+ "signature": "(options: ResizeOnFullScreenEnabledOptions) => Promise<void>",
35
+ "parameters": [
36
+ {
37
+ "name": "options",
38
+ "docs": "",
39
+ "type": "ResizeOnFullScreenEnabledOptions"
40
+ }
41
+ ],
42
+ "returns": "Promise<void>",
43
+ "tags": [],
44
+ "docs": "Enables or disables the Android keyboard resize workaround used in fullscreen mode.",
45
+ "complexTypes": [
46
+ "ResizeOnFullScreenEnabledOptions"
47
+ ],
48
+ "slug": "setresizeonfullscreenenabled"
49
+ },
50
+ {
51
+ "name": "getResizeOnFullScreenEnabled",
52
+ "signature": "() => Promise<ResizeOnFullScreenEnabledResult>",
53
+ "parameters": [],
54
+ "returns": "Promise<ResizeOnFullScreenEnabledResult>",
55
+ "tags": [],
56
+ "docs": "Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.",
57
+ "complexTypes": [
58
+ "ResizeOnFullScreenEnabledResult"
59
+ ],
60
+ "slug": "getresizeonfullscreenenabled"
31
61
  }
32
62
  ],
33
63
  "properties": []
@@ -48,6 +78,38 @@
48
78
  "type": "number"
49
79
  }
50
80
  ]
81
+ },
82
+ {
83
+ "name": "ResizeOnFullScreenEnabledOptions",
84
+ "slug": "resizeonfullscreenenabledoptions",
85
+ "docs": "",
86
+ "tags": [],
87
+ "methods": [],
88
+ "properties": [
89
+ {
90
+ "name": "enabled",
91
+ "tags": [],
92
+ "docs": "",
93
+ "complexTypes": [],
94
+ "type": "boolean"
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "name": "ResizeOnFullScreenEnabledResult",
100
+ "slug": "resizeonfullscreenenabledresult",
101
+ "docs": "",
102
+ "tags": [],
103
+ "methods": [],
104
+ "properties": [
105
+ {
106
+ "name": "enabled",
107
+ "tags": [],
108
+ "docs": "",
109
+ "complexTypes": [],
110
+ "type": "boolean"
111
+ }
112
+ ]
51
113
  }
52
114
  ],
53
115
  "enums": [],
@@ -7,7 +7,21 @@ export interface AndroidFullViewPlugin {
7
7
  * Returns bottom offset of the status bar
8
8
  */
9
9
  bottom(): Promise<TopBottomReturn>;
10
+ /**
11
+ * Enables or disables the Android keyboard resize workaround used in fullscreen mode.
12
+ */
13
+ setResizeOnFullScreenEnabled(options: ResizeOnFullScreenEnabledOptions): Promise<void>;
14
+ /**
15
+ * Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.
16
+ */
17
+ getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult>;
10
18
  }
11
19
  export interface TopBottomReturn {
12
20
  value: number;
13
21
  }
22
+ export interface ResizeOnFullScreenEnabledOptions {
23
+ enabled: boolean;
24
+ }
25
+ export interface ResizeOnFullScreenEnabledResult {
26
+ enabled: boolean;
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AndroidFullViewPlugin {\n /**\n * Returns top offset of the status bar\n */\n top(): Promise<TopBottomReturn>;\n\n /**\n * Returns bottom offset of the status bar\n */\n bottom(): Promise<TopBottomReturn>;\n}\n\nexport interface TopBottomReturn {\n value: number;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AndroidFullViewPlugin {\n /**\n * Returns top offset of the status bar\n */\n top(): Promise<TopBottomReturn>;\n\n /**\n * Returns bottom offset of the status bar\n */\n bottom(): Promise<TopBottomReturn>;\n\n /**\n * Enables or disables the Android keyboard resize workaround used in fullscreen mode.\n */\n setResizeOnFullScreenEnabled(\n options: ResizeOnFullScreenEnabledOptions,\n ): Promise<void>;\n\n /**\n * Returns whether the Android keyboard resize workaround used in fullscreen mode is enabled.\n */\n getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult>;\n}\n\nexport interface TopBottomReturn {\n value: number;\n}\n\nexport interface ResizeOnFullScreenEnabledOptions {\n enabled: boolean;\n}\n\nexport interface ResizeOnFullScreenEnabledResult {\n enabled: boolean;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { AndroidFullViewPlugin, TopBottomReturn } from './definitions';
2
+ import type { AndroidFullViewPlugin, ResizeOnFullScreenEnabledOptions, ResizeOnFullScreenEnabledResult, TopBottomReturn } from './definitions';
3
3
  export declare class AndroidFullViewWeb extends WebPlugin implements AndroidFullViewPlugin {
4
4
  top(): Promise<TopBottomReturn>;
5
5
  bottom(): Promise<TopBottomReturn>;
6
+ setResizeOnFullScreenEnabled(_options: ResizeOnFullScreenEnabledOptions): Promise<void>;
7
+ getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult>;
6
8
  }
package/dist/esm/web.js CHANGED
@@ -6,5 +6,9 @@ export class AndroidFullViewWeb extends WebPlugin {
6
6
  async bottom() {
7
7
  return { value: 0 };
8
8
  }
9
+ async setResizeOnFullScreenEnabled(_options) { }
10
+ async getResizeOnFullScreenEnabled() {
11
+ return { enabled: true };
12
+ }
9
13
  }
10
14
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,KAAK,CAAC,GAAG;QACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AndroidFullViewPlugin, TopBottomReturn } from './definitions';\n\nexport class AndroidFullViewWeb extends WebPlugin implements AndroidFullViewPlugin {\n async top(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n\n async bottom(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,KAAK,CAAC,GAAG;QACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,4BAA4B,CAChC,QAA0C,IAC1B,CAAC;IAEnB,KAAK,CAAC,4BAA4B;QAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AndroidFullViewPlugin,\n ResizeOnFullScreenEnabledOptions,\n ResizeOnFullScreenEnabledResult,\n TopBottomReturn,\n} from './definitions';\n\nexport class AndroidFullViewWeb extends WebPlugin implements AndroidFullViewPlugin {\n async top(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n\n async bottom(): Promise<TopBottomReturn> {\n return { value: 0 };\n }\n\n async setResizeOnFullScreenEnabled(\n _options: ResizeOnFullScreenEnabledOptions,\n ): Promise<void> {}\n\n async getResizeOnFullScreenEnabled(): Promise<ResizeOnFullScreenEnabledResult> {\n return { enabled: true };\n }\n}\n"]}
@@ -13,6 +13,10 @@ class AndroidFullViewWeb extends core.WebPlugin {
13
13
  async bottom() {
14
14
  return { value: 0 };
15
15
  }
16
+ async setResizeOnFullScreenEnabled(_options) { }
17
+ async getResizeOnFullScreenEnabled() {
18
+ return { enabled: true };
19
+ }
16
20
  }
17
21
 
18
22
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD,IAAI,MAAM,GAAG,GAAG;AAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n async setResizeOnFullScreenEnabled(_options) { }\n async getResizeOnFullScreenEnabled() {\n return { enabled: true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD,IAAI,MAAM,GAAG,GAAG;AAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;AAC3B,IAAI;AACJ,IAAI,MAAM,4BAA4B,CAAC,QAAQ,EAAE,EAAE;AACnD,IAAI,MAAM,4BAA4B,GAAG;AACzC,QAAQ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -12,6 +12,10 @@ var capacitorAndroidFullView = (function (exports, core) {
12
12
  async bottom() {
13
13
  return { value: 0 };
14
14
  }
15
+ async setResizeOnFullScreenEnabled(_options) { }
16
+ async getResizeOnFullScreenEnabled() {
17
+ return { enabled: true };
18
+ }
15
19
  }
16
20
 
17
21
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,GAAG,GAAG;IAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AndroidFullView = registerPlugin('AndroidFullView', {\n web: () => import('./web').then(m => new m.AndroidFullViewWeb()),\n});\nexport * from './definitions';\nexport { AndroidFullView };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AndroidFullViewWeb extends WebPlugin {\n async top() {\n return { value: 0 };\n }\n async bottom() {\n return { value: 0 };\n }\n async setResizeOnFullScreenEnabled(_options) { }\n async getResizeOnFullScreenEnabled() {\n return { enabled: true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,GAAG,GAAG;IAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3B,IAAI;IACJ,IAAI,MAAM,4BAA4B,CAAC,QAAQ,EAAE,EAAE;IACnD,IAAI,MAAM,4BAA4B,GAAG;IACzC,QAAQ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -1,7 +1,21 @@
1
1
  import Foundation
2
2
 
3
3
  @objc public class AndroidFullView: NSObject {
4
+ private var resizeOnFullScreenEnabled = true
5
+
4
6
  @objc public func top() -> Float {
5
7
  return 0
6
8
  }
9
+
10
+ @objc public func bottom() -> Int {
11
+ return 0
12
+ }
13
+
14
+ @objc public func setResizeOnFullScreenEnabled(_ enabled: Bool) {
15
+ resizeOnFullScreenEnabled = enabled
16
+ }
17
+
18
+ @objc public func getResizeOnFullScreenEnabled() -> Bool {
19
+ return resizeOnFullScreenEnabled
20
+ }
7
21
  }
@@ -10,7 +10,10 @@ public class AndroidFullViewPlugin: CAPPlugin, CAPBridgedPlugin {
10
10
  public let identifier = "AndroidFullViewPlugin"
11
11
  public let jsName = "AndroidFullView"
12
12
  public let pluginMethods: [CAPPluginMethod] = [
13
- CAPPluginMethod(name: "top", returnType: CAPPluginReturnPromise)
13
+ CAPPluginMethod(name: "top", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "bottom", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "setResizeOnFullScreenEnabled", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "getResizeOnFullScreenEnabled", returnType: CAPPluginReturnPromise)
14
17
  ]
15
18
  private let implementation = AndroidFullView()
16
19
 
@@ -19,4 +22,21 @@ public class AndroidFullViewPlugin: CAPPlugin, CAPBridgedPlugin {
19
22
  "value": implementation.top()
20
23
  ])
21
24
  }
25
+
26
+ @objc func bottom(_ call: CAPPluginCall) {
27
+ call.resolve([
28
+ "value": implementation.bottom()
29
+ ])
30
+ }
31
+
32
+ @objc func setResizeOnFullScreenEnabled(_ call: CAPPluginCall) {
33
+ implementation.setResizeOnFullScreenEnabled(call.getBool("enabled", true))
34
+ call.resolve()
35
+ }
36
+
37
+ @objc func getResizeOnFullScreenEnabled(_ call: CAPPluginCall) {
38
+ call.resolve([
39
+ "enabled": implementation.getResizeOnFullScreenEnabled()
40
+ ])
41
+ }
22
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@falconeta/capacitor-android-full-view",
3
- "version": "8.0.1",
3
+ "version": "8.1.0",
4
4
  "description": "Capacitor plugin for retrieving proper top offset, bottom offset and set full screen ONLY for android",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",