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)));
|
||||
}
|
||||
|
||||
@@ -190,6 +190,8 @@ JNIEXPORT void JNICALL Java_android_graphics_Matrix_native_1mapPoints(JNIEnv *en
|
||||
dst[dst_idx + i * 2] = res.x;
|
||||
dst[dst_idx + i * 2 + 1] = res.y;
|
||||
}
|
||||
(*env)->ReleaseFloatArrayElements(env, src_ref, src, 0);
|
||||
(*env)->ReleaseFloatArrayElements(env, dst_ref, dst, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Matrix_native_1setTranslate(JNIEnv *env, jclass class, jlong matrix_ptr, jfloat x, jfloat y)
|
||||
@@ -213,3 +215,12 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1invert(JNIEnv *e
|
||||
{
|
||||
return graphene_matrix_inverse((graphene_matrix_t *)_PTR(matrix_ptr), (graphene_matrix_t *)_PTR(inverse_ptr));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1preScale__JFF(JNIEnv *env, jclass class, jlong matrix_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
graphene_matrix_t *matrix = (graphene_matrix_t *)_PTR(matrix_ptr);
|
||||
graphene_matrix_t scale;
|
||||
graphene_matrix_init_scale(&scale, x, y, 1);
|
||||
graphene_matrix_multiply(&scale, matrix, matrix);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user