http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/src/wp/Notification.cs ---------------------------------------------------------------------- diff --git a/src/wp/Notification.cs b/src/wp/Notification.cs deleted file mode 100644 index 84ec4de..0000000 --- a/src/wp/Notification.cs +++ /dev/null @@ -1,480 +0,0 @@ -/* - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -using System; -using System.Windows; -using System.Windows.Controls; -using Microsoft.Devices; -using System.Runtime.Serialization; -using System.Threading; -using System.Windows.Resources; -using Microsoft.Phone.Controls; -using Microsoft.Xna.Framework.Audio; -using WPCordovaClassLib.Cordova.UI; -using System.Diagnostics; - - -namespace WPCordovaClassLib.Cordova.Commands -{ - public class Notification : BaseCommand - { - static ProgressBar progressBar = null; - const int DEFAULT_DURATION = 5; - - private NotificationBox notifyBox; - - private class NotifBoxData - { - public NotificationBox previous {get;set;} - public string callbackId { get; set; } - } - - private PhoneApplicationPage Page - { - get - { - PhoneApplicationPage page = null; - PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; - if (frame != null) - { - page = frame.Content as PhoneApplicationPage; - } - return page; - } - } - - // blink api - doesn't look like there is an equivalent api we can use... - - [DataContract] - public class AlertOptions - { - [OnDeserializing] - public void OnDeserializing(StreamingContext context) - { - // set defaults - this.message = "message"; - this.title = "Alert"; - this.buttonLabel = "ok"; - } - - /// <summary> - /// message to display in the alert box - /// </summary> - [DataMember] - public string message; - - /// <summary> - /// title displayed on the alert window - /// </summary> - [DataMember] - public string title; - - /// <summary> - /// text to display on the button - /// </summary> - [DataMember] - public string buttonLabel; - } - - [DataContract] - public class PromptResult - { - [DataMember] - public int buttonIndex; - - [DataMember] - public string input1; - - public PromptResult(int index, string text) - { - this.buttonIndex = index; - this.input1 = text; - } - } - - public void alert(string options) - { - string[] args = JSON.JsonHelper.Deserialize<string[]>(options); - AlertOptions alertOpts = new AlertOptions(); - alertOpts.message = args[0]; - alertOpts.title = args[1]; - alertOpts.buttonLabel = args[2]; - string aliasCurrentCommandCallbackId = args[3]; - - Deployment.Current.Dispatcher.BeginInvoke(() => - { - PhoneApplicationPage page = Page; - if (page != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - var previous = notifyBox; - notifyBox = new NotificationBox(); - notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId }; - notifyBox.PageTitle.Text = alertOpts.title; - notifyBox.SubTitle.Text = alertOpts.message; - Button btnOK = new Button(); - btnOK.Content = alertOpts.buttonLabel; - btnOK.Click += new RoutedEventHandler(btnOK_Click); - btnOK.Tag = 1; - notifyBox.ButtonPanel.Children.Add(btnOK); - grid.Children.Add(notifyBox); - - if (previous == null) - { - page.BackKeyPress += page_BackKeyPress; - } - } - } - else - { - DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION)); - } - }); - } - - public void prompt(string options) - { - string[] args = JSON.JsonHelper.Deserialize<string[]>(options); - string message = args[0]; - string title = args[1]; - string buttonLabelsArray = args[2]; - string[] buttonLabels = JSON.JsonHelper.Deserialize<string[]>(buttonLabelsArray); - string defaultText = args[3]; - string aliasCurrentCommandCallbackId = args[4]; - - Deployment.Current.Dispatcher.BeginInvoke(() => - { - PhoneApplicationPage page = Page; - if (page != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - var previous = notifyBox; - notifyBox = new NotificationBox(); - notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId }; - notifyBox.PageTitle.Text = title; - notifyBox.SubTitle.Text = message; - TextBox textBox = new TextBox(); - textBox.Text = defaultText; - notifyBox.TitlePanel.Children.Add(textBox); - - for (int i = 0; i < buttonLabels.Length; ++i) - { - Button button = new Button(); - button.Content = buttonLabels[i]; - button.Tag = i + 1; - button.Click += promptBoxbutton_Click; - notifyBox.TitlePanel.Children.Add(button); - } - - grid.Children.Add(notifyBox); - if (previous != null) - { - page.BackKeyPress += page_BackKeyPress; - } - } - } - else - { - DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION)); - } - }); - } - - public void confirm(string options) - { - string[] args = JSON.JsonHelper.Deserialize<string[]>(options); - AlertOptions alertOpts = new AlertOptions(); - alertOpts.message = args[0]; - alertOpts.title = args[1]; - alertOpts.buttonLabel = args[2]; - string aliasCurrentCommandCallbackId = args[3]; - - Deployment.Current.Dispatcher.BeginInvoke(() => - { - PhoneApplicationPage page = Page; - if (page != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - var previous = notifyBox; - notifyBox = new NotificationBox(); - notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId }; - notifyBox.PageTitle.Text = alertOpts.title; - notifyBox.SubTitle.Text = alertOpts.message; - - string[] labels = JSON.JsonHelper.Deserialize<string[]>(alertOpts.buttonLabel); - - if (labels == null) - { - labels = alertOpts.buttonLabel.Split(','); - } - - for (int n = 0; n < labels.Length; n++) - { - Button btn = new Button(); - btn.Content = labels[n]; - btn.Tag = n; - btn.Click += new RoutedEventHandler(btnOK_Click); - notifyBox.ButtonPanel.Children.Add(btn); - } - - grid.Children.Add(notifyBox); - if (previous == null) - { - page.BackKeyPress += page_BackKeyPress; - } - } - } - else - { - DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION)); - } - }); - } - - void promptBoxbutton_Click(object sender, RoutedEventArgs e) - { - Button button = sender as Button; - FrameworkElement promptBox = null; - int buttonIndex = 0; - string callbackId = string.Empty; - string text = string.Empty; - if (button != null) - { - buttonIndex = (int)button.Tag; - promptBox = button.Parent as FrameworkElement; - while ((promptBox = promptBox.Parent as FrameworkElement) != null && - !(promptBox is NotificationBox)) ; - } - - if (promptBox != null) - { - foreach (UIElement element in (promptBox as NotificationBox).TitlePanel.Children) - { - if (element is TextBox) - { - text = (element as TextBox).Text; - break; - } - } - PhoneApplicationPage page = Page; - if (page != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - grid.Children.Remove(promptBox); - } - - NotifBoxData data = promptBox.Tag as NotifBoxData; - promptBox = data.previous as NotificationBox; - callbackId = data.callbackId as string; - - if (promptBox == null) - { - page.BackKeyPress -= page_BackKeyPress; - } - } - } - DispatchCommandResult(new PluginResult(PluginResult.Status.OK, new PromptResult(buttonIndex, text)), callbackId); - } - - void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e) - { - PhoneApplicationPage page = sender as PhoneApplicationPage; - string callbackId = ""; - if (page != null && notifyBox != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - grid.Children.Remove(notifyBox); - NotifBoxData notifBoxData = notifyBox.Tag as NotifBoxData; - notifyBox = notifBoxData.previous as NotificationBox; - callbackId = notifBoxData.callbackId as string; - } - if (notifyBox == null) - { - page.BackKeyPress -= page_BackKeyPress; - } - e.Cancel = true; - } - - DispatchCommandResult(new PluginResult(PluginResult.Status.OK, 0), callbackId); - } - - void btnOK_Click(object sender, RoutedEventArgs e) - { - Button btn = sender as Button; - FrameworkElement notifBoxParent = null; - int retVal = 0; - string callbackId = ""; - if (btn != null) - { - retVal = (int)btn.Tag + 1; - - notifBoxParent = btn.Parent as FrameworkElement; - while ((notifBoxParent = notifBoxParent.Parent as FrameworkElement) != null && - !(notifBoxParent is NotificationBox)) ; - } - if (notifBoxParent != null) - { - PhoneApplicationPage page = Page; - if (page != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - grid.Children.Remove(notifBoxParent); - } - - NotifBoxData notifBoxData = notifBoxParent.Tag as NotifBoxData; - notifyBox = notifBoxData.previous as NotificationBox; - callbackId = notifBoxData.callbackId as string; - - if (notifyBox == null) - { - page.BackKeyPress -= page_BackKeyPress; - } - } - - } - DispatchCommandResult(new PluginResult(PluginResult.Status.OK, retVal), callbackId); - } - - - - public void beep(string options) - { - string[] args = JSON.JsonHelper.Deserialize<string[]>(options); - int times = int.Parse(args[0]); - - string resourcePath = BaseCommand.GetBaseURL() + "Plugins/org.apache.cordova.dialogs/notification-beep.wav"; - - StreamResourceInfo sri = Application.GetResourceStream(new Uri(resourcePath, UriKind.Relative)); - - if (sri != null) - { - SoundEffect effect = SoundEffect.FromStream(sri.Stream); - SoundEffectInstance inst = effect.CreateInstance(); - ThreadPool.QueueUserWorkItem((o) => - { - // cannot interact with UI !! - do - { - inst.Play(); - Thread.Sleep(effect.Duration + TimeSpan.FromMilliseconds(100)); - } - while (--times > 0); - - }); - - } - - // TODO: may need a listener to trigger DispatchCommandResult after the alarm has finished executing... - DispatchCommandResult(); - } - - // Display an indeterminate progress indicator - public void activityStart(string unused) - { - - Deployment.Current.Dispatcher.BeginInvoke(() => - { - PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; - - if (frame != null) - { - PhoneApplicationPage page = frame.Content as PhoneApplicationPage; - - if (page != null) - { - var temp = page.FindName("LayoutRoot"); - Grid grid = temp as Grid; - if (grid != null) - { - if (progressBar != null) - { - grid.Children.Remove(progressBar); - } - progressBar = new ProgressBar(); - progressBar.IsIndeterminate = true; - progressBar.IsEnabled = true; - - grid.Children.Add(progressBar); - } - } - } - }); - } - - - // Remove our indeterminate progress indicator - public void activityStop(string unused) - { - Deployment.Current.Dispatcher.BeginInvoke(() => - { - if (progressBar != null) - { - progressBar.IsEnabled = false; - PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; - if (frame != null) - { - PhoneApplicationPage page = frame.Content as PhoneApplicationPage; - if (page != null) - { - Grid grid = page.FindName("LayoutRoot") as Grid; - if (grid != null) - { - grid.Children.Remove(progressBar); - } - } - } - progressBar = null; - } - }); - } - - public void vibrate(string vibrateDuration) - { - - int msecs = 200; // set default - - try - { - string[] args = JSON.JsonHelper.Deserialize<string[]>(vibrateDuration); - - msecs = int.Parse(args[0]); - if (msecs < 1) - { - msecs = 1; - } - } - catch (FormatException) - { - - } - - VibrateController.Default.Start(TimeSpan.FromMilliseconds(msecs)); - - // TODO: may need to add listener to trigger DispatchCommandResult when the vibration ends... - DispatchCommandResult(); - } - } -}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/src/wp/NotificationBox.xaml ---------------------------------------------------------------------- diff --git a/src/wp/NotificationBox.xaml b/src/wp/NotificationBox.xaml deleted file mode 100644 index 1ca5d5f..0000000 --- a/src/wp/NotificationBox.xaml +++ /dev/null @@ -1,62 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<UserControl x:Class="WPCordovaClassLib.Cordova.UI.NotificationBox" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" - FontFamily="{StaticResource PhoneFontFamilyNormal}" - FontSize="{StaticResource PhoneFontSizeNormal}" - Foreground="{StaticResource PhoneForegroundBrush}" - d:DesignHeight="800" d:DesignWidth="480" VerticalAlignment="Stretch"> - - <Grid x:Name="LayoutRoot" - Background="{StaticResource PhoneSemitransparentBrush}" VerticalAlignment="Stretch"> - - <Grid.RowDefinitions> - <RowDefinition Height="Auto"/> - <RowDefinition Height="*"/> - </Grid.RowDefinitions> - - - <!--TitlePanel contains the name of the application and page title--> - <StackPanel x:Name="TitlePanel" - Grid.Row="0" - Background="{StaticResource PhoneSemitransparentBrush}"> - <TextBlock x:Name="PageTitle" - Text="Title" - Margin="10,10" - Style="{StaticResource PhoneTextTitle2Style}"/> - - <TextBlock x:Name="SubTitle" - Text="Subtitle" - TextWrapping="Wrap" - Margin="10,10" - Style="{StaticResource PhoneTextTitle3Style}"/> - - <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"> - <StackPanel x:Name="ButtonPanel" - Margin="10,10" - Orientation="Horizontal"/> - </ScrollViewer> - - </StackPanel> - </Grid> -</UserControl> http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/src/wp/NotificationBox.xaml.cs ---------------------------------------------------------------------- diff --git a/src/wp/NotificationBox.xaml.cs b/src/wp/NotificationBox.xaml.cs deleted file mode 100644 index 50b2f2a..0000000 --- a/src/wp/NotificationBox.xaml.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace WPCordovaClassLib.Cordova.UI -{ - public partial class NotificationBox : UserControl - { - public NotificationBox() - { - InitializeComponent(); - } - } -} http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/src/wp/notification-beep.wav ---------------------------------------------------------------------- diff --git a/src/wp/notification-beep.wav b/src/wp/notification-beep.wav deleted file mode 100644 index d0ad085..0000000 Binary files a/src/wp/notification-beep.wav and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/android/notification.js ---------------------------------------------------------------------- diff --git a/www/android/notification.js b/www/android/notification.js deleted file mode 100644 index 8936a5c..0000000 --- a/www/android/notification.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -var exec = require('cordova/exec'); - -/** - * Provides Android enhanced notification API. - */ -module.exports = { - activityStart : function(title, message) { - // If title and message not specified then mimic Android behavior of - // using default strings. - if (typeof title === "undefined" && typeof message == "undefined") { - title = "Busy"; - message = 'Please wait...'; - } - - exec(null, null, 'Notification', 'activityStart', [ title, message ]); - }, - - /** - * Close an activity dialog - */ - activityStop : function() { - exec(null, null, 'Notification', 'activityStop', []); - }, - - /** - * Display a progress dialog with progress bar that goes from 0 to 100. - * - * @param {String} - * title Title of the progress dialog. - * @param {String} - * message Message to display in the dialog. - */ - progressStart : function(title, message) { - exec(null, null, 'Notification', 'progressStart', [ title, message ]); - }, - - /** - * Close the progress dialog. - */ - progressStop : function() { - exec(null, null, 'Notification', 'progressStop', []); - }, - - /** - * Set the progress dialog value. - * - * @param {Number} - * value 0-100 - */ - progressValue : function(value) { - exec(null, null, 'Notification', 'progressValue', [ value ]); - } -}; http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/blackberry10/beep.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/beep.js b/www/blackberry10/beep.js deleted file mode 100644 index 6605107..0000000 --- a/www/blackberry10/beep.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -module.exports = function (quantity) { - var count = 0, - beepObj, - play = function () { - //create new object every time due to strage playback behaviour - beepObj = new Audio('local:///chrome/plugin/org.apache.cordova.dialogs/notification-beep.wav'); - beepObj.addEventListener("ended", callback); - beepObj.play(); - }, - callback = function () { - if (--count > 0) { - play(); - } else { - delete beepObj; - } - }; - count += quantity || 1; - if (count > 0) { - play(); - } -}; http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/blackberry10/notification-beep.wav ---------------------------------------------------------------------- diff --git a/www/blackberry10/notification-beep.wav b/www/blackberry10/notification-beep.wav deleted file mode 100644 index d0ad085..0000000 Binary files a/www/blackberry10/notification-beep.wav and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/danger-press.png ---------------------------------------------------------------------- diff --git a/www/firefoxos/danger-press.png b/www/firefoxos/danger-press.png deleted file mode 100644 index d7529b5..0000000 Binary files a/www/firefoxos/danger-press.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/danger.png ---------------------------------------------------------------------- diff --git a/www/firefoxos/danger.png b/www/firefoxos/danger.png deleted file mode 100644 index 400e3ae..0000000 Binary files a/www/firefoxos/danger.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/default.png ---------------------------------------------------------------------- diff --git a/www/firefoxos/default.png b/www/firefoxos/default.png deleted file mode 100644 index 2ff298a..0000000 Binary files a/www/firefoxos/default.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/gradient.png ---------------------------------------------------------------------- diff --git a/www/firefoxos/gradient.png b/www/firefoxos/gradient.png deleted file mode 100644 index b288545..0000000 Binary files a/www/firefoxos/gradient.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/notification.css ---------------------------------------------------------------------- diff --git a/www/firefoxos/notification.css b/www/firefoxos/notification.css deleted file mode 100644 index 34d92b8..0000000 --- a/www/firefoxos/notification.css +++ /dev/null @@ -1,248 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -/* Main dialog setup */ -form[role="dialog"] { - background: - url(../img/pattern.png) repeat left top, - url(../img/gradient.png) no-repeat left top / 100% 100%; - overflow: hidden; - position: absolute; - z-index: 100; - top: 0; - left: 0; - right: 0; - bottom: 0; - padding: 1.5rem 0 7rem; - font-family: "MozTT", Sans-serif; - font-size: 0; - /* Using font-size: 0; we avoid the unwanted visual space (about 3px) - created by white-spaces and break lines in the code betewen inline-block elements */ - color: #fff; - text-align: left; -} - -form[role="dialog"]:before { - content: ""; - display: inline-block; - vertical-align: middle; - width: 0.1rem; - height: 100%; - margin-left: -0.1rem; -} - -form[role="dialog"] > section { - font-weight: lighter; - font-size: 1.8rem; - color: #FAFAFA; - padding: 0 1.5rem; - -moz-box-sizing: padding-box; - width: 100%; - display: inline-block; - overflow-y: scroll; - max-height: 100%; - vertical-align: middle; - white-space: normal; -} - -form[role="dialog"] h1 { - font-weight: normal; - font-size: 1.6rem; - line-height: 1.5em; - color: #fff; - margin: 0; - padding: 0 1.5rem 1rem; - border-bottom: 0.1rem solid #686868; -} - -/* Menu & buttons setup */ -form[role="dialog"] menu { - margin: 0; - padding: 1.5rem; - padding-bottom: 0.5rem; - border-top: solid 0.1rem rgba(255, 255, 255, 0.1); - background: #2d2d2d url(../img/pattern.png) repeat left top; - display: block; - overflow: hidden; - position: absolute; - left: 0; - right: 0; - bottom: 0; - text-align: center; -} - -form[role="dialog"] menu button::-moz-focus-inner { - border: none; - outline: none; -} -form[role="dialog"] menu button { - width: 100%; - height: 2.4rem; - margin: 0 0 1rem; - padding: 0 1.5rem; - -moz-box-sizing: border-box; - display: inline-block; - vertical-align: middle; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - background: #fafafa url(../img/default.png) repeat-x left bottom/ auto 100%; - border: 0.1rem solid #a6a6a6; - border-radius: 0.3rem; - font: 500 1.2rem/2.4rem 'MozTT', Sans-serif; - color: #333; - text-align: center; - text-shadow: 0.1rem 0.1rem 0 rgba(255,255,255,0.3); - text-decoration: none; - outline: none; -} - -/* Press (default & recommend) */ -form[role="dialog"] menu button:active, -form[role="dialog"] menu button.recommend:active, -a.recommend[role="button"]:active { - border-color: #008aaa; - color: #333; -} - -/* Recommend */ -form[role="dialog"] menu button.recommend { - background-image: url(../img/recommend.png); - background-color: #00caf2; - border-color: #008eab; -} - -/* Danger */ -form[role="dialog"] menu button.danger, -a.danger[role="button"] { - background-image: url(../img/danger.png); - background-color: #b70404; - color: #fff; - text-shadow: none; - border-color: #820000; -} - -/* Danger Press */ -form[role="dialog"] menu button.danger:active { - background-image: url(../img/danger-press.png); - background-color: #890707; -} - -/* Disabled */ -form[role="dialog"] > menu > button[disabled] { - background: #5f5f5f; - color: #4d4d4d; - text-shadow: none; - border-color: #4d4d4d; - pointer-events: none; -} - - -form[role="dialog"] menu button:nth-child(even) { - margin-left: 1rem; -} - -form[role="dialog"] menu button, -form[role="dialog"] menu button:nth-child(odd) { - margin: 0 0 1rem 0; -} - -form[role="dialog"] menu button { - width: calc((100% - 1rem) / 2); -} - -form[role="dialog"] menu button.full { - width: 100%; -} - -/* Specific component code */ -form[role="dialog"] p { - word-wrap: break-word; - margin: 1rem 0 0; - padding: 0 1.5rem 1rem; - line-height: 3rem; -} - -form[role="dialog"] p img { - float: left; - margin-right: 2rem; -} - -form[role="dialog"] p strong { - font-weight: lighter; -} - -form[role="dialog"] p small { - font-size: 1.4rem; - font-weight: normal; - color: #cbcbcb; - display: block; -} - -form[role="dialog"] dl { - border-top: 0.1rem solid #686868; - margin: 1rem 0 0; - overflow: hidden; - padding-top: 1rem; - font-size: 1.6rem; - line-height: 2.2rem; -} - -form[role="dialog"] dl > dt { - clear: both; - float: left; - width: 7rem; - padding-left: 1.5rem; - font-weight: 500; - text-align: left; -} - -form[role="dialog"] dl > dd { - padding-right: 1.5rem; - font-weight: 300; - text-overflow: ellipsis; - vertical-align: top; - overflow: hidden; -} - -/* input areas */ -input[type="text"], -input[type="password"], -input[type="email"], -input[type="tel"], -input[type="search"], -input[type="url"], -input[type="number"], -textarea { - -moz-box-sizing: border-box; - display: block; - overflow: hidden; - width: 100%; - height: 3rem; - resize: none; - padding: 0 1rem; - font-size: 1.6rem; - line-height: 3rem; - border: 0.1rem solid #ccc; - border-radius: 0.3rem; - box-shadow: none; /* override the box-shadow from the system (performance issue) */ - background: #fff url(input_areas/images/ui/shadow.png) repeat-x; -} http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/pattern.png ---------------------------------------------------------------------- diff --git a/www/firefoxos/pattern.png b/www/firefoxos/pattern.png deleted file mode 100644 index af03f56..0000000 Binary files a/www/firefoxos/pattern.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/firefoxos/recommend.png ---------------------------------------------------------------------- diff --git a/www/firefoxos/recommend.png b/www/firefoxos/recommend.png deleted file mode 100644 index 42aed39..0000000 Binary files a/www/firefoxos/recommend.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/3d51112b/www/notification.js ---------------------------------------------------------------------- diff --git a/www/notification.js b/www/notification.js deleted file mode 100644 index 23bcf18..0000000 --- a/www/notification.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -var exec = require('cordova/exec'); -var platform = require('cordova/platform'); - -/** - * Provides access to notifications on the device. - */ - -module.exports = { - - /** - * Open a native alert dialog, with a customizable title and button text. - * - * @param {String} message Message to print in the body of the alert - * @param {Function} completeCallback The callback that is called when user clicks on a button. - * @param {String} title Title of the alert dialog (default: Alert) - * @param {String} buttonLabel Label of the close button (default: OK) - */ - alert: function(message, completeCallback, title, buttonLabel) { - var _title = (title || "Alert"); - var _buttonLabel = (buttonLabel || "OK"); - exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]); - }, - - /** - * Open a native confirm dialog, with a customizable title and button text. - * The result that the user selects is returned to the result callback. - * - * @param {String} message Message to print in the body of the alert - * @param {Function} resultCallback The callback that is called when user clicks on a button. - * @param {String} title Title of the alert dialog (default: Confirm) - * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel']) - */ - confirm: function(message, resultCallback, title, buttonLabels) { - var _title = (title || "Confirm"); - var _buttonLabels = (buttonLabels || ["OK", "Cancel"]); - - // Strings are deprecated! - if (typeof _buttonLabels === 'string') { - console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array)."); - } - - // Some platforms take an array of button label names. - // Other platforms take a comma separated list. - // For compatibility, we convert to the desired type based on the platform. - if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "ubuntu") { - if (typeof _buttonLabels === 'string') { - var buttonLabelString = _buttonLabels; - _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here - } - } else { - if (Array.isArray(_buttonLabels)) { - var buttonLabelArray = _buttonLabels; - _buttonLabels = buttonLabelArray.toString(); - } - } - exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]); - }, - - /** - * Open a native prompt dialog, with a customizable title and button text. - * The following results are returned to the result callback: - * buttonIndex Index number of the button selected. - * input1 The text entered in the prompt dialog box. - * - * @param {String} message Dialog message to display (default: "Prompt message") - * @param {Function} resultCallback The callback that is called when user clicks on a button. - * @param {String} title Title of the dialog (default: "Prompt") - * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"]) - * @param {String} defaultText Textbox input value (default: empty string) - */ - prompt: function(message, resultCallback, title, buttonLabels, defaultText) { - var _message = (message || "Prompt message"); - var _title = (title || "Prompt"); - var _buttonLabels = (buttonLabels || ["OK","Cancel"]); - var _defaultText = (defaultText || ""); - exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]); - }, - - /** - * Causes the device to beep. - * On Android, the default notification ringtone is played "count" times. - * - * @param {Integer} count The number of beeps. - */ - beep: function(count) { - exec(null, null, "Notification", "beep", [count]); - } -};
