use AndroidLayout for all JavaWidgets

This commit is contained in:
Julian Winkler
2024-05-06 22:59:10 +02:00
parent f82af6ecb7
commit e4a399f849
3 changed files with 1 additions and 10 deletions

View File

@@ -360,6 +360,7 @@ JNIEXPORT jlong JNICALL Java_android_view_View_native_1constructor(JNIEnv *env,
{
GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
GtkWidget *widget = g_object_new(java_widget_get_type(), NULL);
gtk_widget_set_layout_manager(widget, android_layout_new(_REF(this)));
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), widget);
wrapper_widget_set_jobject(WRAPPER_WIDGET(wrapper), env, this);
@@ -373,12 +374,6 @@ JNIEXPORT jlong JNICALL Java_android_view_View_native_1constructor(JNIEnv *env,
/* this should better match default android behavior */
gtk_widget_set_overflow(wrapper, GTK_OVERFLOW_VISIBLE);
jmethodID measure_method = _METHOD(class, "onMeasure", "(II)V");
jmethodID layout_method = _METHOD(class, "onLayout", "(ZIIII)V");
if (measure_method != handle_cache.view.onMeasure || layout_method != handle_cache.view.onLayout) {
gtk_widget_set_layout_manager(widget, android_layout_new(_REF(this)));
}
if (_METHOD(_CLASS(this), "onGenericMotionEvent", "(Landroid/view/MotionEvent;)Z") != handle_cache.view.onGenericMotionEvent) {
GtkEventController *controller = gtk_event_controller_scroll_new(GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);

View File

@@ -10,12 +10,10 @@ public class ViewStub extends View {
public ViewStub(Context context) {
this(context, null, 0);
haveCustomMeasure = false;
}
public ViewStub(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
haveCustomMeasure = false;
}
public ViewStub(Context context, AttributeSet attributeSet, int defStyle) {

View File

@@ -8,12 +8,10 @@ public class Space extends View {
public Space(Context context) {
super(context);
haveCustomMeasure = false;
}
public Space(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
haveCustomMeasure = false;
}
}