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

Commit 35b6984

Browse files
keianhzoMortimerGoro
authored andcommitted
Update tittle bar media status when switching tabs (#2584)
1 parent 9361b60 commit 35b6984

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,18 @@ public void mediaAvailabilityChanged(boolean available) {
192192
}
193193
}
194194
} else {
195+
mMedia = null;
195196
mBinding.setIsMediaAvailable(false);
196197
}
197198
}
198199

200+
public void updateMediaStatus() {
201+
if (mMedia != null) {
202+
mBinding.setIsMediaAvailable(mMedia.isPlayed());
203+
mBinding.setIsMediaPlaying(mMedia.isPlaying());
204+
}
205+
}
206+
199207
MediaElement.Delegate mMediaDelegate = new MediaElement.Delegate() {
200208
@Override
201209
public void onPlaybackStateChange(@NonNull MediaElement mediaElement, int state) {

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ public void setActiveWindow(boolean active) {
660660
updateTitleBar();
661661
}
662662

663+
updateTitleBarMediaStatus();
663664
hideContextMenus();
664665

665666
TelemetryWrapper.activePlacementEvent(mWindowPlacement.getValue(), mActive);
@@ -704,6 +705,12 @@ private void updateTitleBarUrl(String url) {
704705
}
705706
}
706707

708+
public void updateTitleBarMediaStatus() {
709+
if (mTitleBar != null) {
710+
mTitleBar.updateMediaStatus();
711+
}
712+
}
713+
707714
public Session getSession() {
708715
return mSession;
709716
}

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,8 @@ public void onTabSelect(Session aTab) {
11411141
windowToMove.setSession(moveTo, WindowWidget.SESSION_DO_NOT_RELEASE_DISPLAY);
11421142
targetWindow.setSession(moveFrom, WindowWidget.SESSION_DO_NOT_RELEASE_DISPLAY);
11431143
SessionStore.get().setActiveSession(targetWindow.getSession());
1144+
windowToMove.setActiveWindow(false);
1145+
targetWindow.setActiveWindow(true);
11441146

11451147
} else {
11461148
setFirstPaint(targetWindow, aTab);

0 commit comments

Comments
 (0)