Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Update title bar position after neighbour window is resized (#1948)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and bluemarvin committed Oct 16, 2019
1 parent 72184e6 commit 8641663
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -76,6 +78,8 @@ WindowWidget getAttachedWindow() {
public void releaseWidget() {
detachFromWindow();

mWidgetManager.removeUpdateListener(this);

mAttachedWindow = null;
super.releaseWidget();
}
Expand Down Expand Up @@ -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);
}
}

}

0 comments on commit 8641663

Please sign in to comment.