mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
app/internal/window: [android] move switching to main thread to Go
There's runOnMain alread; use that for show|hideTextInput instead of an ad-hoc switch. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -174,20 +174,12 @@ public final class GioView extends SurfaceView implements Choreographer.FrameCal
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showTextInput() {
|
void showTextInput() {
|
||||||
post(new Runnable() {
|
GioView.this.requestFocus();
|
||||||
@Override public void run() {
|
imm.showSoftInput(GioView.this, 0);
|
||||||
GioView.this.requestFocus();
|
|
||||||
imm.showSoftInput(GioView.this, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideTextInput() {
|
void hideTextInput() {
|
||||||
post(new Runnable() {
|
imm.hideSoftInputFromWindow(getWindowToken(), 0);
|
||||||
@Override public void run() {
|
|
||||||
imm.hideSoftInputFromWindow(getWindowToken(), 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected boolean fitSystemWindows(Rect insets) {
|
@Override protected boolean fitSystemWindows(Rect insets) {
|
||||||
|
|||||||
@@ -537,10 +537,10 @@ func Java_org_gioui_GioView_onTouchEvent(env *C.JNIEnv, class C.jclass, handle C
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) ShowTextInput(show bool) {
|
func (w *window) ShowTextInput(show bool) {
|
||||||
if w.view == 0 {
|
runOnMain(func(env *C.JNIEnv) {
|
||||||
return
|
if w.view == 0 {
|
||||||
}
|
return
|
||||||
runInJVM(javaVM(), func(env *C.JNIEnv) {
|
}
|
||||||
if show {
|
if show {
|
||||||
callVoidMethod(env, w.view, gioView.showTextInput)
|
callVoidMethod(env, w.view, gioView.showTextInput)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user