diff options
author | Struan Donald <struan@exo.org.uk> | 2012-06-08 18:13:49 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-06-08 18:13:49 +0100 |
commit | cac7b01b644ff1cc2f7c76afc920cb8f5149be82 (patch) | |
tree | 52ef00e121ef00313f81f14c21bb37a0ef9d48a3 /www/js | |
parent | 05aaf9c5263159ec64c565664dbc9a8053599dae (diff) |
basic busy indicator things for Android
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/mobile.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/www/js/mobile.js b/www/js/mobile.js index 26480a1..1c2c76b 100644 --- a/www/js/mobile.js +++ b/www/js/mobile.js @@ -58,6 +58,7 @@ function lookup_string(q) { q = q.replace(/\s+/, ' '); if (!q) { + if (navigator.notification.activityStop) { navigator.notification.activityStop(); } location_error("Please enter location"); return false; } @@ -104,7 +105,7 @@ function lookup_string(q) { } else { location_error("Could not find your location"); } - if (navigator.notificationEx) { navigator.notificationEx.loadingStop(); } + if (navigator.notification.activityStop) { navigator.notification.activityStop(); } }); } @@ -117,16 +118,18 @@ function locate() { return false; } - var loadingStart = function() {}; - var loadingStop = function() {}; - if (typeof navigator.notificationEx !== "undefined") { - loadingStart = navigator.notificationEx.loadingStart; - loadingStop = navigator.notificationEx.loadingStop; + var activityStart = function() {}; + var activityStop = function() {}; + if (typeof navigator.notification.activityStart !== "undefined") { + activityStart = navigator.notification.activityStart; + activityStop = navigator.notification.activityStop; } + activityStart(); if ( valid_postcode( pc ) ) { jQuery.get( CONFIG.MAPIT_URL + 'postcode/' + pc + '.json', function(data, status) { if ( status == 'success' ) { + activityStop(); show_around( data.wgs84_lat, data.wgs84_lon ); } else { } @@ -138,7 +141,7 @@ function locate() { } function foundLocation(myLocation) { - if (navigator.notificationEx) { navigator.notificationEx.loadingStop(); } + if (navigator.notification.activityStop) { navigator.notification.activityStop(); } var lat = myLocation.coords.latitude; var long = myLocation.coords.longitude; @@ -148,14 +151,14 @@ function foundLocation(myLocation) { function notFoundLocation() { location_error( 'Could not find location' ); } function getPosition() { - var loadingStart = function() {}; - var loadingStop = function() {}; + var activityStart = function() {}; + var activityStop = function() {}; - if (typeof navigator.notificationEx !== "undefined") { - loadingStart = navigator.notificationEx.loadingStart; - loadingStop = navigator.notificationEx.loadingStop; + if (typeof navigator.notification.activityStart !== "undefined") { + activityStart = navigator.notification.activityStart; + activityStop = navigator.notification.activityStop; } - loadingStart( { 'backgroundOpacity' : 0.5, labelText: 'Getting Location...', minDuration: 1 } ); + activityStart( ); navigator.geolocation.getCurrentPosition(foundLocation, notFoundLocation); } @@ -177,6 +180,7 @@ function delPhoto() { function takePhotoFail(message) { alert('There was a problem taking your photo'); + console.log('error taking picture: ' + message); } function takePhoto(type) { |