75 lines
2.2 KiB
JavaScript
75 lines
2.2 KiB
JavaScript
/*
|
|
*
|
|
* 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 ]);
|
|
}
|
|
};
|