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 Activity.onPostCreate() and onPostResume()
These are used by androidx to handle the Fragment lifecycle
This commit is contained in:
@@ -54,6 +54,10 @@ static void activity_focus(JNIEnv *env, jobject activity)
|
|||||||
if((*env)->ExceptionCheck(env))
|
if((*env)->ExceptionCheck(env))
|
||||||
(*env)->ExceptionDescribe(env);
|
(*env)->ExceptionDescribe(env);
|
||||||
|
|
||||||
|
(*env)->CallVoidMethod(env, activity, handle_cache.activity.onPostResume);
|
||||||
|
if((*env)->ExceptionCheck(env))
|
||||||
|
(*env)->ExceptionDescribe(env);
|
||||||
|
|
||||||
(*env)->CallVoidMethod(env, activity, handle_cache.activity.onWindowFocusChanged, true);
|
(*env)->CallVoidMethod(env, activity, handle_cache.activity.onWindowFocusChanged, true);
|
||||||
if((*env)->ExceptionCheck(env))
|
if((*env)->ExceptionCheck(env))
|
||||||
(*env)->ExceptionDescribe(env);
|
(*env)->ExceptionDescribe(env);
|
||||||
@@ -129,6 +133,10 @@ void _activity_start(JNIEnv *env, jobject activity_object, bool recreate)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*env)->CallVoidMethod(env, activity_object, handle_cache.activity.onPostCreate, NULL);
|
||||||
|
if((*env)->ExceptionCheck(env))
|
||||||
|
(*env)->ExceptionDescribe(env);
|
||||||
|
|
||||||
if(recreate) // only allowed for toplevel, so we know for sure where in the stack it belongs
|
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));
|
activity_backlog = g_list_append(activity_backlog, _REF(activity_object));
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -67,9 +67,11 @@ void set_up_handle_cache(JNIEnv *env)
|
|||||||
if((*env)->ExceptionCheck(env))
|
if((*env)->ExceptionCheck(env))
|
||||||
(*env)->ExceptionDescribe(env);
|
(*env)->ExceptionDescribe(env);
|
||||||
handle_cache.activity.onCreate = _METHOD(handle_cache.activity.class, "onCreate", "(Landroid/os/Bundle;)V");
|
handle_cache.activity.onCreate = _METHOD(handle_cache.activity.class, "onCreate", "(Landroid/os/Bundle;)V");
|
||||||
|
handle_cache.activity.onPostCreate = _METHOD(handle_cache.activity.class, "onPostCreate", "(Landroid/os/Bundle;)V");
|
||||||
handle_cache.activity.onStart = _METHOD(handle_cache.activity.class, "onStart", "()V");
|
handle_cache.activity.onStart = _METHOD(handle_cache.activity.class, "onStart", "()V");
|
||||||
handle_cache.activity.onWindowFocusChanged = _METHOD(handle_cache.activity.class, "onWindowFocusChanged", "(Z)V");
|
handle_cache.activity.onWindowFocusChanged = _METHOD(handle_cache.activity.class, "onWindowFocusChanged", "(Z)V");
|
||||||
handle_cache.activity.onResume = _METHOD(handle_cache.activity.class, "onResume", "()V");
|
handle_cache.activity.onResume = _METHOD(handle_cache.activity.class, "onResume", "()V");
|
||||||
|
handle_cache.activity.onPostResume = _METHOD(handle_cache.activity.class, "onPostResume", "()V");
|
||||||
handle_cache.activity.onDestroy = _METHOD(handle_cache.activity.class, "onDestroy", "()V");
|
handle_cache.activity.onDestroy = _METHOD(handle_cache.activity.class, "onDestroy", "()V");
|
||||||
handle_cache.activity.onStop = _METHOD(handle_cache.activity.class, "onStop", "()V");
|
handle_cache.activity.onStop = _METHOD(handle_cache.activity.class, "onStop", "()V");
|
||||||
handle_cache.activity.onPause = _METHOD(handle_cache.activity.class, "onPause", "()V");
|
handle_cache.activity.onPause = _METHOD(handle_cache.activity.class, "onPause", "()V");
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ struct handle_cache {
|
|||||||
struct {
|
struct {
|
||||||
jclass class;
|
jclass class;
|
||||||
jmethodID onCreate;
|
jmethodID onCreate;
|
||||||
|
jmethodID onPostCreate;
|
||||||
jmethodID onStart;
|
jmethodID onStart;
|
||||||
jmethodID onResume;
|
jmethodID onResume;
|
||||||
|
jmethodID onPostResume;
|
||||||
jmethodID onWindowFocusChanged;
|
jmethodID onWindowFocusChanged;
|
||||||
jmethodID onDestroy;
|
jmethodID onDestroy;
|
||||||
jmethodID onStop;
|
jmethodID onStop;
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
System.out.println("- onPostCreate - yay!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
System.out.println("- onStart - yay!");
|
System.out.println("- onStart - yay!");
|
||||||
if (window.contentView != null)
|
if (window.contentView != null)
|
||||||
@@ -177,6 +182,11 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onPostResume() {
|
||||||
|
System.out.println("- onPostResume - yay!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
System.out.println("- onPause - yay!");
|
System.out.println("- onPause - yay!");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user