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
use Activity title as window title
This commit is contained in:
@@ -14,6 +14,14 @@ JNIEXPORT void JNICALL Java_android_view_Window_set_1widget_1as_1root(JNIEnv *en
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_android_view_Window_set_1title(JNIEnv *env, jobject this, jlong window, jstring title_jstr)
|
||||||
|
{
|
||||||
|
GtkWindow *gtk_window = GTK_WINDOW(_PTR(window));
|
||||||
|
const char *title = (*env)->GetStringUTFChars(env, title_jstr, NULL);
|
||||||
|
gtk_window_set_title(gtk_window, title);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, title_jstr, title);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME put this in a header file
|
// FIXME put this in a header file
|
||||||
struct input_queue {
|
struct input_queue {
|
||||||
int fd;
|
int fd;
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ extern "C" {
|
|||||||
JNIEXPORT void JNICALL Java_android_view_Window_set_1widget_1as_1root
|
JNIEXPORT void JNICALL Java_android_view_Window_set_1widget_1as_1root
|
||||||
(JNIEnv *, jobject, jlong, jlong);
|
(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: android_view_Window
|
||||||
|
* Method: set_title
|
||||||
|
* Signature: (JLjava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_android_view_Window_set_1title
|
||||||
|
(JNIEnv *, jobject, jlong, jstring);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: android_view_Window
|
* Class: android_view_Window
|
||||||
* Method: take_input_queue
|
* Method: take_input_queue
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
System.out.println("- onStart - yay!");
|
System.out.println("- onStart - yay!");
|
||||||
if (window.contentView != null)
|
if (window.contentView != null)
|
||||||
window.setContentView(window.contentView);
|
window.setContentView(window.contentView);
|
||||||
|
window.setTitle(title);
|
||||||
|
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
fragment.onStart();
|
fragment.onStart();
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void set_widget_as_root(long native_window, long widget);
|
private native void set_widget_as_root(long native_window, long widget);
|
||||||
|
private native void set_title(long native_window, String title);
|
||||||
|
|
||||||
public native void take_input_queue(long native_window, InputQueue.Callback callback, InputQueue queue);
|
public native void take_input_queue(long native_window, InputQueue.Callback callback, InputQueue queue);
|
||||||
|
|
||||||
@@ -133,4 +134,8 @@ public class Window {
|
|||||||
public boolean hasFeature(int featureId) {
|
public boolean hasFeature(int featureId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTitle(CharSequence title) {
|
||||||
|
set_title(native_window, title != null ? title.toString() : context.getPackageName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user