@capgo/capacitor-screen-orientation 8.1.21 → 8.3.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 +347 -9
- package/android/build.gradle +2 -0
- package/android/src/main/java/ee/forgr/capacitor/screenorientation/CapacitorScreenOrientationPlugin.java +211 -1
- package/android/src/main/java/ee/forgr/capacitor/screenorientation/FoldLayout.java +176 -0
- package/dist/docs.json +809 -37
- package/dist/esm/definitions.d.ts +375 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +15 -1
- package/dist/esm/web.js +52 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +54 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +54 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorScreenOrientationPlugin/CapacitorScreenOrientationPlugin.swift +128 -1
- package/ios/Sources/CapacitorScreenOrientationPlugin/IPhoneDuoFold.swift +258 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,10 +20,29 @@ Screen orientation plugin with support for detecting true physical device orient
|
|
|
20
20
|
- 🔒 **Detect if orientation lock is enabled** by comparing physical vs UI orientation
|
|
21
21
|
- 🔄 Real-time orientation change detection
|
|
22
22
|
- 🎯 Lock orientation to specific modes
|
|
23
|
+
- 📖 **iPhone Duo and Android foldables**: flat, book, or tabletop, hinge angle, which display is showing, and where iPhone Duo puts the tab bar
|
|
23
24
|
- 🌐 Web platform support
|
|
24
25
|
|
|
25
26
|
**Important Note:** This plugin can detect the physical orientation of the device using motion sensors, but it **cannot bypass the UI orientation lock**. The screen will still respect the user's orientation lock setting. This is useful for knowing how the device is physically held vs. how the UI is displayed.
|
|
26
27
|
|
|
28
|
+
## iPhone Duo
|
|
29
|
+
|
|
30
|
+
iPhone Duo (iOS 27.1 or later) is a foldable iPhone. The same fold calls used on Android report it:
|
|
31
|
+
|
|
32
|
+
| Pose | `posture` | Hinge |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| Open flat, or closed on the outer display | `flat` | `180` open, `0` closed |
|
|
35
|
+
| Held half-open like a book | `book` | vertical hinge, about `20`–`160` |
|
|
36
|
+
| Propped half-open like a laptop | `tabletop` | horizontal hinge |
|
|
37
|
+
|
|
38
|
+
Closed on the cover screen, the iPhone Duo simulator reports the outer display and a hinge at 0°:
|
|
39
|
+
|
|
40
|
+
<img src="screenshots/ios-iphone-duo.webp" width="300" alt="iPhone Duo simulator closed on the cover screen, reporting flat, outer display, hinge 0 degrees">
|
|
41
|
+
|
|
42
|
+
`activeDisplay` is `inner` on the large folding screen and `outer` on the cover screen. `getReservedRegions()` returns the fold (`division`) and anything covering the glass, such as the camera (`occlusion`). `getBarPlacement()` says whether iOS moved the tab bar to the side, and how wide that bar is.
|
|
43
|
+
|
|
44
|
+
A regular iPhone, and iOS before 27.1, stays `flat` with no hinge angle. Android foldables report posture and hinge angle the same way. Rear display and dual-screen modes stay on Android.
|
|
45
|
+
|
|
27
46
|
## Documentation
|
|
28
47
|
|
|
29
48
|
The most complete doc is available here: https://capgo.app/docs/plugins/screen-orientation/
|
|
@@ -131,6 +150,12 @@ await ScreenOrientation.stopOrientationTracking();
|
|
|
131
150
|
|
|
132
151
|
// Remove listener
|
|
133
152
|
await listener.remove();
|
|
153
|
+
|
|
154
|
+
// iPhone Duo and Android foldables. Flat on phones that do not fold.
|
|
155
|
+
const { posture, activeDisplay } = await ScreenOrientation.getFoldState();
|
|
156
|
+
const { angle, status } = await ScreenOrientation.getHingeAngle();
|
|
157
|
+
const { verticalBarEdge, inset } = await ScreenOrientation.getBarPlacement();
|
|
158
|
+
const { widthClass } = await ScreenOrientation.getSizeClass();
|
|
134
159
|
```
|
|
135
160
|
|
|
136
161
|
## API
|
|
@@ -143,7 +168,17 @@ await listener.remove();
|
|
|
143
168
|
* [`startOrientationTracking(...)`](#startorientationtracking)
|
|
144
169
|
* [`stopOrientationTracking()`](#stoporientationtracking)
|
|
145
170
|
* [`isOrientationLocked()`](#isorientationlocked)
|
|
171
|
+
* [`isDeviceFoldable()`](#isdevicefoldable)
|
|
172
|
+
* [`getFoldState()`](#getfoldstate)
|
|
173
|
+
* [`getHingeAngle()`](#gethingeangle)
|
|
174
|
+
* [`getReservedRegions()`](#getreservedregions)
|
|
175
|
+
* [`getBarPlacement()`](#getbarplacement)
|
|
176
|
+
* [`setVerticalBarBehavior(...)`](#setverticalbarbehavior)
|
|
177
|
+
* [`getSizeClass()`](#getsizeclass)
|
|
146
178
|
* [`addListener('screenOrientationChange', ...)`](#addlistenerscreenorientationchange-)
|
|
179
|
+
* [`addListener('foldStateChange', ...)`](#addlistenerfoldstatechange-)
|
|
180
|
+
* [`addListener('hingeAngleChange', ...)`](#addlistenerhingeanglechange-)
|
|
181
|
+
* [`addListener('sizeClassChange', ...)`](#addlistenersizeclasschange-)
|
|
147
182
|
* [`removeAllListeners()`](#removealllisteners)
|
|
148
183
|
* [`getPluginVersion()`](#getpluginversion)
|
|
149
184
|
* [Interfaces](#interfaces)
|
|
@@ -275,26 +310,207 @@ Works on both iOS (Core Motion) and Android (Accelerometer).
|
|
|
275
310
|
--------------------
|
|
276
311
|
|
|
277
312
|
|
|
313
|
+
### isDeviceFoldable()
|
|
314
|
+
|
|
315
|
+
```typescript
|
|
316
|
+
isDeviceFoldable() => Promise<DeviceFoldableResult>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Whether this device folds, and whether it can stand half-open like a laptop.
|
|
320
|
+
|
|
321
|
+
Both flags are `false` on web, on Android phones that do not fold, and on iOS except iPhone Duo (iOS 27.1 or later).
|
|
322
|
+
|
|
323
|
+
**Returns:** <code>Promise<<a href="#devicefoldableresult">DeviceFoldableResult</a>></code>
|
|
324
|
+
|
|
325
|
+
**Since:** 8.2.0
|
|
326
|
+
|
|
327
|
+
--------------------
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
### getFoldState()
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
getFoldState() => Promise<FoldState>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Read the current fold.
|
|
337
|
+
|
|
338
|
+
Resolves to a flat state when the device has no fold.
|
|
339
|
+
|
|
340
|
+
**Returns:** <code>Promise<<a href="#foldstate">FoldState</a>></code>
|
|
341
|
+
|
|
342
|
+
**Since:** 8.2.0
|
|
343
|
+
|
|
344
|
+
--------------------
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
### getHingeAngle()
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
getHingeAngle() => Promise<HingeAngleResult>
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Read the hinge angle in degrees.
|
|
354
|
+
|
|
355
|
+
`0` is closed and `180` is flat. `angle` is `null` without a hinge sensor.
|
|
356
|
+
|
|
357
|
+
**Returns:** <code>Promise<<a href="#hingeangleresult">HingeAngleResult</a>></code>
|
|
358
|
+
|
|
359
|
+
**Since:** 8.2.0
|
|
360
|
+
|
|
361
|
+
--------------------
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
### getReservedRegions()
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
getReservedRegions() => Promise<{ regions: ReservedRegion[]; }>
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Read the fold and anything covering the screen.
|
|
371
|
+
|
|
372
|
+
iPhone Duo reports the fold, the vertical status bar area, and the under-display camera.
|
|
373
|
+
Resolves to an empty list on Android, web, and iOS before 27.1.
|
|
374
|
+
|
|
375
|
+
**Returns:** <code>Promise<{ regions: ReservedRegion[]; }></code>
|
|
376
|
+
|
|
377
|
+
**Since:** 8.2.0
|
|
378
|
+
|
|
379
|
+
--------------------
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
### getBarPlacement()
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
getBarPlacement() => Promise<BarPlacement>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Read where iPhone Duo puts native tab bars and toolbars.
|
|
389
|
+
|
|
390
|
+
`verticalBarEdge` is `null` when bars stay horizontal, and always on Android and web.
|
|
391
|
+
|
|
392
|
+
**Returns:** <code>Promise<<a href="#barplacement">BarPlacement</a>></code>
|
|
393
|
+
|
|
394
|
+
**Since:** 8.2.0
|
|
395
|
+
|
|
396
|
+
--------------------
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
### setVerticalBarBehavior(...)
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
setVerticalBarBehavior(options: { behavior: 'automatic' | 'disabled'; }) => Promise<{ applied: boolean; }>
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Choose whether iPhone Duo may move this app's bars to the side.
|
|
406
|
+
|
|
407
|
+
Resolves to `{ applied: false }` unless the app's bridge view controller opts in.
|
|
408
|
+
Android and web always resolve to `{ applied: false }`.
|
|
409
|
+
|
|
410
|
+
| Param | Type | Description |
|
|
411
|
+
| ------------- | ----------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
412
|
+
| **`options`** | <code>{ behavior: 'automatic' \| 'disabled'; }</code> | `automatic` lets the system move bars. `disabled` keeps them horizontal. |
|
|
413
|
+
|
|
414
|
+
**Returns:** <code>Promise<{ applied: boolean; }></code>
|
|
415
|
+
|
|
416
|
+
**Since:** 8.2.0
|
|
417
|
+
|
|
418
|
+
--------------------
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
### getSizeClass()
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
getSizeClass() => Promise<SizeClass>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Read the window size classes.
|
|
428
|
+
|
|
429
|
+
**Returns:** <code>Promise<<a href="#sizeclass">SizeClass</a>></code>
|
|
430
|
+
|
|
431
|
+
**Since:** 8.2.0
|
|
432
|
+
|
|
433
|
+
--------------------
|
|
434
|
+
|
|
435
|
+
|
|
278
436
|
### addListener('screenOrientationChange', ...)
|
|
279
437
|
|
|
280
438
|
```typescript
|
|
281
439
|
addListener(eventName: 'screenOrientationChange', listenerFunc: (result: ScreenOrientationResult) => void) => Promise<PluginListenerHandle>
|
|
282
440
|
```
|
|
283
441
|
|
|
284
|
-
|
|
442
|
+
| Param | Type |
|
|
443
|
+
| ------------------ | ------------------------------------------------------------------------------------------------ |
|
|
444
|
+
| **`eventName`** | <code>'screenOrientationChange'</code> |
|
|
445
|
+
| **`listenerFunc`** | <code>(result: <a href="#screenorientationresult">ScreenOrientationResult</a>) => void</code> |
|
|
446
|
+
|
|
447
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
448
|
+
|
|
449
|
+
--------------------
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
### addListener('foldStateChange', ...)
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
addListener(eventName: 'foldStateChange', listenerFunc: (state: FoldState) => void) => Promise<PluginListenerHandle>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Listen for fold changes.
|
|
285
459
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
detected by motion sensors even when orientation lock is enabled.
|
|
460
|
+
On a foldable this also fires when the device rotates, because the hinge
|
|
461
|
+
bounds rotate with the window.
|
|
289
462
|
|
|
290
|
-
| Param | Type
|
|
291
|
-
| ------------------ |
|
|
292
|
-
| **`eventName`** | <code>'
|
|
293
|
-
| **`listenerFunc`** | <code>(
|
|
463
|
+
| Param | Type | Description |
|
|
464
|
+
| ------------------ | ------------------------------------------------------------------- | ------------------------------------------ |
|
|
465
|
+
| **`eventName`** | <code>'foldStateChange'</code> | The event name. Must be 'foldStateChange'. |
|
|
466
|
+
| **`listenerFunc`** | <code>(state: <a href="#foldstate">FoldState</a>) => void</code> | Callback invoked with the new fold state. |
|
|
294
467
|
|
|
295
468
|
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
296
469
|
|
|
297
|
-
**Since:**
|
|
470
|
+
**Since:** 8.2.0
|
|
471
|
+
|
|
472
|
+
--------------------
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
### addListener('hingeAngleChange', ...)
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
addListener(eventName: 'hingeAngleChange', listenerFunc: (event: HingeAngleResult) => void) => Promise<PluginListenerHandle>
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Listen for hinge angle changes.
|
|
482
|
+
|
|
483
|
+
On Android the hinge sensor runs only while at least one listener is registered.
|
|
484
|
+
On iOS this fires on iPhone Duo (iOS 27.1 or later). Never fires on web.
|
|
485
|
+
|
|
486
|
+
| Param | Type | Description |
|
|
487
|
+
| ------------------ | --------------------------------------------------------------------------------- | ------------------------------------------- |
|
|
488
|
+
| **`eventName`** | <code>'hingeAngleChange'</code> | The event name. Must be 'hingeAngleChange'. |
|
|
489
|
+
| **`listenerFunc`** | <code>(event: <a href="#hingeangleresult">HingeAngleResult</a>) => void</code> | Callback invoked with the angle in degrees. |
|
|
490
|
+
|
|
491
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
492
|
+
|
|
493
|
+
**Since:** 8.2.0
|
|
494
|
+
|
|
495
|
+
--------------------
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
### addListener('sizeClassChange', ...)
|
|
499
|
+
|
|
500
|
+
```typescript
|
|
501
|
+
addListener(eventName: 'sizeClassChange', listenerFunc: (sizeClass: SizeClass) => void) => Promise<PluginListenerHandle>
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Listen for size class changes, such as unfolding, rotating, or resizing.
|
|
505
|
+
|
|
506
|
+
| Param | Type | Description |
|
|
507
|
+
| ------------------ | ----------------------------------------------------------------------- | ------------------------------------------ |
|
|
508
|
+
| **`eventName`** | <code>'sizeClassChange'</code> | The event name. Must be 'sizeClassChange'. |
|
|
509
|
+
| **`listenerFunc`** | <code>(sizeClass: <a href="#sizeclass">SizeClass</a>) => void</code> | Callback invoked with the new size class. |
|
|
510
|
+
|
|
511
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
512
|
+
|
|
513
|
+
**Since:** 8.2.0
|
|
298
514
|
|
|
299
515
|
--------------------
|
|
300
516
|
|
|
@@ -373,6 +589,103 @@ Result returned by the isOrientationLocked() method.
|
|
|
373
589
|
| **`uiOrientation`** | <code><a href="#orientationtype">OrientationType</a></code> | The current UI orientation reported by the system. | 1.0.0 |
|
|
374
590
|
|
|
375
591
|
|
|
592
|
+
#### DeviceFoldableResult
|
|
593
|
+
|
|
594
|
+
Whether this device can fold.
|
|
595
|
+
|
|
596
|
+
| Prop | Type | Description | Since |
|
|
597
|
+
| ---------------------- | -------------------- | --------------------------------------------- | ----- |
|
|
598
|
+
| **`foldable`** | <code>boolean</code> | Whether the device has a fold. | 8.2.0 |
|
|
599
|
+
| **`supportsTabletop`** | <code>boolean</code> | Whether it can stand half-open like a laptop. | 8.2.0 |
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
#### FoldState
|
|
603
|
+
|
|
604
|
+
Current fold of the window.
|
|
605
|
+
|
|
606
|
+
Phones that do not fold, and iOS before 27.1, resolve to a flat state.
|
|
607
|
+
iPhone Duo reports `book`, `tabletop`, or `flat`, and which display is in front.
|
|
608
|
+
|
|
609
|
+
| Prop | Type | Description | Since |
|
|
610
|
+
| ---------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
611
|
+
| **`state`** | <code><a href="#foldstatevalue">FoldStateValue</a></code> | Posture of the fold. | 8.2.0 |
|
|
612
|
+
| **`isSeparating`** | <code>boolean</code> | Whether the fold splits the web view into two areas. | 8.2.0 |
|
|
613
|
+
| **`posture`** | <code><a href="#foldposture">FoldPosture</a></code> | How the device is held. | 8.2.0 |
|
|
614
|
+
| **`hingeOrientation`** | <code><a href="#hingeorientation">HingeOrientation</a></code> | Direction of the hinge. Omitted when there is no fold. | 8.2.0 |
|
|
615
|
+
| **`hingeBounds`** | <code><a href="#foldbounds">FoldBounds</a></code> | Position of the fold in CSS pixels. Omitted when there is no fold. | 8.2.0 |
|
|
616
|
+
| **`occludedBounds`** | <code><a href="#foldbounds">FoldBounds</a></code> | Area the hinge covers. Present when the hinge has a physical gap. | 8.2.0 |
|
|
617
|
+
| **`activeDisplay`** | <code>'inner' \| 'outer'</code> | Which display is showing the app on iPhone Duo. Omitted on Android, web, and iOS before 27.1. | 8.2.0 |
|
|
618
|
+
| **`hingeMargins`** | <code>{ top: number; right: number; bottom: number; left: number; }</code> | Space the system keeps clear around the fold, in CSS pixels. iPhone Duo reports 20 on each side of a vertical fold. | 8.2.0 |
|
|
619
|
+
| **`cameraBounds`** | <code>FoldBounds[]</code> | Areas covering the display, such as the iPhone Duo camera. Omitted when there are none. | 8.2.0 |
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
#### FoldBounds
|
|
623
|
+
|
|
624
|
+
A rectangle in CSS pixels, relative to the web view.
|
|
625
|
+
|
|
626
|
+
| Prop | Type |
|
|
627
|
+
| ------------ | ------------------- |
|
|
628
|
+
| **`x`** | <code>number</code> |
|
|
629
|
+
| **`y`** | <code>number</code> |
|
|
630
|
+
| **`width`** | <code>number</code> |
|
|
631
|
+
| **`height`** | <code>number</code> |
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
#### HingeAngleResult
|
|
635
|
+
|
|
636
|
+
Angle between the two halves of a foldable, in degrees.
|
|
637
|
+
|
|
638
|
+
`0` is closed and `180` is flat. `angle` is `null` when the device has no hinge sensor.
|
|
639
|
+
|
|
640
|
+
| Prop | Type | Description | Since |
|
|
641
|
+
| ------------ | --------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----- |
|
|
642
|
+
| **`angle`** | <code>number \| null</code> | Hinge angle in degrees, or `null` when no sensor is available. | 8.2.0 |
|
|
643
|
+
| **`status`** | <code>'closed' \| 'partiallyOpen' \| 'fullyOpen' \| null</code> | How far open iPhone Duo is, as the system sees it. `null` on Android and web. | 8.2.0 |
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
#### ReservedRegion
|
|
647
|
+
|
|
648
|
+
A region the system reserves on iPhone Duo.
|
|
649
|
+
|
|
650
|
+
`division` is the fold. `occlusion` is something covering the display, such as the camera.
|
|
651
|
+
|
|
652
|
+
| Prop | Type | Description | Since |
|
|
653
|
+
| -------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ----- |
|
|
654
|
+
| **`kind`** | <code>'division' \| 'occlusion'</code> | What the region is. | 8.2.0 |
|
|
655
|
+
| **`isActive`** | <code>boolean</code> | Whether the region applies right now. An inactive division is a flat fold. | 8.2.0 |
|
|
656
|
+
| **`x`** | <code>number</code> | Left edge, in CSS pixels. | 8.2.0 |
|
|
657
|
+
| **`y`** | <code>number</code> | Top edge, in CSS pixels. | 8.2.0 |
|
|
658
|
+
| **`width`** | <code>number</code> | Width in CSS pixels. | 8.2.0 |
|
|
659
|
+
| **`height`** | <code>number</code> | Height in CSS pixels. | 8.2.0 |
|
|
660
|
+
| **`margins`** | <code>{ top: number; right: number; bottom: number; left: number; }</code> | Space to keep clear around the region, in CSS pixels. | 8.2.0 |
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
#### BarPlacement
|
|
664
|
+
|
|
665
|
+
Where iPhone Duo places native bars.
|
|
666
|
+
|
|
667
|
+
| Prop | Type | Description | Since |
|
|
668
|
+
| --------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------- | ----- |
|
|
669
|
+
| **`verticalBarEdge`** | <code>'leading' \| 'trailing' \| null</code> | The edge the system moves tab bars and toolbars to. `null` when they stay horizontal. | 8.2.0 |
|
|
670
|
+
| **`inset`** | <code>number</code> | How much room the vertical bar takes, in points. `0` when bars stay horizontal. | 8.2.0 |
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
#### SizeClass
|
|
674
|
+
|
|
675
|
+
Window size classes.
|
|
676
|
+
|
|
677
|
+
`horizontal` and `vertical` follow Apple's compact/regular split.
|
|
678
|
+
On Android and web, `regular` starts at 600 CSS pixels wide and 480 tall.
|
|
679
|
+
`widthClass` and `heightClass` follow Material window size classes.
|
|
680
|
+
|
|
681
|
+
| Prop | Type | Description | Since |
|
|
682
|
+
| ----------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
683
|
+
| **`horizontal`** | <code>'compact' \| 'regular'</code> | Width size class. `compact` on a phone, `regular` on the inner display of a foldable, a tablet, or a window at least 600 CSS pixels wide. | 8.2.0 |
|
|
684
|
+
| **`vertical`** | <code>'compact' \| 'regular'</code> | Height size class. `regular` starts at 480 CSS pixels. | 8.2.0 |
|
|
685
|
+
| **`widthClass`** | <code>'compact' \| 'medium' \| 'expanded' \| 'large' \| 'extraLarge'</code> | Material window width class. | 8.2.0 |
|
|
686
|
+
| **`heightClass`** | <code>'compact' \| 'medium' \| 'expanded'</code> | Material window height class. | 8.2.0 |
|
|
687
|
+
|
|
688
|
+
|
|
376
689
|
#### PluginListenerHandle
|
|
377
690
|
|
|
378
691
|
| Prop | Type |
|
|
@@ -396,4 +709,29 @@ Orientation lock type that can be used to lock the device orientation.
|
|
|
396
709
|
|
|
397
710
|
<code>'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'</code>
|
|
398
711
|
|
|
712
|
+
|
|
713
|
+
#### FoldStateValue
|
|
714
|
+
|
|
715
|
+
How open a foldable is.
|
|
716
|
+
|
|
717
|
+
`closed` is reserved. A device shut onto its cover display reports `flat`.
|
|
718
|
+
|
|
719
|
+
<code>'flat' | 'half-opened'</code>
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
#### FoldPosture
|
|
723
|
+
|
|
724
|
+
How a half-open foldable is held.
|
|
725
|
+
|
|
726
|
+
`tabletop` is a horizontal hinge, like a laptop. `book` is a vertical hinge.
|
|
727
|
+
|
|
728
|
+
<code>'flat' | 'tabletop' | 'book'</code>
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
#### HingeOrientation
|
|
732
|
+
|
|
733
|
+
Direction of the hinge relative to the window.
|
|
734
|
+
|
|
735
|
+
<code>'horizontal' | 'vertical'</code>
|
|
736
|
+
|
|
399
737
|
</docgen-api>
|
package/android/build.gradle
CHANGED
|
@@ -3,6 +3,7 @@ ext {
|
|
|
3
3
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
4
|
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
5
|
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
|
+
androidxWindowVersion = project.hasProperty('androidxWindowVersion') ? rootProject.ext.androidxWindowVersion : '1.5.1'
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
buildscript {
|
|
@@ -52,6 +53,7 @@ dependencies {
|
|
|
52
53
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
54
|
implementation project(':capacitor-android')
|
|
54
55
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
56
|
+
implementation "androidx.window:window-java:$androidxWindowVersion"
|
|
55
57
|
testImplementation "junit:junit:$junitVersion"
|
|
56
58
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
59
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|