@blotch/angular-lynx-native 22.2.15 → 22.2.17
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
|
@@ -15,7 +15,7 @@ An ejected project (`ios/` or `android/` with a `.angular-lynx-ejected` marker,
|
|
|
15
15
|
|
|
16
16
|
## The shells
|
|
17
17
|
|
|
18
|
-
Both are one full-screen `LynxView` running `main.lynx.bundle`; Angular Router does all navigation inside it. Bundles and assets load from inside the app, so RSpeedy's default asset prefix (`/static/...`) works with no configuration. The `LynxView` fills the screen, under the status bar and the home indicator (`"edgeToEdge": false` in angular.json puts it inside the safe area instead). Lynx's own CSS `env(safe-area-inset-*)` is 0 there: Android never sets it, and the iOS shell creates its `LynxView` before the window is key, where Lynx reads it. The runtime gives every `env(safe-area-inset-*)` the insets the shell sends instead (see `safe-area-insets.ts` in the runtime), so they follow rotation. On Android the activity still pads the page for the keyboard, and the bottom inset is 0 while it's open.
|
|
18
|
+
Both are one full-screen `LynxView` running `main.lynx.bundle`; Angular Router does all navigation inside it. Bundles and assets load from inside the app, so RSpeedy's default asset prefix (`/static/...`) works with no configuration. The `LynxView` fills the screen, under the status bar and the home indicator (`"edgeToEdge": false` in angular.json puts it inside the safe area instead). Lynx's own CSS `env(safe-area-inset-*)` is 0 there: Android never sets it, and the iOS shell creates its `LynxView` before the window is key, where Lynx reads it. The runtime gives every `env(safe-area-inset-*)` the insets the shell sends instead (see `safe-area-insets.ts` in the runtime), so they follow rotation. On Android the activity still pads the page for the keyboard, and the bottom inset is 0 while it's open. An `<overlay>` fills the screen too, so a bottom sheet covers the page down to the screen's edge and pads its content by the insets: on Android XElement's overlay window stops above the navigation bar, so the shell registers its own `overlay` behavior, `EdgeToEdgeOverlay.kt`, whose window draws under every bar, as the activity's does.
|
|
19
19
|
|
|
20
20
|
Both send the same global props, which the runtime's services read: `platform`, `theme` (again whenever the phone switches between light and dark), `appLocale` (the phone's language as a BCP 47 tag), `appTimeZone` (its time zone's IANA name, which the `intl` build option's `Intl.DateTimeFormat` uses), `isNotchScreen`, `edgeToEdge`, the safe-area insets `safeAreaTop`, `safeAreaBottom`, `safeAreaLeft` and `safeAreaRight` (again whenever they change), `osVersion` (which Lynx leaves out of the main thread's `SystemInfo`), and the accessibility settings `reduceMotion`, `reduceTransparency` (iOS only) and `increaseContrast`, again whenever the user changes one. Android 12 and later also send `dynamicColors`, the wallpaper's Material 3 color roles in light and dark (`DynamicColors.kt`), again when the user changes their wallpaper or colors. Lynx Explorer sends `theme` and `isNotchScreen` too, but no `appLocale`, `appTimeZone`, `osVersion` or accessibility settings. See [`templates/android/README.md`](templates/android/README.md) for the Android shell's details.
|
|
21
21
|
|
package/package.json
CHANGED
|
@@ -161,6 +161,9 @@ dependencies {
|
|
|
161
161
|
exclude(group = "org.lynxsdk.lynx", module = "xelement-animax")
|
|
162
162
|
exclude(group = "org.lynxsdk.lynx", module = "xelement-markdown")
|
|
163
163
|
}
|
|
164
|
+
// The umbrella declares its modules for runtime only. EdgeToEdgeOverlay
|
|
165
|
+
// extends <overlay>'s classes, so that module is compiled against too.
|
|
166
|
+
implementation("org.lynxsdk.lynx:xelement-overlay:$lynxVersion")
|
|
164
167
|
// XElement's modules depend on appcompat and material 1.0.0, which bring
|
|
165
168
|
// vectordrawable 1.0.0 and vectordrawable-animated 1.0.0. Those two share
|
|
166
169
|
// the namespace androidx.vectordrawable, and AGP 9's manifest merger
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
package dev.angularlynx.shell
|
|
2
|
+
|
|
3
|
+
import android.os.Build
|
|
4
|
+
import android.view.WindowManager
|
|
5
|
+
import androidx.core.view.WindowCompat
|
|
6
|
+
import com.lynx.tasm.behavior.Behavior
|
|
7
|
+
import com.lynx.tasm.behavior.LynxContext
|
|
8
|
+
import com.lynx.tasm.behavior.shadow.ShadowNode
|
|
9
|
+
import com.lynx.tasm.behavior.ui.LynxUI
|
|
10
|
+
import com.lynx.xelement.LynxUIOverlayAutoRegistry
|
|
11
|
+
import com.lynx.xelement.LynxUIOverlayShadowNodeAutoRegistry
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* XElement's `<overlay>`, drawn under the system bars as the page is in an
|
|
15
|
+
* edge-to-edge app (see MainActivity).
|
|
16
|
+
*
|
|
17
|
+
* An overlay is a Dialog with its own window. XElement lays the overlay's
|
|
18
|
+
* content out at the screen's full height and lets the window draw under the
|
|
19
|
+
* status bar, but leaves the window fitting the navigation bar: below
|
|
20
|
+
* Android 15 nothing changes that, and on 15 and later it opts out of edge to
|
|
21
|
+
* edge unless the overlay sets `android-adapt-edge-to-edge`. So the window
|
|
22
|
+
* ended above the navigation bar and cut off the bottom of its content, and
|
|
23
|
+
* the page showed beneath it: a bottom sheet stopped short of the screen's
|
|
24
|
+
* edge, over the undimmed bottom of the page, while on iOS it covers the
|
|
25
|
+
* screen. Here the window draws under every bar and the cutout, as the page's
|
|
26
|
+
* does, on every version, and the content pads itself with
|
|
27
|
+
* env(safe-area-inset-*), as the page's does (dolan's bottom sheet with
|
|
28
|
+
* `pb-safe`). It still shows the activity's navigation bar color, which
|
|
29
|
+
* enableEdgeToEdge() made transparent: XElement copies it when the overlay
|
|
30
|
+
* opens.
|
|
31
|
+
*
|
|
32
|
+
* An overlay that sets `android-adapt-edge-to-edge` itself still gets what it
|
|
33
|
+
* asks for on Android 15 and later.
|
|
34
|
+
*/
|
|
35
|
+
class EdgeToEdgeOverlay(context: LynxContext) : LynxUIOverlayAutoRegistry(context) {
|
|
36
|
+
init {
|
|
37
|
+
// The overlay's view, which owns the Dialog.
|
|
38
|
+
transitionUI.window?.let { window ->
|
|
39
|
+
WindowCompat.setDecorFitsSystemWindows(window, false)
|
|
40
|
+
// Into the camera cutout too, as enableEdgeToEdge() lets the
|
|
41
|
+
// activity's window: in landscape the cutout is on a side the
|
|
42
|
+
// status bar doesn't cover.
|
|
43
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
44
|
+
window.attributes = window.attributes.apply {
|
|
45
|
+
layoutInDisplayCutoutMode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
46
|
+
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
|
47
|
+
} else {
|
|
48
|
+
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
companion object {
|
|
56
|
+
/**
|
|
57
|
+
* Replaces XElement's `overlay` behavior: MainActivity adds it after
|
|
58
|
+
* XElement's, and the last behavior added for a tag wins. The shadow
|
|
59
|
+
* node, which sizes the content to the screen, stays XElement's.
|
|
60
|
+
*/
|
|
61
|
+
fun behavior(): Behavior = object : Behavior("overlay") {
|
|
62
|
+
override fun createUI(context: LynxContext): LynxUI<*> = EdgeToEdgeOverlay(context)
|
|
63
|
+
override fun createShadowNode(): ShadowNode = LynxUIOverlayShadowNodeAutoRegistry()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -129,6 +129,9 @@ class MainActivity : ComponentActivity(), ShellModule.Host, WebAuthModule.Host {
|
|
|
129
129
|
// these come from XElement (see app/build.gradle.kts). Lynx
|
|
130
130
|
// Explorer registers them the same way.
|
|
131
131
|
addBehaviors(XElementBehaviors().create())
|
|
132
|
+
// In an edge-to-edge app an <overlay>'s window fills the screen as
|
|
133
|
+
// the page does, under the navigation bar too (EdgeToEdgeOverlay.kt).
|
|
134
|
+
if (edgeToEdge) addBehavior(EdgeToEdgeOverlay.behavior())
|
|
132
135
|
// The shell's own <canvas> (CanvasUI.kt): Lynx has none.
|
|
133
136
|
addBehavior(CanvasUI.behavior())
|
|
134
137
|
}.build(this)
|