From b0177f6ccb3a01e6675152a9210b436fcfc6a55f Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Mon, 2 Jun 2025 20:12:04 +0200 Subject: [PATCH] PopupWindow: handle background being set before contentView --- src/api-impl/android/widget/PopupWindow.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api-impl/android/widget/PopupWindow.java b/src/api-impl/android/widget/PopupWindow.java index a63a9133..e968a275 100644 --- a/src/api-impl/android/widget/PopupWindow.java +++ b/src/api-impl/android/widget/PopupWindow.java @@ -37,6 +37,7 @@ public class PopupWindow { } private View contentView; + private Drawable background; private long popover; // native pointer to GtkPopover public interface OnDismissListener { @@ -44,6 +45,7 @@ public class PopupWindow { } public void setBackgroundDrawable(Drawable background) { + this.background = background; /* FIXME: use a decorview? */ if(contentView != null) { contentView.setBackgroundDrawable(background); @@ -64,11 +66,14 @@ public class PopupWindow { public void setFocusable(boolean focusable) {} - public Drawable getBackground() {return null;} + public Drawable getBackground() { + return background; + } public void setContentView(View view) { contentView = view; if (contentView != null) { + contentView.setBackground(getBackground()); contentView.attachToWindowInternal(); } native_setContentView(popover, view == null ? 0 : view.widget);