fix action sheet

This commit is contained in:
Luke Pulverenti 2016-01-28 23:18:31 -05:00
parent 4dc7a40afd
commit e881e6380a
3 changed files with 48 additions and 65 deletions

View File

@ -2,7 +2,7 @@
function show(options) { function show(options) {
require(['paper-menu', 'paper-dialog', 'paper-dialog-scrollable', 'scale-up-animation', 'fade-out-animation'], function () { require(['paper-menu', 'paper-dialog', 'scale-up-animation', 'fade-out-animation'], function () {
showInternal(options); showInternal(options);
}); });
} }
@ -134,7 +134,10 @@
} }
}; };
dlg.open(); var delay = browserInfo.chrome ? 0 : 100;
setTimeout(function () {
dlg.open();
}, delay);
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function () { dlg.addEventListener('iron-overlay-closed', function () {
@ -144,23 +147,39 @@
// Seeing an issue in some non-chrome browsers where this is requiring a double click // Seeing an issue in some non-chrome browsers where this is requiring a double click
var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown'; var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown';
dlg.querySelector('.actionSheetMenuItem').addEventListener(eventName, function (e) { dlg.addEventListener(eventName, function (e) {
var selectedId = e.target.getAttribute('data-id'); var target = parentWithClass(e.target, 'actionSheetMenuItem');
if (target) {
var selectedId = target.getAttribute('data-id');
// Add a delay here to allow the click animation to finish, for nice effect // Add a delay here to allow the click animation to finish, for nice effect
setTimeout(function () { setTimeout(function () {
dlg.close(); dlg.close();
if (options.callback) { if (options.callback) {
options.callback(selectedId); options.callback(selectedId);
} }
}, 100); }, 100);
}
}); });
} }
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
window.ActionSheetElement = { window.ActionSheetElement = {
show: show show: show
}; };

View File

@ -50,18 +50,16 @@
var enableVlcVideo = true; var enableVlcVideo = true;
var enableVlcAudio = true; var enableVlcAudio = true;
profile.CodecProfiles = [];
if (enableVlcVideo) { if (enableVlcVideo) {
var directPlayVideoContainers = AppInfo.directPlayVideoContainers; profile.DirectPlayProfiles.push({
Container: "m4v,3gp,ts,mpegts,mov,xvid,vob,mkv,wmv,asf,ogm,ogv,m2v,avi,mpg,mpeg,mp4,webm",
Type: 'Video'
});
if (directPlayVideoContainers && directPlayVideoContainers.length) { profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
profile.DirectPlayProfiles.push({ return i.Type == 'Audio';
Container: directPlayVideoContainers.join(','), });
Type: 'Video'
});
}
profile.SubtitleProfiles = []; profile.SubtitleProfiles = [];
profile.SubtitleProfiles.push({ profile.SubtitleProfiles.push({
@ -157,14 +155,14 @@
if (enableVlcAudio) { if (enableVlcAudio) {
var directPlayAudioContainers = AppInfo.directPlayAudioContainers; profile.DirectPlayProfiles.push({
Container: "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus",
Type: 'Audio'
});
if (directPlayAudioContainers && directPlayAudioContainers.length) { profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
profile.DirectPlayProfiles.push({ return i.Type != 'Audio';
Container: directPlayAudioContainers.join(','), });
Type: 'Audio'
});
}
profile.CodecProfiles.push({ profile.CodecProfiles.push({
Type: 'Audio', Type: 'Audio',
@ -179,33 +177,10 @@
function updateDeviceProfileForIOS(profile) { function updateDeviceProfileForIOS(profile) {
var directPlayVideoContainers = AppInfo.directPlayVideoContainers; profile.DirectPlayProfiles.push({
Container: "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac",
if (directPlayVideoContainers && directPlayVideoContainers.length) { Type: 'Audio'
profile.DirectPlayProfiles.push({ });
Container: directPlayVideoContainers.join(','),
Type: 'Video'
});
}
var directPlayAudioContainers = AppInfo.directPlayAudioContainers;
if (directPlayAudioContainers && directPlayAudioContainers.length) {
profile.DirectPlayProfiles.push({
Container: directPlayAudioContainers.join(','),
Type: 'Audio'
});
}
if (browserInfo.safari && !AppInfo.isNativeApp) {
profile.TranscodingProfiles.unshift({
Container: 'ts',
Type: 'Audio',
AudioCodec: 'aac',
Context: 'Streaming',
Protocol: 'hls'
});
}
} }
self.getDeviceProfile = function (maxHeight) { self.getDeviceProfile = function (maxHeight) {

View File

@ -1629,9 +1629,6 @@ var AppInfo = {};
AppInfo.supportsSyncPathSetting = isCordova && isAndroid; AppInfo.supportsSyncPathSetting = isCordova && isAndroid;
AppInfo.supportsUserDisplayLanguageSetting = Dashboard.isConnectMode() && !isCordova; AppInfo.supportsUserDisplayLanguageSetting = Dashboard.isConnectMode() && !isCordova;
AppInfo.directPlayAudioContainers = [];
AppInfo.directPlayVideoContainers = [];
if (isCordova && isIOS) { if (isCordova && isIOS) {
AppInfo.moreIcon = 'more-horiz'; AppInfo.moreIcon = 'more-horiz';
} else { } else {
@ -2134,14 +2131,6 @@ var AppInfo = {};
} }
}; };
if (Dashboard.isRunningInCordova() && browserInfo.android) {
AppInfo.directPlayVideoContainers = "m4v,3gp,ts,mpegts,mov,xvid,vob,mkv,wmv,asf,ogm,ogv,m2v,avi,mpg,mpeg,mp4,webm".split(',');
}
else if (Dashboard.isRunningInCordova() && browserInfo.safari) {
AppInfo.directPlayAudioContainers = "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac".split(',');
}
var promises = []; var promises = [];
deps = []; deps = [];
deps.push('scripts/mediaplayer'); deps.push('scripts/mediaplayer');