Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1055198 - [Video] Hide soft home key during full screen video pla…
Browse files Browse the repository at this point in the history
…yback
  • Loading branch information
Russ Nicoletti committed Sep 11, 2014
1 parent be46e59 commit 109638a
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apps/video/index.html
Expand Up @@ -9,6 +9,9 @@
<!-- this file is loaded lazily but is listed here so it gets packaged
<link rel="stylesheet" href="shared/style/confirm.css" type="text/css" />
-->
<!-- this file is loaded lazily but is listed here so it gets packaged
<link rel="stylesheet" href="style/confirm.css" type="text/css" />
-->
<link rel="stylesheet" type="text/css" href="style/video.css" />
<link rel="stylesheet" type="text/css" href="style/info.css" />
<link rel="stylesheet" type="text/css" href="style/spinner.css" />
Expand Down
25 changes: 23 additions & 2 deletions apps/video/js/video.js
Expand Up @@ -9,6 +9,7 @@ const LAYOUT_MODE = {
selection: 'layout-selection',
fullscreenPlayer: 'layout-fullscreen-player'
};
var foo = 0;

var dom = {};

Expand Down Expand Up @@ -556,7 +557,8 @@ function resetCurrentVideo() {
function deleteSelectedItems() {
if (selectedFileNames.length === 0)
return;
LazyLoader.load('shared/style/confirm.css', function() {
LazyLoader.load(['shared/style/confirm.css',
'style/confirm.css'], function() {

Dialogs.confirm({
messageId: 'delete-n-items?',
Expand Down Expand Up @@ -774,6 +776,7 @@ function showOverlay(id) {
}

function setControlsVisibility(visible) {

// in tablet landscape mode, we always shows controls in list layout. We
// don't need to hide it.
if (isPhone || isPortrait ||
Expand All @@ -785,6 +788,23 @@ function setControlsVisibility(visible) {
// always set it as shown.
controlShowing = true;
}

// On phone with a software home button
if (isPhone && !ScreenLayout.getCurrentLayout('hardwareHomeButton')) {
if (visible) {
// When showing the controls, show the software home button. Also,
// adjust the position of the controls so that they are not under
// the swhb.
document.mozCancelFullScreen();
dom.videoControls.classList.add('software-button-present');
}
else {
// When hiding the controls, hide the software home button. We don't
// need to reposition the controls since they are being hidden.
dom.playerView.mozRequestFullScreen();
}
}

// to sync the slider under the case of auto-pause(unplugging headset), we
// need to update the slider when controls is visible.
if (controlShowing) {
Expand Down Expand Up @@ -830,7 +850,8 @@ function deleteCurrentVideo() {
// We need to disable NFC sharing when showing delete confirmation dialog
setNFCSharing(false);

LazyLoader.load('shared/style/confirm.css', function() {
LazyLoader.load(['shared/style/confirm.css',
'style/confirm.css'], function() {
// If we're deleting the file shown in the player we've got to
// return to the thumbnail list. We pass false to hidePlayer() to tell it
// not to record new metadata for the file we're about to delete.
Expand Down
1 change: 1 addition & 0 deletions apps/video/manifest.webapp
Expand Up @@ -8,6 +8,7 @@
"url": "https://github.com/mozilla-b2g/gaia"
},
"fullscreen": true,
"fullscreen_layout": true,
"permissions": {
"storage":{},
"device-storage:pictures":{ "access": "readwrite" },
Expand Down
18 changes: 18 additions & 0 deletions apps/video/style/confirm.css
@@ -0,0 +1,18 @@
/*
* confirm dialog overrides for software home button
*/
@media not all and (-moz-physical-home-button) {
@media (orientation: portrait) {
form[role="dialog"][data-type="confirm"] menu {
left: 0;
bottom: 5rem;
}
}
@media (orientation: landscape) {
form[role="dialog"][data-type="confirm"] menu {
right: 5rem;
bottom: 0;
}
}
}

15 changes: 15 additions & 0 deletions apps/video/style/info.css
Expand Up @@ -39,3 +39,18 @@
/* no separator after the last item in the list */
border-bottom: none;
}

@media not all and (-moz-physical-home-button) {
@media (orientation: portrait) {
#info-view > menu button {
right: 0;
bottom: 5rem;
}
}
@media (orientation: landscape) {
#info-view > menu button {
right: 5rem;
bottom: 0;
}
}
}
74 changes: 74 additions & 0 deletions apps/video/style/video.css
Expand Up @@ -113,6 +113,21 @@ span.line-break {
font-size: 2.1rem;
}

@media not all and (-moz-physical-home-button) {
@media (orientation: portrait) {
#thumbnail-list-view, #thumbnail-select-view {
height: calc(100% - 5rem);
width: 100%;
}
}
@media (orientation: landscape) {
#thumbnail-list-view, #thumbnail-select-view {
height: 100%;
width: calc(100% - 5rem);
}
}
}

/*
* Thumbnails are implemented as <li> elements in a <ul> with background-image
* set to display the image. We use background-size: cover to automatically
Expand Down Expand Up @@ -444,6 +459,23 @@ header .icon:after {
pointer-events: none;
}

/*
* Adjust video controls when software home button is present
*/
@media (orientation: portrait) {
#videoControls.software-button-present {
height: calc(100% - 5rem);
width: 100%;
}
}

@media (orientation: landscape) {
#videoControls.software-button-present {
height: 100%;
width: calc(100% - 5rem);
}
}

/* main control bar: play|pause, timeupdate, rwd|fwd
For landscape mode here. Settings for portrait mode is written in
media query at bottom */
Expand Down Expand Up @@ -754,3 +786,45 @@ form[role="dialog"][data-type="confirm"] button.hidden {
border: none;
padding: 0;
}

@media not all and (-moz-physical-home-button) {
@media (orientation: portrait) {
#options-view {
right: 0;
bottom: 5rem;
}
}
@media (orientation: landscape) {

#options-view {
right: 5rem;
bottom: 0;
}
}
}

@media not all and (-moz-physical-home-button) {
@media (orientation: portrait) {
#options-cancel-button {
right: 0;
bottom: 5rem;
}
}

/*
* options-cancel-button needs special treatment because its position
* is 'fixed'. In order for 'right' to be applied, set 'left: auto'.
* Adjust width by 5+3 ('5' because right is shifted by 5, '3' because
* width has already been shortened by 3 by here:
* '[role="dialog"][data-type="action"] > menu > button' in action_menu.css
*/
@media (orientation: landscape) {
#options-cancel-button {
left: auto;
right: 5rem;
width: calc(100% - 8rem);
bottom: 0;
}
}
}

0 comments on commit 109638a

Please sign in to comment.