Merge branch 'master' of github.com:phonegap/phonegap-android

This commit is contained in:
brianleroux
2010-10-08 11:40:09 -07:00
7 changed files with 634 additions and 428 deletions
-9
View File
@@ -109,15 +109,6 @@ Contacts.prototype.create = function(properties) {
return contact;
};
Contacts.prototype.droidDone = function(contacts) {
this.win(eval('(' + contacts + ')'));
};
Contacts.prototype.m_foundContacts = function(win, contacts) {
this.inProgress = false;
win(contacts);
};
var ContactFindOptions = function(filter, multiple, limit, updatedSince) {
this.filter = filter || '';
this.multiple = multiple || true;
+56 -13
View File
@@ -6,40 +6,85 @@ function Notification() {
/**
* 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 {String} [title="Alert"] Title of the alert dialog (default: Alert)
* @param {String} [buttonLabel="OK"] Label of the close button (default: OK)
*
* @param {String} message Message to print in the body of the alert
* @param {String} title Title of the alert dialog (default: Alert)
* @param {String} buttonLabel Label of the close button (default: OK)
*/
Notification.prototype.alert = function(message, title, buttonLabel) {
var _title = (title || "Alert");
var _buttonLabel = (buttonLabel || "OK");
var _title = (title || "Alert");
var _buttonLabel = (buttonLabel || "OK");
PhoneGap.execAsync(null, null, "Notification", "alert", [message,_title,_buttonLabel]);
};
/**
* Open a native confirm dialog, with a customizable title and button text.
*
* @param {String} message Message to print in the body of the alert
* @param {String} title Title of the alert dialog (default: Confirm)
* @param {String} buttonLabels Comma separated list of the labels of the buttons (default: 'OK,Cancel')
* @return {Number} The index of the button clicked
*/
Notification.prototype.confirm = function(message, title, buttonLabels) {
var _title = (title || "Confirm");
var _buttonLabels = (buttonLabels || "OK,Cancel");
return PhoneGap.execAsync(null, null, "Notification", "confirm", [message,_title,_buttonLabels]);
};
/**
* Start spinning the activity indicator on the statusbar
*/
Notification.prototype.activityStart = function() {
PhoneGap.execAsync(null, null, "Notification", "activityStart", ["Busy","Please wait..."]);
};
/**
* Stop spinning the activity indicator on the statusbar, if it's currently spinning
*/
Notification.prototype.activityStop = function() {
PhoneGap.execAsync(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.
*/
Notification.prototype.progressStart = function(title, message) {
PhoneGap.execAsync(null, null, "Notification", "progressStart", [title, message]);
};
/**
* Set the progress dialog value.
*
* @param {Number} value 0-100
*/
Notification.prototype.progressValue = function(value) {
PhoneGap.execAsync(null, null, "Notification", "progressValue", [value]);
};
/**
* Close the progress dialog.
*/
Notification.prototype.progressStop = function() {
PhoneGap.execAsync(null, null, "Notification", "progressStop", []);
};
/**
* Causes the device to blink a status LED.
* @param {Integer} count The number of blinks.
* @param {String} colour The colour of the light.
*
* @param {Integer} count The number of blinks.
* @param {String} colour The colour of the light.
*/
Notification.prototype.blink = function(count, colour) {
// NOT IMPLEMENTED
};
/**
* Causes the device to vibrate.
* @param {Integer} mills The number of milliseconds to vibrate for.
*
* @param {Integer} mills The number of milliseconds to vibrate for.
*/
Notification.prototype.vibrate = function(mills) {
PhoneGap.execAsync(null, null, "Notification", "vibrate", [mills]);
@@ -47,16 +92,14 @@ Notification.prototype.vibrate = function(mills) {
/**
* Causes the device to beep.
* On Android, the default notification ringtone is played.
* On Android, the default notification ringtone is played "count" times.
*
* @param {Integer} count The number of beeps.
* @param {Integer} count The number of beeps.
*/
Notification.prototype.beep = function(count) {
PhoneGap.execAsync(null, null, "Notification", "beep", [count]);
};
// TODO: of course on Blackberry and Android there notifications in the UI as well
PhoneGap.addConstructor(function() {
if (typeof navigator.notification == "undefined") navigator.notification = new Notification();
});
+3
View File
@@ -245,6 +245,9 @@ PhoneGap.Channel.join(function() {
* received from native side.
*/
PhoneGap.Channel.join(function() {
// Turn off app loading dialog
navigator.notification.activityStop();
PhoneGap.onDeviceReady.fire();
// Fire the onresume event, since first one happens before JavaScript is loaded