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

Update title bar position after neighbour window is resized #1948

Merged
merged 1 commit into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}

}