Skip to content

feat(mobile): type into Android's own text field from the Capture form - #3001

Merged
Mavrick-F merged 2 commits into
opengeos:mainfrom
Mavrick-F:feat/android-text-entry
Nov 26, 2026
Merged

Mavrick-F merged 2 commits into
opengeos:mainfrom
Mavrick-F:feat/android-text-entry

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

On Android, typing into the phone's text fields misses most of what the keyboard does. Paste does nothing, and suggestions, glide typing and dictation don't reach the field. The app is a NativeActivity, which hands its window's touches and keys straight to Rust. winit maps Android's KeyAction::Multiple (the event paste, glide typing and dictation send) to a key release with no text. egui-winit also has no system clipboard on Android, so text copied in RustGIS stays inside the app.

This gives the touch interface Android's own text field:

  • Platform gets enters_text and enter_text(&TextEntry) (id, current value, label, kind: plain, lines, secret, number). Both have defaults that do nothing, so the desktop, the browser and iOS are unchanged. The answers come back as Event::Typed: Typed::Text { id, text } on each change, then Typed::Closed { id, failed }.
  • On Android, MainActivity.enterText opens an EditText in a Dialog docked above the soft keyboard. It is a window of its own because NativeActivity takes its own window's input queue, so a view added there gets no touches or keys. It uses plain platform widgets: no Jetpack, no Gradle. Secret entries use TYPE_TEXT_VARIATION_PASSWORD with the password autofill hint. Number entries get the number keyboard through setRawInputType, without Android's digit filter, which would turn a pasted 1e3 into 13. The Capture parser checks the number as before.
  • Text is sent on each change, not only on Done. The form behind the box shows the value as it is typed, its contingent lists and required marks follow it, and nothing typed is lost however the box closes (Done, the keyboard's Done, Back, or a tap outside it). Between two frames only the latest text is kept, since each event carries all of it. The event line escapes backslashes, tabs and line breaks.
  • The Capture form draws its text and number fields as boxes showing their value when the phone has native entry (Services::enter_text), and opens the native box on a tap. Each opening has its own id, so a late close from an earlier opening can't end a later one. Text that arrives after Capture has moved to another layer, or after the layer lost the field, is reported in a notice and not stored.
  • Text copied in RustGIS (egui's OutputCommand::CopyText) also goes on Android's clipboard. A refusal (Android won't pass on a very large copy) is reported in a notice. The app's own clipboard still has the text.

Fields the desktop interface draws, the Assistant's settings among them, still use egui's own text field on Android. The Assistant's phone sheet (stage 1a of the phone plan) will use this entry, including the secret kind.

Surfaces. The phone's touch interface on Android. iOS keeps the trait default: its keyboard goes through winit's UIKeyInput path, and I can't run iOS on this machine. Desktop, browser, CLI and Python have no touch sheets and keep egui's fields; the browser's literal sets enter_text: None. No command, ribbon, shortcut, Assistant/MCP tool or plugin interface changes. The way back is unchanged: the value goes into the same form field and the feature is added with the same undoable command.

Testing

  • crates/ui-touch: a_field_typed_into_with_the_systems_text_field_fills_the_feature taps the drawn box and checks the entry asked for (value, label, kind). It sends changes back and checks that another field's answer and an earlier opening's late close change nothing, that the added feature holds the typed text (tab and all), and that text arriving after Capture moved to another layer is reported, not stored.
  • crates/engine platform::tests: the new text, text-closed and copy-failed lines, escapes included, and malformed ones read as failures quoting the line.
  • apps/rustgis-mobile/build-apk.sh x86_64 builds (javac, d8, the Rust library).
  • The full Linux CI (lint and clippy, the workspace tests, wasm, licences) passed on this head on my fork.
  • On the Android 16 (API 36) x86_64 emulator with KVM, drawing through SwiftShader Vulkan. The debug APK ran with WGPU_DEBUG=0: the emulator's Vulkan driver crashes on the object names wgpu gives in debug builds, which a release build doesn't set: tapping a Capture field opens Android's text box docked at the bottom, with the field's name and Done; typed text reaches the form field as it is typed; cut and paste through Android's clipboard work in the box; Done, Back (the first Back hides the keyboard, as Android does) and a tap outside close it, keeping the value; reopening shows it again; rotating with the box open keeps the box and its text.
  • Not checked on the emulator: a number field keeping a pasted 1e3, the typed value in a feature added from the form, and a copy from a RustGIS field reaching Android's clipboard; the ui-touch test above covers the typed value reaching the feature.
  • Not run: a real phone, and iOS (no Mac here). iOS keeps the defaults; the PR's iOS job builds the shared shell.

UI evidence

Android emulator. The Capture field itself looks as before: a box showing its value.

Typing in the docked box Capture form with Android's text box docked at the bottom, holding the text typed, which the continent field shows too
Rotated with the box open The same box in landscape, its text kept

Related issue

Part of #1902.

Summary by CodeRabbit

  • New Features
    • On Android, Capture form fields open the system text box, with typed values reflected in the form. Done, Back, or tapping outside closes the text box.
    • Text copied in RustGIS is now available on the Android clipboard for use in other apps.
  • Documentation
    • Updated the field-work guide with details on Android text entry, keyboard behavior, and clipboard access.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a platform text-entry interface for the Capture form, connects it to Android’s native text editor, and forwards copied text to Android’s clipboard. The browser continues to use egui input, and the Capture form retains its in-app editor when no system text-entry service is available.

Changes: Android text entry and clipboard

Layer / File(s) Summary
Text-entry contract and event queue
crates/engine/src/platform.rs, crates/ui-egui/src/lib.rs, apps/rustgis-web/src/web.rs
The platform adds text-entry types, event parsing, and optional platform methods. RustGisApp adds a queue for typed events, and the browser sets the text-entry service to None.
Android text editor and event bridge
apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java, apps/rustgis-mobile/src/phone.rs, apps/rustgis-mobile/src/shell.rs, apps/rustgis-mobile/src/android.rs, apps/rustgis-mobile/README.md
The Android activity opens native text-entry dialogs and emits text and closure events. The mobile shell connects the service and forwards events. The README describes the Android and desktop typing behavior.
Capture form integration
crates/ui-touch/src/lib.rs
The Capture form opens system text fields when available and applies matching typed events while the original layer and field remain available. Otherwise, it retains the in-app editor.
Android clipboard forwarding
apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java, apps/rustgis-mobile/src/phone.rs, apps/rustgis-mobile/src/shell.rs, apps/rustgis-mobile/src/android.rs, docs/user-guide/field-work.md
The mobile shell forwards copied text to the phone clipboard and reports failures. The Android activity writes to the clipboard, and the user guide describes the behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CaptureForm
  participant MobileShell
  participant Phone
  participant MainActivity
  CaptureForm->>MobileShell: request text entry
  MobileShell->>Phone: enter_text
  Phone->>MainActivity: enterText
  MainActivity->>MobileShell: text or text-closed event
  MobileShell->>CaptureForm: queue typed event
Loading

Possibly related issues

  • opengeos/RustGIS#1902 — The tracking issue covers the Android mobile field app and soft-keyboard work that this change extends with native Android text entry.

Possibly related PRs

  • opengeos/RustGIS#1954 — Adds the touch interface whose Capture form this change updates.
  • opengeos/RustGIS#1941 — Adds the platform trait and event-line parsing that this change extends with text-entry events.
  • opengeos/RustGIS#2072 — Adds the shared mobile shell and iOS platform implementation that use the platform defaults extended here.

Suggested reviewers: giswqs

Merge Risk: Minimal · up to 946df

This change lets Android's native keyboard features reach Capture text and number fields, and it forwards copied text to Android's clipboard. Desktop, browser, CLI and Python behavior is unchanged. No concrete merge-blocking problem was found. The author did not test on a real phone or on iOS.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(mobile): type into Android's own text field from the Capture form" names the main change: Capture text and number fields open Android's native text box via the new Platform text-entry …
Description check Passed The description follows the template's Summary, Testing, UI evidence, and Related issue sections. Summary explains the problem, the approach, and the surfaces affected. Testing lists the unit test, pa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(mobile): type into Android's own text field from the Capture form" names the main change: Capture text and number fields open Android's native text box via the new Platform text-entry path. It is specific, short, and matches the changeset and objectives.

Full details: Description check

Explanation

The description follows the template's Summary, Testing, UI evidence, and Related issue sections. Summary explains the problem, the approach, and the surfaces affected. Testing lists the unit test, parser tests, build, CI, and emulator checks, plus what was not run. UI evidence includes before/after-style screenshots for the Android emulator and states the Capture field appearance. Related issue links Part of #1902. The template's 'No visible UI change' line was correctly replaced because the PR changes visible UI. Minor gap: the UI evidence section gives after-only images, which fits brand-new UI behaviour, but no before images are shown for the existing Capture field, which the template asks for when existing UI changes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps a field with care,
Android’s text box wakes up there.
New words hop back, one by one,
Done closes the box when typing’s done.
Copied text goes to the clipboard too,
Then off the rabbit bounds, pleased and new.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 49916f25-dc5f-4a96-b703-4aa9ea556a75
Commits

Reviewing files that changed from the base of the PR and between cf1a744 and 946df8c.

Files selected for processing: 10

  • apps/rustgis-mobile/README.md
  • apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java
  • apps/rustgis-mobile/src/android.rs
  • apps/rustgis-mobile/src/phone.rs
  • apps/rustgis-mobile/src/shell.rs
  • apps/rustgis-web/src/web.rs
  • crates/engine/src/platform.rs
  • crates/ui-egui/src/lib.rs
  • crates/ui-touch/src/lib.rs
  • docs/user-guide/field-work.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

Comment thread apps/rustgis-mobile/src/phone.rs Outdated
env.call_method(activity, jni_str!("copyText"), jni_sig!((text: JString) -> void), &[JValue::Object(&text)])?.v()
});
if let Err(e) = asked {
log::warn!("{e}");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A refused JNI call here is only logged. The user asked for a copy, and it never reached Android's clipboard, yet no notice is shown. The doc comment above says "a refusal is logged: the window's own clipboard still has it", but the rule for this repo is that a lost or failed operation is said through Session::notify (log::warn! alone doesn't count). copyText already reports its own refusals as copy-failed, so the Rust side's JNI errors (for example new_string failing on a very large copy, or the VM being unavailable) are the gap.

Suggested direction: have Phone::copy_text return Result<(), String>, have shell::Phone::copy_text return it too, and on Err call self.app.session.notify(..., true) in shell.rs (or reuse Event::CopyFailed) so the user sees one notice for the failed copy. Add a test that a failing copy yields a notice.

Category: agents-md

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a0b9736: copy_text returns the JNI error on every layer, and the shell says it with the same notice as a copy Android refused (copy_failed). Test: a_copy_that_cannot_reach_the_clipboard_is_said.

entry.show();
} catch (RuntimeException e) {
entry = null;
add("text-closed\t" + id + "\t" + oneField(e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edge case: if the exception's message is an empty string (not null), oneField("") gives text-closed\t<id>\t. On the Rust side Event::parse only accepts text-closed with a reason whose concat() is non-empty, so this line falls through to the "something RustGIS doesn't know" failure. The result is a misleading notice that quotes the line, and entering stays set on the Rust side (the field keeps its open outline) because the Closed never arrives.

A small fix is to treat an empty message like a missing one:

Suggested change
add("text-closed\t" + id + "\t" + oneField(e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage()));
String why = e.getMessage();
add("text-closed\t" + id + "\t" + oneField(why == null || why.isEmpty() ? e.getClass().getSimpleName() : why));

Confidence is low: this needs a throwable with an empty message from EditText/Dialog, which is rare.

Category: bug

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a0b9736 as suggested: an empty message names the exception class.

Comment thread apps/rustgis-web/src/web.rs Outdated
@@ -1289,6 +1289,8 @@ fn services(inbox: Inbox, font_inbox: Inbox, notes: Notes, ctx: egui::Context, e
take_photo: None,
// A text field's Paste: the page reads the clipboard (Firefox and Safari show a Paste

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new enter_text: None line landed between the Paste comment and read_clipboard, so the two-line comment about Paste now sits above enter_text and no longer describes the field it documents. Moving the new comment and field above the Paste comment keeps each comment with its field:

Suggested change
// A text field's Paste: the page reads the clipboard (Firefox and Safari show a Paste
// The browser gives egui's own fields their typing: no text field of its own is needed.
enter_text: None,
// A text field's Paste: the page reads the clipboard (Firefox and Safari show a Paste
// button to confirm, Chrome asks once); only over HTTPS, where the browser offers it.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved in a0b9736.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Reviewed the 10-file diff against pr-context/AGENTS.md. Prior review threads: none, so no earlier concerns were left alone. I could not compile or run the code here (no shell), so the Rust and Java findings are from reading the code. The PR's own test runs and the emulator checks it lists are not reproduced here.

Bugs

  • Empty exception message leaves a field stuck open (MainActivity.java:480). An empty getMessage() produces text-closed\t<id>\t, which Event::parse rejects, so the user sees a notice quoting the raw line and the Rust side keeps entering set. Confidence: low (about 30%), since it needs an exception with an empty message.

Security

  • None found. Typed text is only ever matched against Rust-generated ids and stored as form values.

Performance

  • None found. Only the latest text is buffered between frames, and each keystroke costs one O(n) escape pass over the field.

Quality

  • Misplaced comment in web.rs (apps/rustgis-web/src/web.rs:1290). The new enter_text: None line sits between the Paste comment and read_clipboard, which detaches that comment from its field. Confidence: high. A suggestion block is attached.

AGENTS.md

  • Clipboard JNI failure is only logged (apps/rustgis-mobile/src/phone.rs:102). Phone::copy_text logs a JNI error with log::warn! and returns nothing, so a copy that never reaches Android's clipboard gives the user no notice. This breaks the "Never silent" rule, which says eprintln!/log alone doesn't count. Confidence: high (about 85%). The Java-side refusal is reported as copy-failed, so only the Rust-side path is missing.
  • Low confidence, not posted: the Java literal "this device has no clipboard service" is user-visible English that never goes through tl!. The existing failed events in this file use the same pattern, so I'd treat it as pre-existing style rather than a blocker.

Twins checked

  • enter_text is None in the browser (web.rs) and defaults to None for the desktop Services, which is built only in web.rs and via Default elsewhere. Desktop and browser fields keep egui's own typing.
  • iOS keeps the trait defaults (enters_text false, copy_text no-op), as the PR says.
  • The Event match in shell.rs covers the two new variants. No other exhaustive matches on Event were found.
  • The new Event arms sit alongside the existing failed and text-closed parsing, and both malformed-line cases are tested in platform.rs.
  • Desktop and browser paths: the new Services field and RustGisApp::typed are gated only by the phone's enters_text(), so no wasm32 branch needed a twin.
  • Not applicable: the layer-add, project-open and overlay-tool families are not touched by this change.

Change size

Compared: the whole PR against main (merge base 54d7854 to PR head 77510a9).

Measure Value
Files changed 10 (0 added, 10 modified, 0 removed, 0 renamed)
Size before 948.4 KB
Size after 981.5 KB
Total size change +33.1 KB
File Before After Change
crates/ui-touch/src/lib.rs 133.5 KB 145.3 KB +11.8 KB
apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java 47.4 KB 58.1 KB +10.7 KB
crates/engine/src/platform.rs 17.1 KB 22.8 KB +5.7 KB
apps/rustgis-mobile/src/shell.rs 48.1 KB 49.9 KB +1.8 KB
apps/rustgis-mobile/src/phone.rs 7.5 KB 8.8 KB +1.3 KB
apps/rustgis-mobile/README.md 31.9 KB 32.6 KB +707 B
crates/ui-egui/src/lib.rs 560.4 KB 561.0 KB +606 B
docs/user-guide/field-work.md 21.0 KB 21.4 KB +355 B
apps/rustgis-web/src/web.rs 78.3 KB 78.4 KB +121 B
apps/rustgis-mobile/src/android.rs 3.0 KB 3.1 KB +99 B

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3001/
Web app https://preview.rustgis.app/pr-3001/app/
Commit 946df8c

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no confirmed bugs, security issues, or AGENTS.md breaks in this PR. I posted no inline comments because nothing I found met the bar for one. The two earlier review concerns about the Android clipboard and the empty-message edge case are already fixed in a0b9736 (checked in shell.rs copy_out/copy_failed and MainActivity.java:481).

Bugs: none found.

  • Checked the asked counter in MainActivity.java: enterText and copyText increment it, and the dismiss listener and answered() decrement it on every path, including the failure path.
  • Checked the escape round trip: Java typed() and Rust unescape agree on \\, \t, \n, \r, and the malformed-line tests cover the edge cases.
  • Checked the Capture text flow in ui-touch: ids are per opening, and stale closes and other fields' answers are ignored.

Security: none confirmed.

  • Low confidence: a malformed text line falls through to Event::Failed, which quotes the whole line in a notice. Java always writes well-formed lines, and Capture only uses plain and number today. This would matter once the secret kind is wired up, so the failure path should not quote the line for a secret field.

Performance:

  • Low confidence: Phone::copy_text builds a full JVM string from the copied text before Android can refuse it. A size check before the JNI call would avoid a second full copy of a very large copy.

Quality (for the release quality pass):

  • Earlier thread on apps/rustgis-web/src/web.rs (the enter_text: None line sits between the Paste comment and its field): still open and still present. I left it alone because it was already raised.
  • crates/engine/src/platform.rs: the new module-doc line is much longer than its neighbours, so the paragraph reflows unevenly.
  • apps/rustgis-mobile/src/shell.rs: the default copy_text could take _text rather than let _ = text;.

AGENTS.md: none found. Checked: no new command, so command-surface.txt and the cancellation lists don't apply; no new asset; no unwrap/expect in non-test code; desktop and browser behaviour is unchanged.

Twins and surfaces checked:

  • Every Services literal: web.rs sets enter_text: None, and the others use ..Default::default().
  • Exhaustive matches on Event: only shell.rs. ios.rs and phone.rs only produce events.
  • JNI signatures in phone.rs match the Java methods enterText and copyText.
  • Engine and ui-touch changes are platform-neutral, so the wasm build is unaffected.

Earlier concerns: three threads on the PR. Two are fixed in the head and one is a quality point still open. I did not repost any of them.

Change size

Compared with main (merge base 54d7854 to PR head a0b9736), the whole PR.

Measure Value
Files changed 10 (added 0, modified 10, removed 0, renamed 0)
Size before 948.4 KB
Size after 982.9 KB
Total size change +34.5 KB
Path Before After Change
crates/ui-touch/src/lib.rs 133.6 KB 145.3 KB +11.8 KB
apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java 47.4 KB 58.2 KB +10.8 KB
crates/engine/src/platform.rs 17.1 KB 22.8 KB +5.7 KB
apps/rustgis-mobile/src/shell.rs 48.1 KB 51.2 KB +3.1 KB
apps/rustgis-mobile/src/phone.rs 7.5 KB 8.8 KB +1.3 KB
apps/rustgis-mobile/README.md 31.9 KB 32.6 KB +0.7 KB
crates/ui-egui/src/lib.rs 560.4 KB 561.0 KB +0.6 KB
docs/user-guide/field-work.md 21.0 KB 21.4 KB +0.3 KB
apps/rustgis-web/src/web.rs 78.3 KB 78.4 KB +121 B
apps/rustgis-mobile/src/android.rs 3.0 KB 3.1 KB +120 B

A NativeActivity hands its window's touches and keys to Rust, so egui's
fields on Android get no paste, suggestions, glide typing or dictation.
The Platform trait gains enter_text (a default that does nothing, so the
desktop, the browser and iOS are unchanged): Android opens an EditText in
a window of its own, docked above the soft keyboard, and sends its text
back as an event on each change and again when it closes. The Capture
form draws its text and number fields as boxes that open it.

Text copied in RustGIS also goes on Android's clipboard.
… an empty error still closes the text box

Review of opengeos#3001: a refused JNI call for a copy was only logged; it now gives
the same notice as a copy Android refused. An exception with an empty message
named no reason, so the text box's close was never read.
@Mavrick-F
Mavrick-F force-pushed the feat/android-text-entry branch from a0b9736 to 946df8c Compare November 26, 2026 14:40
try {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
if (clipboard == null) {
add("copy-failed\tthis device has no clipboard service");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This English text reaches the user through copy_failed in a notice, and Java can't use tl!, so it stays English in every language. Existing Java messages (such as "This device has no file picker") already do this, so the PR follows a precedent rather than adding a new gap. A cleaner fix is to send a short code such as no-clipboard and map it to a translated string on the Rust side in shell.rs.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left for the release quality pass.

// The Capture form takes it (`rustgis_ui_touch`).
Event::Typed(typed) => {
if let rustgis_engine::platform::Typed::Closed { failed: Some(error), .. } = &typed {
self.app.session.notify(i18n::fmt("The text box couldn't be opened: {error}", &[("error", error)]), true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notice for a text box that couldn't be opened has no test. The PR tests the take_typed notice and the copy_out notice, but not Event::Typed with failed: Some(..), nor the Err branch of Services::enter_text in capture_fields. AGENTS asks that each lossy path have a test that gives the notice. A test in this file's tests module that feeds Typed::Closed { failed: Some(..) } through the event loop and checks for exactly one notice would cover it.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left for the release quality pass.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no confirmed bugs, security issues or performance problems. I raised two quality points inline. I did not build or run anything: this environment has no shell, and the PR says the emulator run is still pending.

Bugs: None confirmed. I traced these paths and found them consistent:

  • asked is balanced on every path in enterText, copyText and the dismiss listener, including the catch branch when show() throws.
  • Dismiss ordering is safe. Text changes during dismissal are flushed by the listener before text-closed.
  • Form::for_layer keeps entering, but take_typed filters by instance and shown, so text can't land in the wrong layer.
  • Ids come from Form::entries, which only resets when set_form is called with a fresh Form, and production code doesn't do that. A late close from an earlier opening can't end a later one.
  • minSdk is 26, so the autofill APIs are safe.
  • The Event match in shell.rs is the only exhaustive one, and it covers the new variants.

Confidence: medium-high.

Security: None. The secret kind has no caller in this PR, and nothing logs field values. Confidence: high.

Performance: None material. Each keystroke sends the full text over JNI, which is fine for form fields. Confidence: high.

Quality:

  • The English copy-failed reason reaches the user untranslated. This is the same pattern as existing Java messages. Inline on MainActivity.java. Confidence: high.
  • No test covers the notice for a failed text-box open, or the Err branch of Services::enter_text. Inline on shell.rs. Confidence: high.
  • docs/user-guide/field-work.md says "text or number field", but date and date-time fields also get the native box. Confidence: high.
  • TextKind::Lines and TextKind::Secret, and their Java branches, have no caller in this PR and no device run. Confidence: high.
  • copy_out gives one notice per refused copy, not one notice with a count. It only matters if several refuse in one frame. Confidence: low.

AGENTS.md:

  • The PR body says screenshots are pending. AGENTS asks for screenshots of any visible change, so this must be done before merge. Confidence: high.
  • The PR says it stays a draft until the emulator run, and the Android typing, paste, Done/Back and rotation paths are unverified. Confidence: high.

Prior reviews: Three threads exist, all outdated and answered as fixed. I confirmed each fix in the diff: copy_text returns Result and is notified, the empty exception message is handled, and the web.rs comment is moved. I re-raised none of them. I left three earlier concerns alone because they were already answered.

Twins checked:

  • Services construction: desktop, embed, tests and examples all use ..Default, and only web.rs sets enter_text: None.
  • Event matches: only shell.rs is exhaustive.
  • Layer add routes, overlay tools and the commands that add data: not touched by this diff.

Change size

Compared with the base branch (merge base e48daeb to PR head 946df8c), not the latest push.

Measure Value
Files changed 10 (0 added, 10 modified, 0 removed, 0 renamed)
Size before 961.3 KB
Size after 995.8 KB
Total size change +34.5 KB
Path Before After Change
crates/ui-touch/src/lib.rs 133.6 KB 145.3 KB +11.8 KB
apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java 50.3 KB 61.1 KB +10.8 KB
crates/engine/src/platform.rs 17.3 KB 23.0 KB +5.7 KB
apps/rustgis-mobile/src/shell.rs 51.1 KB 54.2 KB +3.1 KB
apps/rustgis-mobile/src/phone.rs 8.9 KB 10.3 KB +1.3 KB
apps/rustgis-mobile/README.md 33.0 KB 33.7 KB +0.7 KB
crates/ui-egui/src/lib.rs 563.4 KB 563.9 KB +0.6 KB
docs/user-guide/field-work.md 21.8 KB 22.1 KB +0.3 KB
apps/rustgis-web/src/web.rs 78.3 KB 78.4 KB +121 B
apps/rustgis-mobile/src/android.rs 3.7 KB 3.8 KB +120 B

@Mavrick-F
Mavrick-F marked this pull request as ready for review November 26, 2026 17:36
@Mavrick-F

Copy link
Copy Markdown
Member Author

@coderabbitai review

}
} catch (RuntimeException e) {
// Too large for Android to pass on, say: the Rust side's own clipboard still has it.
add("copy-failed\t" + oneField(e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twin of the empty-message case fixed in enterText (a0b9736): here an exception whose message is "" (not null) passes through as an empty reason, so copy-failed\t reaches Rust. Event::parse accepts it, and the user gets the notice "...system's clipboard...: " with a blank reason. The notice still fires, so nothing is lost; this is the wording of the reason only. Treating an empty message like a missing one matches the enterText fix:

Suggested change
add("copy-failed\t" + oneField(e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage()));
add("copy-failed\t" + oneField(e.getMessage() == null || e.getMessage().isEmpty() ? e.getClass().getSimpleName() : e.getMessage()));

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left for the release quality pass.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff against pr-context/AGENTS.md and the prior threads, and checked the surrounding code: the Capture form state in ui-touch, the Java helpers and imports, the Event parse path, and the Services literals across the workspace. I could not build or run tests in this environment, so every finding below comes from reading the code.

Bugs

None found. I checked the Java/Rust hand-off for ordering (takeEvents flushes the pending typed before the queue is taken), escaping round-trips (\\, \t, \n, \r), the replace-on-open path (asked counts balance), the close-after-reopen id scheme (entries is only incremented, never reset, so ids don't repeat), and the sheet-switch path (the form lives in egui temp data, so a close isn't lost). A stray text event after a replaced field is dropped silently, but I could not find a reachable path where it happens, so I'm not raising it.

Security

None found. Copy from egui password fields is suppressed by egui, so sending copies to the Android clipboard doesn't expose masked values.

Performance

None found.

Quality

  • MainActivity.java:650 (copyText), confidence high. Same empty-message edge case as the enterText fix in a0b9736, but not applied here. An empty getMessage() gives copy-failed\t, and the user sees the notice with a blank reason. The notice still fires, so this is wording only. Inline comment with a suggestion is posted.

AGENTS.md

No new violations. Twins checked:

  • web.rs wasm branch: enter_text: None added; desktop apps/rustgis/src/main.rs builds Services with ..Services::default(), so it needs no change.
  • iOS: keeps the trait defaults (enters_text false, copy_text Ok), so it is unaffected.
  • Read routes, overlay tools, layer.add* / project.open*: not touched by this diff.

Already raised, left alone (5 threads):

  • Two open threads are answered by the author as deferred to the release quality pass: the English copy-failed text (MainActivity.java:644) and the missing test for the failed-open notice (shell.rs:267). Not re-raised. The second one is arguably an AGENTS "test both ways" gap, so it may deserve a look at the next push.
  • Three threads are fixed in a0b9736 and verified in the code: phone.rs:102 (copy error now reaches the user), MainActivity.java:480 (empty message), and web.rs:1290 (comment placement).

Change size

Compared: the whole PR against main (merge base e48daeb to PR head 946df8c).

Measure Value
Files changed 10 (added 0, modified 10, removed 0, renamed 0)
Size before 961.3 KB
Size after 995.8 KB
Total size change +34.5 KB
Path Before After Change
crates/ui-touch/src/lib.rs 133.6 KB 145.3 KB +11.8 KB
apps/rustgis-mobile/java/org/rustgis/mobile/MainActivity.java 50.3 KB 61.1 KB +10.8 KB
crates/engine/src/platform.rs 17.3 KB 23.0 KB +5.7 KB
apps/rustgis-mobile/src/shell.rs 51.1 KB 54.2 KB +3.1 KB
apps/rustgis-mobile/src/phone.rs 8.9 KB 10.3 KB +1.3 KB
apps/rustgis-mobile/README.md 33.0 KB 33.7 KB +0.7 KB
crates/ui-egui/src/lib.rs 563.4 KB 563.9 KB +0.6 KB
docs/user-guide/field-work.md 21.8 KB 22.1 KB +0.3 KB
apps/rustgis-web/src/web.rs 78.3 KB 78.4 KB +0.1 KB
apps/rustgis-mobile/src/android.rs 3.7 KB 3.8 KB +0.1 KB

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Mavrick-F
Mavrick-F added this pull request to the merge queue Nov 26, 2026
Merged via the queue into opengeos:main with commit e496248 Nov 26, 2026
43 checks passed
@Mavrick-F
Mavrick-F deleted the feat/android-text-entry branch November 26, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant