Skip to content

Commit 6846346

Browse files
committed
Get the Masonry demo working with the soft keyboard, using the fallback approach, not a proper InputConnection yet
1 parent 2d1a6d3 commit 6846346

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

masonry/src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ fn scale_factor<'local>(env: &mut JNIEnv<'local>, android_ctx: &Context<'local>)
6969
metrics.density(env) as f64
7070
}
7171

72+
fn show_soft_input<'local>(env: &mut JNIEnv<'local>, view: &View<'local>) {
73+
let imm = view.input_method_manager(env);
74+
imm.show_soft_input(env, view, 0);
75+
}
76+
77+
fn hide_soft_input<'local>(env: &mut JNIEnv<'local>, view: &View<'local>) {
78+
let imm = view.input_method_manager(env);
79+
let window_token = view.window_token(env);
80+
imm.hide_soft_input_from_window(env, &window_token, 0);
81+
}
82+
7283
pub struct MasonryState {
7384
render_cx: RenderContext,
7485
render_root: RenderRoot,
@@ -144,10 +155,10 @@ impl<Driver: AppDriver> MasonryViewPeer<Driver> {
144155
.on_action(&mut driver_ctx, widget_id, action);
145156
}
146157
RenderRootSignal::StartIme => {
147-
// TODO
158+
ctx.push_static_deferred_callback(show_soft_input);
148159
}
149160
RenderRootSignal::EndIme => {
150-
// TODO
161+
ctx.push_static_deferred_callback(hide_soft_input);
151162
}
152163
RenderRootSignal::ImeMoved(_position, _size) => {
153164
// TODO

0 commit comments

Comments
 (0)