Skip to content

Commit

Permalink
Update tittle bar media status when switching tabs (#2584)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and MortimerGoro committed Jan 8, 2020
1 parent 9361b60 commit 35b6984
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,18 @@ public void mediaAvailabilityChanged(boolean available) {
}
}
} else {
mMedia = null;
mBinding.setIsMediaAvailable(false);
}
}

public void updateMediaStatus() {
if (mMedia != null) {
mBinding.setIsMediaAvailable(mMedia.isPlayed());
mBinding.setIsMediaPlaying(mMedia.isPlaying());
}
}

MediaElement.Delegate mMediaDelegate = new MediaElement.Delegate() {
@Override
public void onPlaybackStateChange(@NonNull MediaElement mediaElement, int state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ public void setActiveWindow(boolean active) {
updateTitleBar();
}

updateTitleBarMediaStatus();
hideContextMenus();

TelemetryWrapper.activePlacementEvent(mWindowPlacement.getValue(), mActive);
Expand Down Expand Up @@ -704,6 +705,12 @@ private void updateTitleBarUrl(String url) {
}
}

public void updateTitleBarMediaStatus() {
if (mTitleBar != null) {
mTitleBar.updateMediaStatus();
}
}

public Session getSession() {
return mSession;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,8 @@ public void onTabSelect(Session aTab) {
windowToMove.setSession(moveTo, WindowWidget.SESSION_DO_NOT_RELEASE_DISPLAY);
targetWindow.setSession(moveFrom, WindowWidget.SESSION_DO_NOT_RELEASE_DISPLAY);
SessionStore.get().setActiveSession(targetWindow.getSession());
windowToMove.setActiveWindow(false);
targetWindow.setActiveWindow(true);

} else {
setFirstPaint(targetWindow, aTab);
Expand Down

0 comments on commit 35b6984

Please sign in to comment.