Skip to content

Commit

Permalink
Do not queue WindowWidget::unsetView() calls (#2898)
Browse files Browse the repository at this point in the history
* Do not queue WindowWidget::unsetView() calls

* Update modelview url when there is a title bar visibility change

Co-authored-by: Manuel Martin <imanol.martin@gmail.com>
  • Loading branch information
bluemarvin and keianhzo committed Feb 29, 2020
1 parent 3e30ba6 commit abe931f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
Expand Up @@ -149,6 +149,10 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
} else {
mWidgetManager.updateWidget(TitleBarWidget.this);
}

if (mAttachedWindow.getSession() != null) {
mViewModel.setUrl(mAttachedWindow.getSession().getCurrentUri());
}
};

}
Expand Up @@ -403,36 +403,28 @@ private void setView(View view, boolean switchSurface) {
}

private void unsetView(View view, boolean switchSurface) {
Runnable unsetView = () -> {
if (mView != null && mView == view) {
mView = null;
removeView(view);
view.setVisibility(GONE);

if (switchSurface) {
setWillNotDraw(true);
if (mTexture != null) {
// Surface must be recreated here when not using layers.
// When using layers the new Surface is received via the setSurface() method.
if (mRenderer != null) {
mRenderer.release();
mRenderer = null;
}
mSurface = new Surface(mTexture);
mSetViewQueuedCalls.clear();
if (mView != null && mView == view) {
mView = null;
removeView(view);
view.setVisibility(GONE);

if (switchSurface) {
setWillNotDraw(true);
if (mTexture != null) {
// Surface must be recreated here when not using layers.
// When using layers the new Surface is received via the setSurface() method.
if (mRenderer != null) {
mRenderer.release();
mRenderer = null;
}
mWidgetPlacement.density = 1.0f;
mWidgetManager.updateWidget(WindowWidget.this);
mWidgetManager.popWorldBrightness(WindowWidget.this);
mWidgetManager.popBackHandler(mBackHandler);
mSurface = new Surface(mTexture);
}
mWidgetPlacement.density = 1.0f;
mWidgetManager.updateWidget(WindowWidget.this);
mWidgetManager.popWorldBrightness(WindowWidget.this);
mWidgetManager.popBackHandler(mBackHandler);
}
};

if (mAfterFirstPaint) {
unsetView.run();

} else {
mSetViewQueuedCalls.add(unsetView);
}
}

Expand Down Expand Up @@ -1058,6 +1050,8 @@ public void setSession(@NonNull Session aSession, @OldSessionDisplayAction int a
for (WindowListener listener: mListeners) {
listener.onSessionChanged(oldSession, aSession);
}


}
mCaptureOnPageStop = false;
hideLibraryPanels();
Expand Down

0 comments on commit abe931f

Please sign in to comment.