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

Update tittle bar media status when switching tabs #2584

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
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 @@ -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