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

Commit

Permalink
Merge pull request #15054 from huchengtw-moz/video/Bug_915039-no-stri…
Browse files Browse the repository at this point in the history
…ng-change

Bug 915039 - [Video] There is no easy way to navigate back to the activi...,r=djf
  • Loading branch information
huchengtw-moz committed Jan 7, 2014
2 parents 0fe1103 + 05978c5 commit 28a3012
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 26 deletions.
3 changes: 1 addition & 2 deletions apps/video/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ <h1 id="overlay-title"></h1>
<p id="overlay-text"></p>
</section>
<menu id="overlay-menu" class="hidden">
<button type="button" id="storage-setting-button" class="full"
data-l10n-id="storage-setting-button">Media storage settings</button>
<button type="button" id="overlay-action-button" class="full"></button>
</menu>
</form>

Expand Down
56 changes: 32 additions & 24 deletions apps/video/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var ids = ['thumbnail-list-view', 'thumbnails-bottom', 'thumbnail-list-title',
'thumbnails-single-delete-button', 'thumbnails-single-share-button',
'thumbnails-single-info-button', 'info-view', 'info-close-button',
'player', 'overlay', 'overlay-title', 'overlay-text',
'overlay-menu', 'storage-setting-button', 'video-container',
'videoControls', 'videoBar', 'videoActionBar',
'overlay-menu', 'overlay-action-button',
'video-container', 'videoControls', 'videoBar', 'videoActionBar',
'close', 'play', 'playHead', 'timeSlider', 'elapsedTime',
'video-title', 'duration-text', 'elapsed-text', 'bufferedTime',
'slider-wrapper', 'throbber', 'delete-video-button',
Expand Down Expand Up @@ -171,11 +171,17 @@ function init() {
});
}

// Click to open the media storage panel when the default storage is
// unavailable.
dom.storageSettingButton.addEventListener('click', launchSettingsApp);

navigator.mozSetMessageHandler('activity', handleActivityEvents);

// the overlay action button may be used in both normal mode and activity
// mode, we need to wire its event handler here.
dom.overlayActionButton.addEventListener('click', function() {
if (pendingPick) {
cancelPick();
} else if (currentOverlay === 'empty') {
launchCameraApp();
}
});
}

function initThumbnailSize() {
Expand Down Expand Up @@ -484,16 +490,6 @@ function updateSelection(videodata) {
}
}

function launchSettingsApp() {
var activity = new MozActivity({
name: 'configure',
data: {
target: 'device',
section: 'mediaStorage'
}
});
}

function launchCameraApp() {
var a = new MozActivity({
name: 'record',
Expand Down Expand Up @@ -727,19 +723,28 @@ function showOverlay(id) {
return;
}

if (id === 'nocard') {
var _ = navigator.mozL10n.get;

if (pendingPick || id === 'empty') {
// We cannot use hidden attribute because confirm.css overrides it.
dom.overlayMenu.classList.remove('hidden');
dom.overlayActionButton.classList.remove('hidden');
dom.overlayActionButton.textContent = _(pendingPick ?
'overlay-cancel-button' :
'overlay-camera-button');
} else {
dom.overlayMenu.classList.add('hidden');
dom.overlayActionButton.classList.add('hidden');
}

if (id === 'nocard') {
dom.overlayTitle.textContent = navigator.mozL10n.get('nocard2-title');
dom.overlayText.textContent = navigator.mozL10n.get('nocard2-text');
dom.overlayTitle.textContent = _('nocard2-title');
dom.overlayText.textContent = _('nocard2-text');
} else {
dom.overlayTitle.textContent = navigator.mozL10n.get(id + '-title');
dom.overlayText.textContent = navigator.mozL10n.get(id + '-text');
dom.overlayTitle.textContent = _(id + '-title');
dom.overlayText.textContent = _(id + '-text');
}

dom.overlay.classList.remove('hidden');
}

Expand Down Expand Up @@ -1196,9 +1201,7 @@ function showPickView() {
thumbnailList.setPickMode(true);
document.body.classList.add('pick-activity');

dom.pickerClose.addEventListener('click', function() {
pendingPick.postError('pick cancelled');
});
dom.pickerClose.addEventListener('click', cancelPick);

// In tablet, landscape mode, the pick view will have different UI from normal
// view.
Expand All @@ -1208,6 +1211,11 @@ function showPickView() {
}
}

function cancelPick() {
pendingPick.postError('pick cancelled');
cleanupPick();
}

function cleanupPick() {
pendingPick = null;
currentVideoBlob = null;
Expand Down
2 changes: 2 additions & 0 deletions apps/video/locales/video.en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ error-unsupported = Video cannot be played: either because the server or network
error-unknown = An unknown video error occurred.

storage-setting-button = Media storage settings
overlay-cancel-button = Cancel
overlay-camera-button = Go to Camera

name-label = Name
length-label = Length
Expand Down
7 changes: 7 additions & 0 deletions apps/video/style/video.css
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,13 @@ section[role="region"] > header:first-child .icon-back {
top: 1rem;
}

/*
* increase specificity to overwrite confirm.css rules for dialog buttons
*/
form[role="dialog"][data-type="confirm"] button.hidden {
display: none;
}

@media screen and (orientation: portrait) {
#play, #play:after {
width: 5.6rem;
Expand Down

0 comments on commit 28a3012

Please sign in to comment.