Updated Branches: refs/heads/master ee965b370 -> 2fe9fcabf
[CB-313] Enhanced Notification API missing Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/2fe9fcab Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/2fe9fcab Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/2fe9fcab Branch: refs/heads/master Commit: 2fe9fcabf2f55c5a44550b2e6c05f61273a91bd1 Parents: ee965b3 Author: Bryce Curtis <[email protected]> Authored: Fri Mar 23 14:06:38 2012 -0500 Committer: Bryce Curtis <[email protected]> Committed: Fri Mar 23 14:06:38 2012 -0500 ---------------------------------------------------------------------- lib/android/platform.js | 9 ++++ lib/android/plugin/android/notification.js | 53 +++++++++++++++++++++++ 2 files changed, 62 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2fe9fcab/lib/android/platform.js ---------------------------------------------------------------------- diff --git a/lib/android/platform.js b/lib/android/platform.js index 6c71820..c2dc309 100644 --- a/lib/android/platform.js +++ b/lib/android/platform.js @@ -127,5 +127,14 @@ module.exports = { MediaError: { // exists natively on Android WebView on Android 4.x path: "cordova/plugin/MediaError" } + }, + merges: { + navigator: { + children: { + notification: { + path: 'cordova/plugin/android/notification' + } + } + } } }; http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/2fe9fcab/lib/android/plugin/android/notification.js ---------------------------------------------------------------------- diff --git a/lib/android/plugin/android/notification.js b/lib/android/plugin/android/notification.js new file mode 100755 index 0000000..fe21d33 --- /dev/null +++ b/lib/android/plugin/android/notification.js @@ -0,0 +1,53 @@ +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 ]); + }, +}; \ No newline at end of file
