Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRodri committed Aug 12, 2024
1 parent 3c82747 commit 0a6617d
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

* Implement Android suspend/resume cycle using the existing "respawn" API.
* Add `APP.is_suspended` var.
* Add `VIEW_PROCESS_SUSPENDED_EVENT`.
* `VIEW_PROCESS_INITED_EVENT` now notifies a "respawn" on resume after suspension.
Expand Down
3 changes: 3 additions & 0 deletions crates/cargo-zng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ $ cargo zng res --tools
.zr-fail @ cargo-zng
Print an error message and fail the build

.zr-apk @ cargo-zng
Build an Android APK from the parent folder

call 'cargo zng res --help tool' to read full help from a tool
```

Expand Down
2 changes: 1 addition & 1 deletion crates/zng-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Note that this can cause very large trace files and bad performance.
#### `"crash_handler"`
Allow app-process crash handler.

Only enabled in `cfg(not(target_arch = "wasm32"))` builds.
Only enables in `not(any(target_arch = "wasm32", target_os = "android"))` builds.

#### `"ipc"`
Enables IPC tasks and pre-build views and connecting to views running in another process.
Expand Down
2 changes: 1 addition & 1 deletion crates/zng-task/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Enables parking_lot deadlock detection.
#### `"ipc"`
Enables ipc tasks.

Only enabled in `cfg(not(target_arch = "wasm32"))` builds.
Only enables in `cfg(not(any(target_os = "android", target_arch = "wasm32")))` builds.

#### `"http"`
Enables http tasks.
Expand Down
3 changes: 1 addition & 2 deletions crates/zng-view-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ This crate provides 2 feature flags, 1 enabled by default.
#### `"ipc"`
Enables creation of separate or pre-build view.

When this is enabled communication with the view is (de)serialized which can add a
minor cost, something like a 1ms per 3MB frame request.
Only enables in `cfg(not(any(target_os = "android", target_arch = "wasm32")))` builds.

*Enabled by default.*

Expand Down
14 changes: 13 additions & 1 deletion crates/zng-view/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ This crate is part of the [`zng`](https://github.com/zng-ui/zng?tab=readme-ov-fi
<!--do doc --readme features-->
## Cargo Features

This crate provides 3 feature flags, 2 enabled by default.
This crate provides 5 feature flags, 2 enabled by default.

#### `"ipc"`
Enables pre-build and init as view-process.

If this is enabled all communication with the view is serialized/deserialized,
even in same-process mode.

Only enables in `cfg(not(target_os = "android"))` builds.

*Enabled by default.*

#### `"software"`
Expand All @@ -29,6 +31,16 @@ Needs `cargo-about` and Internet connection during build.

Not enabled by default. Note that `"view_prebuilt"` always bundles licenses.

#### `"android_game_activity"`
Standard Android backend that requires a build system that can compile Java or Kotlin and fetch Android dependencies.

See `https://docs.rs/winit/latest/winit/platform/android/` for more details.

#### `"android_native_activity"`
Basic Android backend that does not require Java.

See `https://docs.rs/winit/latest/winit/platform/android/` for more details.

<!--do doc --readme #SECTION-END-->


