You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2012/05/11 19:36:40 UTC
[1/13] android commit: Merging master into CordovaWebView
Updated Branches:
refs/heads/CordovaWebView f3e70c79e -> fc9cff7d2
Merging master into CordovaWebView
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/fc9cff7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/fc9cff7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/fc9cff7d
Branch: refs/heads/CordovaWebView
Commit: fc9cff7d26bf2308c2b626373f4ce82590c7ecf7
Parents: f3e70c7 6a628f7
Author: Joe Bowser <bo...@apache.org>
Authored: Fri May 11 10:36:17 2012 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri May 11 10:36:17 2012 -0700
----------------------------------------------------------------------
.gitignore | 1 +
README.md | 1 +
bin/package.json | 19 --
framework/assets/js/cordova.android.js | 33 +--
framework/project.properties | 2 +-
.../apache/cordova/CordovaLocationListener.java | 198 ++++++++++++
framework/src/org/apache/cordova/DroidGap.java | 4 +-
framework/src/org/apache/cordova/FileUtils.java | 3 +-
framework/src/org/apache/cordova/GeoBroker.java | 251 ++++++++-------
framework/src/org/apache/cordova/GeoListener.java | 133 --------
framework/src/org/apache/cordova/GpsListener.java | 163 ----------
.../src/org/apache/cordova/NetworkListener.java | 139 +--------
12 files changed, 362 insertions(+), 585 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/fc9cff7d/README.md
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/fc9cff7d/framework/assets/js/cordova.android.js
----------------------------------------------------------------------
diff --cc framework/assets/js/cordova.android.js
index f4a3478,7bb06c2..3b5c7d9
--- a/framework/assets/js/cordova.android.js
+++ b/framework/assets/js/cordova.android.js
@@@ -1,6 -1,6 +1,6 @@@
- // commit 9a080cc2704171a4169739b2c94ca55427b92f93
-// commit facaa38a0bd924aa15c14c372537c00382f1e593
++// commit 55e46cecd73e06a4866f084ffa8513219ef68421
- // File generated at :: Thu May 10 2012 15:48:14 GMT-0700 (PDT)
-// File generated at :: Thu May 10 2012 16:39:13 GMT-0700 (PDT)
++// File generated at :: Fri May 11 2012 10:34:50 GMT-0700 (PDT)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@@ -5182,7 -5172,7 +5172,7 @@@ window.cordova = require('cordova')
// Fire onDeviceReady event once all constructors have run and
// cordova info has been received from native side.
channel.join(function() {
-- channel.onDeviceReady.fire();
++ require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);
}, [ channel.onDOMContentLoaded, channel.onNativeReady ]);
@@@ -5201,4 -5191,4 +5191,5 @@@
}(window));
++
})();
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/fc9cff7d/framework/src/org/apache/cordova/DroidGap.java
----------------------------------------------------------------------
diff --cc framework/src/org/apache/cordova/DroidGap.java
index 1c832c4,5e2586d..9aa3a46
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@@ -659,10 -813,12 +659,10 @@@ public class DroidGap extends Activity
}
// Send pause event to JavaScript
- this.appView.loadUrl("javascript:try{cordova.require('cordova/channel').onPause.fire();}catch(e){console.log('exception firing pause event from native');};");
+ this.appView.loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};");
// Forward to plugins
- if (this.pluginManager != null) {
- this.pluginManager.onPause(this.keepRunning);
- }
+ appView.pluginManager.onPause(this.keepRunning);
// If app doesn't want to run in background
if (!this.keepRunning) {
@@@ -700,10 -858,12 +700,10 @@@
}
// Send resume event to JavaScript
- this.appView.loadUrl("javascript:try{cordova.require('cordova/channel').onResume.fire();}catch(e){console.log('exception firing resume event from native');};");
+ this.appView.loadUrl("javascript:try{cordova.fireDocumentEvent('resume');}catch(e){console.log('exception firing resume event from native');};");
// Forward to plugins
- if (this.pluginManager != null) {
- this.pluginManager.onResume(this.keepRunning || this.activityResultKeepRunning);
- }
+ appView.pluginManager.onResume(this.keepRunning || this.activityResultKeepRunning);
// If app doesn't want to run in background
if (!this.keepRunning || this.activityResultKeepRunning) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/fc9cff7d/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/fc9cff7d/framework/src/org/apache/cordova/NetworkListener.java
----------------------------------------------------------------------
diff --cc framework/src/org/apache/cordova/NetworkListener.java
index 1b70cd7,6eaa8ac..7d19259
--- a/framework/src/org/apache/cordova/NetworkListener.java
+++ b/framework/src/org/apache/cordova/NetworkListener.java
@@@ -16,138 -16,17 +16,17 @@@
specific language governing permissions and limitations
under the License.
*/
- package org.apache.cordova;
- import org.apache.cordova.api.CordovaInterface;
+ package org.apache.cordova;
- import android.content.Context;
- import android.location.Location;
import android.location.LocationManager;
- import android.location.LocationListener;
- import android.os.Bundle;
-
- public class NetworkListener implements LocationListener {
-
- private Context mCtx; // CordovaActivity object
-
- private LocationManager mLocMan; // Location manager object
- private GeoListener owner; // Geolistener object (parent)
- private boolean hasData = false; // Flag indicates if location data is available in cLoc
- private Location cLoc; // Last recieved location
- private boolean running = false; // Flag indicates if listener is running
-
- /**
- * Constructor.
- * Automatically starts listening.
- *
- * @param ctx
- * @param interval
- * @param m
- */
- public NetworkListener(Context ctx, int interval, GeoListener m) {
- this.owner = m;
- this.mCtx = ctx;
- this.mLocMan = (LocationManager) this.mCtx.getSystemService(Context.LOCATION_SERVICE);
- this.running = false;
- this.start(interval);
- }
-
- /**
- * Get last location.
- *
- * @return Location object
- */
- public Location getLocation() {
- this.cLoc = this.mLocMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (this.cLoc != null) {
- this.hasData = true;
- }
- return this.cLoc;
- }
-
- /**
- * Called when the provider is disabled by the user.
- *
- * @param provider
- */
- public void onProviderDisabled(String provider) {
- System.out.println("NetworkListener: The provider " + provider + " is disabled");
- }
-
- /**
- * Called when the provider is enabled by the user.
- *
- * @param provider
- */
- public void onProviderEnabled(String provider) {
- System.out.println("NetworkListener: The provider "+ provider + " is enabled");
- }
-
- /**
- * Called when the provider status changes. This method is called when a
- * provider is unable to fetch a location or if the provider has recently
- * become available after a period of unavailability.
- *
- * @param provider
- * @param status
- * @param extras
- */
- public void onStatusChanged(String provider, int status, Bundle extras) {
- System.out.println("NetworkListener: The status of the provider " + provider + " has changed");
- if (status == 0) {
- System.out.println("NetworkListener: " + provider + " is OUT OF SERVICE");
- }
- else if (status == 1) {
- System.out.println("NetworkListener: " + provider + " is TEMPORARILY_UNAVAILABLE");
- }
- else {
- System.out.println("NetworkListener: " + provider + " is Available");
- }
- }
- /**
- * Called when the location has changed.
- *
- * @param location
- */
- public void onLocationChanged(Location location) {
- System.out.println("NetworkListener: The location has been updated!");
- this.hasData = true;
- this.cLoc = location;
-
- // The GPS is the primary form of Geolocation in Cordova.
- // Only fire the success variables if the GPS is down for some reason.
- if (!this.owner.mGps.hasLocation()) {
- this.owner.success(location);
- }
- }
-
- /**
- * Start requesting location updates.
- *
- * @param interval
- */
- public void start(int interval) {
- if (!this.running) {
- this.running = true;
- this.mLocMan.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, interval, 0, this);
- this.getLocation();
-
- // If Network provider has data but GPS provider doesn't, then send ours
- if (this.hasData && !this.owner.mGps.hasLocation()) {
- this.owner.success(this.cLoc);
- }
- }
- }
-
- /**
- * Stop receiving location updates.
- */
- public void stop() {
- if (this.running) {
- this.mLocMan.removeUpdates(this);
- }
- this.running = false;
- }
-
+ /**
+ * This class handles requests for GPS location services.
+ *
+ */
+ public class NetworkListener extends CordovaLocationListener {
- public NetworkListener(LocationManager locationManager, GeoBroker m) {
- super(locationManager, m, "[Cordova NetworkListener]");
- }
++ public NetworkListener(LocationManager locationManager, GeoBroker m) {
++ super(locationManager, m, "[Cordova NetworkListener]");
++ }
}