Fixed small contacts and accelerometer object instantiation bugs. Added a bit more delay to PhoneGap constructor, 1ms caused issues sometimes I *think*.

This commit is contained in:
filmaj 2010-02-13 18:58:45 -08:00
parent 5255f63237
commit 76a8203176
4 changed files with 17 additions and 4 deletions

View File

@ -3,10 +3,11 @@ function Acceleration(x, y, z)
this.x = x;
this.y = y;
this.z = z;
this.timestamp = new Date().getTime();
}
// Need to define these for android
_accel = {}
_accel = {};
_accel.x = 0;
_accel.y = 0;
_accel.z = 0;

View File

@ -1,5 +1,5 @@
var Contact = function(){
this.name = null;
this.name = new ContactName();
this.emails = [];
this.phones = [];
}
@ -37,7 +37,18 @@ Contacts.prototype.find = function(obj, win, fail)
{
if(obj.name != null)
{
ContactHook.search(name, "", "");
// Build up the search term that we'll use in SQL, based on the structure/contents of the contact object passed into find.
var searchTerm = '';
if (obj.name.givenName && obj.name.givenName.length > 0) {
searchTerm = obj.name.givenName.split(' ').join('%');
}
if (obj.name.familyName && obj.name.familyName.length > 0) {
searchTerm += obj.name.familyName.split(' ').join('%');
}
if (!obj.name.familyName && !obj.name.givenName && obj.name.formatted) {
searchTerm = obj.name.formatted;
}
ContactHook.search(searchTerm, "", "");
}
this.win = win;
this.fail = fail;

View File

@ -89,6 +89,7 @@ Geolocation.prototype.gotCurrentPosition = function(lat, lng, alt, altacc, head,
{
coords = new Coordinates(lat, lng, alt, altacc, head, vel);
loc = new Position(coords, stamp);
this.lastPosition = loc;
this.global_success(loc);
}
}

View File

@ -72,7 +72,7 @@ PhoneGap.addConstructor = function(func) {
e.initEvent('deviceready');
document.dispatchEvent(e);
}
}, 1);
}, 5);
})();