mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +00:00
app: add RegisterFragment method on *Window for Android
RegisterFragment creates an instance of a Java class and registers it as a Fragment in the window's Context. Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
This commit is contained in:
committed by
Elias Naur
parent
ce76c2e996
commit
2ca2e5462f
@@ -54,6 +54,7 @@ type window struct {
|
||||
mhideTextInput C.jmethodID
|
||||
mpostFrameCallback C.jmethodID
|
||||
mpostFrameCallbackOnMainThread C.jmethodID
|
||||
mRegisterFragment C.jmethodID
|
||||
}
|
||||
|
||||
var dataDirChan = make(chan string, 1)
|
||||
@@ -119,6 +120,7 @@ func onCreateView(env *C.JNIEnv, class C.jclass, view C.jobject) C.jlong {
|
||||
mhideTextInput: jniGetMethodID(env, class, "hideTextInput", "()V"),
|
||||
mpostFrameCallback: jniGetMethodID(env, class, "postFrameCallback", "()V"),
|
||||
mpostFrameCallbackOnMainThread: jniGetMethodID(env, class, "postFrameCallbackOnMainThread", "()V"),
|
||||
mRegisterFragment: jniGetMethodID(env, class, "registerFragment", "(Ljava/lang/String;)V"),
|
||||
}
|
||||
wopts := <-mainWindow.out
|
||||
w.callbacks = wopts.window
|
||||
@@ -443,6 +445,14 @@ func (w *window) ShowTextInput(show bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func (w *window) RegisterFragment(del string) {
|
||||
runInJVM(func(env *C.JNIEnv) {
|
||||
cdel := C.CString(del)
|
||||
defer C.free(unsafe.Pointer(cdel))
|
||||
C.gio_jni_RegisterFragment(env, w.view, w.mRegisterFragment, cdel)
|
||||
})
|
||||
}
|
||||
|
||||
func Main() {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user