You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement some APIs needed for OctoDroid
This commit is contained in:
@@ -113,6 +113,8 @@ void activity_close_all(void)
|
||||
g_list_free(activities);
|
||||
}
|
||||
|
||||
static jobject activity_not_created = NULL;
|
||||
|
||||
void _activity_start(JNIEnv *env, jobject activity_object, bool recreate)
|
||||
{
|
||||
/* -- run the activity's onCreate -- */
|
||||
@@ -120,6 +122,12 @@ void _activity_start(JNIEnv *env, jobject activity_object, bool recreate)
|
||||
if((*env)->ExceptionCheck(env))
|
||||
(*env)->ExceptionDescribe(env);
|
||||
|
||||
if ((*env)->IsSameObject(env, activity_object, activity_not_created)) { // finish() was called before the activity was created
|
||||
_UNREF(activity_not_created);
|
||||
activity_not_created = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if(recreate) // only allowed for toplevel, so we know for sure where in the stack it belongs
|
||||
activity_backlog = g_list_append(activity_backlog, _REF(activity_object));
|
||||
else
|
||||
@@ -146,9 +154,12 @@ JNIEXPORT void JNICALL Java_android_app_Activity_nativeFinish(JNIEnv *env, jobje
|
||||
}
|
||||
}
|
||||
activity_update_current(env);
|
||||
activity_close(env, this);
|
||||
if (removed_activity)
|
||||
if (removed_activity) {
|
||||
activity_close(env, removed_activity);
|
||||
_UNREF(removed_activity);
|
||||
} else {
|
||||
activity_not_created = _REF(this);
|
||||
}
|
||||
if (activity_backlog == NULL && window)
|
||||
gtk_window_close(GTK_WINDOW(_PTR(window)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user