Skip to content
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

Closed
wants to merge 23 commits into from
Closed

Conversation

MatejMagat305
Copy link

well i know that i m litle bit enoying but i think the golang allow catch backbutton and it is not need change java

func (d *mobileDriver) Quit() {
app.Finish()
// Android and iOS guidelines say this should not be allowed!
Copy link
Author

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
Copy link
Author

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))
Copy link
Author

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;
Copy link
Author

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)
}
Copy link
Author

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));
}
Copy link
Author

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 ...

@andydotxyz andydotxyz closed this Aug 1, 2023
@MatejMagat305 MatejMagat305 deleted the feature/backbutton branch August 1, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants