JFLib

plat/android_ime.rs#

Source: lib/plat/android_ime.rs

Android editor snapshots and edits. UTF-8 byte offsets cross JNI; Java owns UTF-16.
This adapter shares the host's single UI thread and never invokes Android under a lock.
  • fn android_ime_publish(id: u32, text: &[u8], anchor: usize, caret: usize, flags: u32) Publish the focused editor's actual text, flags and UTF-8 selection to Android's IME.

  • fn android_ime_clear() Close the Android input session when library focus leaves an editor.

  • fn android_ime_take(id: u32) -> Option<(Vec<u8>, usize, usize)> Consume one host edit for the focused widget, including the requested UTF-8 selection.

  • extern "C" fn jfgui_editor_snapshot() -> u32 Build a JNI snapshot: id, flags, anchor, caret (little-endian u32), then UTF-8 text.

  • extern "C" fn jfgui_editor_data() -> usize Snapshot address, valid until the next snapshot call on this same host thread.

  • extern "C" fn jfgui_editor_replace(id: u32, len: u32, anchor: u32, caret: u32) -> u32 Queue a bounded, valid editor replacement from the shared JNI input buffer.

Source: docs/API.md in the JFLib repository.