mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
View.setSystemUiVisibility(): implement fullscreen
For now we only allow fullscreen for maximized windows
This commit is contained in:
parent
0bec10bb26
commit
6068ac2eb8
3 changed files with 25 additions and 0 deletions
|
@ -311,6 +311,14 @@ JNIEXPORT void JNICALL Java_android_view_View_native_1drawBackground
|
|||
JNIEXPORT void JNICALL Java_android_view_View_native_1drawContent
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_view_View
|
||||
* Method: nativeSetFullscreen
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_view_View_nativeSetFullscreen
|
||||
(JNIEnv *, jobject, jlong, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_view_View
|
||||
* Method: nativeInvalidate
|
||||
|
|
|
@ -577,3 +577,17 @@ JNIEXPORT void JNICALL Java_android_view_View_native_1drawContent(JNIEnv *env, j
|
|||
GdkSnapshot *snapshot = GDK_SNAPSHOT(_PTR(snapshot_ptr));
|
||||
gtk_widget_snapshot_child(&wrapper->parent_instance, wrapper->child, snapshot);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_view_View_nativeSetFullscreen(JNIEnv *env, jobject this, jlong widget_ptr, jboolean fullscreen)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET(_PTR(widget_ptr));
|
||||
GtkWindow *window = GTK_WINDOW(gtk_widget_get_native(widget));
|
||||
if (fullscreen) {
|
||||
if (gtk_window_is_maximized(window))
|
||||
gtk_window_fullscreen(window);
|
||||
else
|
||||
printf("blocking fullscreen request, because window is not maximized\n");
|
||||
} else {
|
||||
gtk_window_unfullscreen(window);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1038,7 +1038,10 @@ public class View implements Drawable.Callback {
|
|||
return true;
|
||||
}
|
||||
|
||||
private native void nativeSetFullscreen(long widget, boolean fullscreen);
|
||||
|
||||
public void setSystemUiVisibility(int visibility) {
|
||||
nativeSetFullscreen(widget, (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0);
|
||||
system_ui_visibility = visibility;
|
||||
}
|
||||
public int getSystemUiVisibility() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue