-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sugest to reuse architecture direct golang instead of add java code ... #2
sugest to reuse architecture direct golang instead of add java code ... #2
Conversation
func (d *mobileDriver) Quit() { | ||
app.Finish() | ||
// Android and iOS guidelines say this should not be allowed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is quit instead back (call back) ...
keyCode := C.AKeyEvent_getKeyCode(e) | ||
if (keyCode == C.AKEYCODE_BACK) { | ||
println("back ok") | ||
return 1 // Handle back button press and return handle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well here you can put send event to your architekture ...
if int(C.is_null(currentCtx)) == 1 { | ||
RunOnJVM(func(vm, jniEnv, ctx uintptr) error { | ||
env := (*C.JNIEnv)(unsafe.Pointer(jniEnv)) // not a Go heap pointer | ||
C.deletePrevCtx(env, C.jobject(ctx)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for avoid memory leaks
} | ||
static int is_null(jobject ctx){ | ||
if (ctx == NULL) return 1; | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 small helper functions, if you have better replace its ...
@@ -133,10 +122,12 @@ func callMain(mainPC uintptr) { | |||
|
|||
//export onStart | |||
func onStart(activity *C.ANativeActivity) { | |||
C.set_global(activity) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set current referencies on start and resume ...
show_file_save_method = find_static_method(env, current_class, "showFileSave", "(Ljava/lang/String;Ljava/lang/String;)V"); | ||
finish_method = find_method(env, current_class, "finish", "()V"); | ||
setCurrentContext(activity->vm, (*env)->NewGlobalRef(env, activity->clazz)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-set env at call function ...
well i know that i m litle bit enoying but i think the golang allow catch backbutton and it is not need change java