From 86416631016c5d0fbe35520a9b22895e08d50eb1 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Thu, 10 Oct 2019 11:51:00 +0200 Subject: [PATCH] Update title bar position after neighbour window is resized (#1948) --- .../vrbrowser/ui/widgets/TitleBarWidget.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java index 8228d07ea..605cdb91a 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java @@ -26,7 +26,7 @@ import java.net.URI; import java.net.URL; -public class TitleBarWidget extends UIWidget { +public class TitleBarWidget extends UIWidget implements WidgetManagerDelegate.UpdateListener { public interface Delegate { void onTitleClicked(@NonNull TitleBarWidget titleBar); @@ -61,6 +61,8 @@ private void initialize(@NonNull Context aContext) { mBinding = DataBindingUtil.inflate(inflater, R.layout.title_bar, this, true); mBinding.setWidget(this); mBinding.executePendingBindings(); + + mWidgetManager.addUpdateListener(this); } public void setDelegate(Delegate delegate) { @@ -76,6 +78,8 @@ WindowWidget getAttachedWindow() { public void releaseWidget() { detachFromWindow(); + mWidgetManager.removeUpdateListener(this); + mAttachedWindow = null; super.releaseWidget(); } @@ -203,5 +207,12 @@ public void onPlaybackStateChange(@NonNull MediaElement mediaElement, int state) } }; + // WidgetManagerDelegate.UpdateListener + @Override + public void onWidgetUpdate(Widget aWidget) { + if (aWidget == mWidgetManager.getFocusedWindow()) { + mWidgetManager.updateWidget(this); + } + } }