2 changes: 0 additions & 2 deletions crates/zng-view/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,6 @@ impl Window {

#[cfg(target_os = "android")]
pub(crate) fn message_dialog(&self, dialog: dlg_api::MsgDialog, id: dlg_api::DialogId, event_sender: AppEventSender) {
// !!: TODO
let _ = dialog;
let _ = event_sender.send(AppEvent::Notify(Event::MsgDialogResponse(
id,
Expand Down Expand Up @@ -1785,7 +1784,6 @@ impl Window {

#[cfg(target_os = "android")]
pub(crate) fn file_dialog(&self, dialog: dlg_api::FileDialog, id: dlg_api::DialogId, event_sender: AppEventSender) {
// !!: TODO
let _ = dialog;
let _ = event_sender.send(AppEvent::Notify(Event::MsgDialogResponse(
id,
Expand Down
2 changes: 2 additions & 0 deletions crates/zng-wgt-inspector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Compiles the interactive inspector.
#### `"crash_handler"`
Compiles the debug crash handler.

Only enables in `not(any(target_arch = "wasm32", target_os = "android"))` builds.

<!--do doc --readme #SECTION-END-->


24 changes: 19 additions & 5 deletions crates/zng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ The example above installs `cargo-zng` and uses it to generate a new './my-app'
<!--do doc --readme features-->
## Cargo Features

This crate provides 29 feature flags, 4 enabled by default.
This crate provides 31 feature flags, 4 enabled by default.

#### `"view"`
Include the default view-process implementation.

Only enabled in `cfg(not(target_arch = "wasm32"))` builds.
Only enables in `not(target_arch = "wasm32")` builds.

#### `"view_prebuilt"`
Include the default view-process implementation as an embedded precompiled binary.

Only enabled in `cfg(not(target_arch = "wasm32"))` builds.
Only enables in `not(any(target_arch = "wasm32", target_os = "android"))` builds.

#### `"http"`
Enables HTTP tasks and web features of widgets and services.
Expand All @@ -94,6 +94,8 @@ Enable hot reload builds.

Note that you must configure the target library to hot reload, see `zng::hot_reload` for details.

Only enables in `not(any(target_arch = "wasm32", target_os = "android"))` builds.

#### `"dyn_app_extension"`
Use dynamic dispatch at the app-extension level.

Expand Down Expand Up @@ -122,12 +124,14 @@ Enables single app-process instance mode.
Builds with this feature only allow one app-process, subsequent attempts to spawn the app redirect to
the running app-process.

Only enables in `not(any(target_arch = "wasm32", target_os = "android"))` builds.

#### `"crash_handler"`
Allow app-process crash handler.

Builds with this feature spawn a crash monitor-process for each app-process.

Only enabled in `cfg(not(target_arch = "wasm32"))` builds.
Only enables in `not(any(target_arch = "wasm32", target_os = "android"))` builds.

*Enabled by default.*

Expand Down Expand Up @@ -191,7 +195,7 @@ Not enabled by default. Note that `"view_prebuilt"` always bundles licenses.
#### `"ipc"`
Enables IPC tasks, pre-build views and connecting to views running in another process.

Only enabled in `cfg(not(target_arch = "wasm32"))` builds.
Only enables in `not(any(target_os = "android", target_arch = "wasm32"))` builds.

*Enabled by default.*

Expand All @@ -200,6 +204,16 @@ Check if `zng::env::res` path is available in `init_built_res` first.

Enabled by default in debug builds.

#### `"android_game_activity"`
Standard Android backend that requires a build system that can compile Java or Kotlin and fetch Android dependencies.

See `https://docs.rs/winit/latest/winit/platform/android/` for more details.

#### `"android_native_activity"`
Basic Android backend that does not require Java.

See `https://docs.rs/winit/latest/winit/platform/android/` for more details.

<!--do doc --readme #SECTION-END-->

## Repository
Expand Down
35 changes: 21 additions & 14 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,27 @@ cargo do run markdown

Demonstrates the `Markdown!` widget.

### `multi`

<img alt='multi screenshot' src='./multi/res/screenshot.png' width='300'>

Source: [multi/src](./multi/src)

```console
cargo do run multi
```

Demonstrates a web, mobile and desktop app setup.

Use `cargo do run multi` to run on the desktop.

Use `cargo do build-apk multi` to build a package and Android Studio "Profile or Debug APK" to run on a device.

Use `cargo do run-wasm multi` to run on the browser.

Note that web support is very limited, only a small subset of services are supported and
only headless (without renderer) apps can run.

### `respawn`

<img alt='respawn screenshot' src='./respawn/res/screenshot.png' width='300'>
Expand Down Expand Up @@ -264,20 +285,6 @@ cargo do run transform

Demonstrates 2D and 3D transforms, touch transforms.

### `web`

Source: [web/src](./web/src)

```console
cargo do run web
```

Demonstrates a hybrid web and desktop app setup.

Note that only a small subset of services are supported and only headless (without renderer) apps can run.

Use `cargo do run-wasm web` to run on the browser and `cargo do run web` to run standalone.

### `window`

<img alt='window screenshot' src='./window/res/screenshot.png' width='300'>
Expand Down
Binary file added examples/multi/res/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions examples/multi/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! Demonstrates a web, mobile and desktop app setup.
//!
//! Note that web support is very limited, only a small subset of services are supported and
//! only headless (without renderer) apps can run.
//!
//! Use `cargo do run multi` to run on the desktop.
//!
//! Use `cargo do build-apk multi` to build a package and Android Studio "Profile or Debug APK" to run on a device.
//!
//! Use `cargo do run-wasm multi` to run on the browser.
//!
//! Use `cargo do build-apk multi` to build a package and Android Studio "Profile or Debug APK" to run on a device.
//! Note that web support is very limited, only a small subset of services are supported and
//! only headless (without renderer) apps can run.
mod app;

Expand Down

0 comments on commit 0a6617d

Please sign in to comment.