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
PopupWindow: handle background being set before contentView
This commit is contained in:
@@ -37,6 +37,7 @@ public class PopupWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private View contentView;
|
private View contentView;
|
||||||
|
private Drawable background;
|
||||||
private long popover; // native pointer to GtkPopover
|
private long popover; // native pointer to GtkPopover
|
||||||
|
|
||||||
public interface OnDismissListener {
|
public interface OnDismissListener {
|
||||||
@@ -44,6 +45,7 @@ public class PopupWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBackgroundDrawable(Drawable background) {
|
public void setBackgroundDrawable(Drawable background) {
|
||||||
|
this.background = background;
|
||||||
/* FIXME: use a decorview? */
|
/* FIXME: use a decorview? */
|
||||||
if(contentView != null) {
|
if(contentView != null) {
|
||||||
contentView.setBackgroundDrawable(background);
|
contentView.setBackgroundDrawable(background);
|
||||||
@@ -64,11 +66,14 @@ public class PopupWindow {
|
|||||||
|
|
||||||
public void setFocusable(boolean focusable) {}
|
public void setFocusable(boolean focusable) {}
|
||||||
|
|
||||||
public Drawable getBackground() {return null;}
|
public Drawable getBackground() {
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
public void setContentView(View view) {
|
public void setContentView(View view) {
|
||||||
contentView = view;
|
contentView = view;
|
||||||
if (contentView != null) {
|
if (contentView != null) {
|
||||||
|
contentView.setBackground(getBackground());
|
||||||
contentView.attachToWindowInternal();
|
contentView.attachToWindowInternal();
|
||||||
}
|
}
|
||||||
native_setContentView(popover, view == null ? 0 : view.widget);
|
native_setContentView(popover, view == null ? 0 : view.widget);
|
||||||
|
|||||||
Reference in New Issue
Block a user