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) {
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);
});
}
@ -134,7 +134,10 @@
}
};
var delay = browserInfo.chrome ? 0 : 100;
setTimeout(function () {
dlg.open();
}, delay);
// Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function () {
@ -144,9 +147,11 @@
// Seeing an issue in some non-chrome browsers where this is requiring a double click
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
setTimeout(function () {
@ -158,9 +163,23 @@
}
}, 100);
}
});
}
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
window.ActionSheetElement = {
show: show
};

View File

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

View File

@ -1629,9 +1629,6 @@ var AppInfo = {};
AppInfo.supportsSyncPathSetting = isCordova && isAndroid;
AppInfo.supportsUserDisplayLanguageSetting = Dashboard.isConnectMode() && !isCordova;
AppInfo.directPlayAudioContainers = [];
AppInfo.directPlayVideoContainers = [];
if (isCordova && isIOS) {
AppInfo.moreIcon = 'more-horiz';
} 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 = [];
deps = [];
deps.push('scripts/mediaplayer');