mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
reorg of project assets
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
var Contact = function(){
|
||||
this.name = null;
|
||||
this.emails = [];
|
||||
this.phones = [];
|
||||
}
|
||||
|
||||
var ContactName = function()
|
||||
{
|
||||
this.formatted = "";
|
||||
this.familyName = "";
|
||||
this.givenName = "";
|
||||
this.additionalNames = [];
|
||||
this.prefixes = [];
|
||||
this.suffixes = [];
|
||||
}
|
||||
|
||||
|
||||
var ContactEmail = function()
|
||||
{
|
||||
this.types = [];
|
||||
this.address = "";
|
||||
}
|
||||
|
||||
var ContactPhoneNumber = function()
|
||||
{
|
||||
this.types = [];
|
||||
this.number = "";
|
||||
}
|
||||
|
||||
|
||||
var Contacts = function()
|
||||
{
|
||||
this.records = [];
|
||||
}
|
||||
|
||||
Contacts.prototype.find = function(obj, win, fail)
|
||||
{
|
||||
if(obj.name != null)
|
||||
{
|
||||
ContactHook.search(name, "", "");
|
||||
}
|
||||
this.win = win;
|
||||
this.fail = fail;
|
||||
}
|
||||
|
||||
Contacts.prototype.droidFoundContact = function(name, npa, email)
|
||||
{
|
||||
var contact = new Contact();
|
||||
contact.name = new ContactName();
|
||||
contact.name.formatted = name;
|
||||
contact.name.givenName = name;
|
||||
var mail = new ContactEmail();
|
||||
mail.types.push("home");
|
||||
mail.address = email;
|
||||
contact.emails.push(mail);
|
||||
phone = new ContactPhoneNumber();
|
||||
phone.types.push("home");
|
||||
phone.number = npa;
|
||||
contact.phones.push(phone);
|
||||
this.records.push(contact);
|
||||
}
|
||||
|
||||
Contacts.prototype.droidDone = function()
|
||||
{
|
||||
this.win(this.records);
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if(typeof navigator.contacts == "undefined") navigator.contacts = new Contacts();
|
||||
});
|
||||
Reference in New Issue
Block a user