feat(android): Java activity for keyboard text and the system file dialog (Issue #42)

InkActivity extends NativeActivity:
- An invisible view with its own input connection receives the soft
  keyboard's text (commitText, deleteSurroundingText), so characters
  without a key event (umlauts by long press, ...) arrive as well. The
  field is a visible-password field, so keyboards commit each character
  instead of composing words.
- Import and "insert image" open the system file dialog
  (ACTION_OPEN_DOCUMENT); the chosen file is copied to the cache folder
  and handed to Rust by path.

src/android_bridge.rs calls the activity through JNI and receives its
native calls; package-android.sh compiles the class with javac and d8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haraldandClaude Opus 5.5 committed 2026-10-27 21:23:52 +01:00
1 parent a8aef30db7
commit 0be321837c
10 files changed
+472 -20

No files matched your search

+11
View File
@@ -1664,6 +1664,10 @@ pub fn run_with(
window.request_redraw();
}
Event::AboutToWait => {
#[cfg(target_os = "android")]
if crate::android_bridge::has_messages() {
window.request_redraw();
}
let prev_status = autosave.status();
let new_status = autosave.update();
if new_status != prev_status {
@@ -4037,6 +4041,13 @@ pub fn run_with(
if let Some(requester) = keyboard_requester.as_mut() {
raw_input.events.extend(requester.take_deletions());
}
// Android: text from the keyboard and files from the system dialog
#[cfg(target_os = "android")]
{
let (events, actions) = crate::android_bridge::take_messages();
raw_input.events.extend(events);
ui_state.queued_actions.extend(actions);
}
egui_ctx.begin_frame(raw_input);
// 2. Auswahl-Overlay rendern (Bounding Box, Griffe, Lasso)