android_layout_measure(): refactor to respect LayoutParams

This is needed when a Java widget gets measured from GTK
This commit is contained in:
Julian Winkler
2023-10-31 22:56:22 +01:00
committed by Julian Winkler
parent 8b6de0e83a
commit 3c03223085
6 changed files with 54 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
#include "../util.h"
#include "../widgets/WrapperWidget.h"
#include "../views/AndroidLayout.h"
#include "../generated_headers/android_view_View.h"
@@ -236,6 +237,10 @@ JNIEXPORT void JNICALL Java_android_view_View_native_1setLayoutParams(JNIEnv *en
g_object_set(G_OBJECT(widget), "width-request", width, NULL);
if(height > 0)
g_object_set(G_OBJECT(widget), "height-request", height, NULL);
GtkLayoutManager *layout_manager = gtk_widget_get_layout_manager(WRAPPER_WIDGET(widget)->child);
if (ATL_IS_ANDROID_LAYOUT(layout_manager))
android_layout_set_params(ATL_ANDROID_LAYOUT(layout_manager), width, height);
}
JNIEXPORT void JNICALL Java_android_view_View_setVisibility(JNIEnv *env, jobject this, jint visibility) {