Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/gpui-mobile/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ These come from bugs actually hit in this stack.
Activity pointers. Load app classes with `find_app_class`, since
`FindClass` on a native thread can't see them.
6. **If the Activity handles `uiMode` in `configChanges`, call
`host::configuration_changed()` from `onConfigurationChanged`**, or dark
`host::configuration_changed(newConfig.uiMode)` from `onConfigurationChanged`**, or dark
mode never updates.
7. **`window.request_animation_frame()` only inside `render`.** Called from a
click handler it panics.
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/gpui-mobile/references/gotchas.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ anything newer.
| Blank screen on start | `host::on_open_window` registered after the first `surface_created`, or not at all. |
| Icons and SVGs missing | `host::start` instead of `host::start_with_assets(gpui_kit::assets::AllAssets, …)`. |
| Emoji show as boxes | Android 13+ ships a COLRv1 emoji font that swash can't draw. Bundle `assets/fonts/NotoColorEmoji.ttf` (CBDT) and call `host::set_activity` (or `set_host_activity`) before `host::start`. Flags and ❤️ with VS16 still don't render. |
| Dark mode doesn't follow the system | The Activity lists `uiMode` in `configChanges` but doesn't call `host::configuration_changed()` from `onConfigurationChanged`. |
| Dark mode doesn't follow the system | The Activity lists `uiMode` in `configChanges` but doesn't call `host::configuration_changed(newConfig.uiMode)` from `onConfigurationChanged`. |
| Text white on white in a dark chat bubble; shimmer invisible | Kit bugs kit#3326, kit#3327; not Android-specific. |
| Bold/italic look regular | Roboto is a variable font; weights aren't applied. |
| Popover or submenu off screen | Not clamped to the viewport yet. |
Expand Down
4 changes: 2 additions & 2 deletions .claude/skills/gpui-mobile/references/new-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ API:
| `host::surface_destroyed(host)` | `surfaceDestroyed`; blocks up to 2 s until the renderer lets go |
| `host::resumed(host)` / `host::paused(host)` | `onResume` / `onPause` |
| `host::host_destroyed(host)` | `onDestroy`, only when `isFinishing()` |
| `host::configuration_changed()` | `onConfigurationChanged` |
| `host::configuration_changed(ui_mode)` | `onConfigurationChanged`, with `newConfig.uiMode` |
| `host::motion_event(action, index, &[Pointer { id, x, y }]) -> bool` | touch listener; physical px relative to the SurfaceView |
| `host::key(code, action, meta)` | `dispatchKeyEvent` |
| `host::ime_event(session, kind, text, start, end)` | from the IME proxy; kinds: 0 composing, 1 commit, 2 delete surrounding, 3 delete code points, 4 done, 5 keyboard hidden by Back, 6 action key (`IME_ACTION_*` in `start`) |
Expand Down Expand Up @@ -130,7 +130,7 @@ Copy `LabActivity.java` and rename. What it must do:
Copy it as is.
- `onNewIntent`: `setIntent(intent)`, then forward the data URI to
`deeplink::handle_link` and any `screen` extra.
- `onConfigurationChanged`: call the native `configuration_changed`.
- `onConfigurationChanged`: call the native `configuration_changed` with `newConfig.uiMode`.

## Manifest and Gradle

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ crate-type = ["cdylib"]
# (see MOBILE_PATCHES.md for what each carries on top of upstream).
gpui = { package = "gpui-pre", version = "=0.3.8", default-features = false }
gpui-kit = { git = "https://github.com/Bombatomica64/gpui-kit", rev = "e8b28164ac7fa7e1f7d393d441beb738c286bbc8", default-features = false, features = ["component", "assets"] }
gpui-mobile = { package = "gpui-pre-mobile", git = "https://github.com/Bombatomica64/gpui-mobile", rev = "c45635642cf6c1e7718c40e113ba2c925878f998", default-features = false, features = [
gpui-mobile = { package = "gpui-pre-mobile", git = "https://github.com/Bombatomica64/gpui-mobile", rev = "e12e14d7ef503258e949b37d9d6aff1da8ebd28d", default-features = false, features = [
"clipboard", "share",
# Exercised by the Platform APIs screen; build.sh copies their Java helpers from this checkout.
"file_selector", "image_picker", "local_auth", "permission_handler", "calendar", "contacts",
Expand Down
12 changes: 8 additions & 4 deletions MOBILE_PATCHES.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ like back. `show_soft_keyboard` / `hide_soft_keyboard` are implemented, so

Without `android-activity`, night mode was never read, so the window stayed
Light (and `Platform::window_appearance` always said Dark). It is now read
from the application context's configuration, which the first
`set_host_activity` keeps, and applied to each window when it opens,
re-attaches and resumes. An Activity that handles `uiMode` itself must call
the new `host::configuration_changed()`, which updates every host's window.
from the current host Activity's Resources, so an app-local night mode
counts too, and applied by the platform whenever a window opens or gets a
new surface, and on resume. An Activity that handles `uiMode` itself must
call the new `host::configuration_changed(newConfig.uiMode)`, which updates
every host's window. `window_appearance` answers the value last applied.
Review fixes pushed and replied to, see
[docs/upstream/replies](docs/upstream/replies/gpui-mobile-30.md); merged into
`main` with fork PR #14.

### Load the bundled emoji font on the host path — branch `android-host-emoji-font`, [#29](https://github.com/longbridge/gpui-mobile/pull/29)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void onCreate(Bundle state) {
@Override
public void onConfigurationChanged(android.content.res.Configuration config) {
super.onConfigurationChanged(config);
nativeConfigurationChanged();
nativeConfigurationChanged(config.uiMode);
}

// Testing aid: `adb shell am start -n dev.gpui.mobile.lab/.LabActivity --es screen "Charts"`
Expand Down Expand Up @@ -437,7 +437,7 @@ private void endEdit() {
private static native void nativeOnCreate(Activity activity, long host, int apiLevel);
private static native void nativeOpenScreen(String screen);
private static native void nativeDeepLink(String url);
private static native void nativeConfigurationChanged();
private static native void nativeConfigurationChanged(int uiMode);
private static native void nativeSurfaceChanged(long host, android.view.Surface surface, float scale);
private static native void nativeSurfaceDestroyed(long host);
private static native void nativeHostDestroyed(long host);
Expand Down
3 changes: 2 additions & 1 deletion src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ pub extern "system" fn Java_dev_gpui_mobile_lab_LabActivity_nativeDeepLink<'loca
pub extern "system" fn Java_dev_gpui_mobile_lab_LabActivity_nativeConfigurationChanged<'local>(
_env: EnvUnowned<'local>,
_this: JObject<'local>,
ui_mode: i32,
) {
log::info!("configuration changed");
host::configuration_changed();
host::configuration_changed(ui_mode);
}

#[unsafe(no_mangle)]
Expand Down
Loading