// Path: core/src/main/java/com/novoda/location/Constants.java
// public interface Constants {
// 	
//     boolean USE_GPS = true;
//     boolean REFRESH_DATA_ON_LOCATION_CHANGED = true;
//     boolean ENABLE_PASSIVE_UPDATES = false;
//     
//     int UPDATES_MAX_DISTANCE = 100;
//     long UPDATES_MAX_TIME = 5 * 60 * 1000;
// 	
//     long DEFAULT_INTERVAL_PASSIVE = 15 * 60 * 1000;
// 	int DEFAULT_DISTANCE_PASSIVE = 300;
//     
//     String ACTIVE_LOCATION_UPDATE_ACTION = "com.novoda.location.ACTIVE_LOCATION_UPDATE_ACTION";
//     String ACTIVE_LOCATION_UPDATE_PROVIDER_DISABLED_ACTION = "com.novoda.location.ACTIVE_LOCATION_UPDATE_PROVIDER_DISABLED_ACTION";
//     String ACTIVE_LOCATION_UPDATE_PROVIDER_ENABLED_ACTION = "com.novoda.location.ACTIVE_LOCATION_UPDATE_PROVIDER_ENABLED_ACTION";
//     
// }
// 
// Path: core/src/main/java/com/novoda/location/LocatorFactory.java
// public class LocatorFactory {
// 	
// 	private static Locator instance; 
// 	
// 	public static Locator getInstance() {
// 		if(instance == null) {
// 			instance = new DefaultLocator();
// 		}
// 		return instance;
// 	}
// 
// 	public static void setLocation(Location location) {
// 		getInstance().setLocation(location);
// 	}
// 
// 	public static Location getLocation() {
// 		return getInstance().getLocation();
// 	}
// 	
// 	public static void reset() {
// 		instance = null;
// 	}
// 
// }


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import com.novoda.location.Constants;
import com.novoda.location.LocatorFactory;

/**
 * Copyright 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Code modified by Novoda Ltd, 2011.
 */
package com.novoda.location.receiver;



public class LocationChanged extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent i) {
    	if(i == null) {
    		return;
    	}
    	if(providerStatusHasChanged(i)){
    	    broadcastProviderStatusHasChanged(context, i);
    	}
    	
        if (locationHasChanged(i)) {

// Path: core/src/main/java/com/novoda/location/Constants.java
// public interface Constants {
// 	
//     boolean USE_GPS = true;
//     boolean REFRESH_DATA_ON_LOCATION_CHANGED = true;
//     boolean ENABLE_PASSIVE_UPDATES = false;
//     
//     int UPDATES_MAX_DISTANCE = 100;
//     long UPDATES_MAX_TIME = 5 * 60 * 1000;
// 	
//     long DEFAULT_INTERVAL_PASSIVE = 15 * 60 * 1000;
// 	int DEFAULT_DISTANCE_PASSIVE = 300;
//     
//     String ACTIVE_LOCATION_UPDATE_ACTION = "com.novoda.location.ACTIVE_LOCATION_UPDATE_ACTION";
//     String ACTIVE_LOCATION_UPDATE_PROVIDER_DISABLED_ACTION = "com.novoda.location.ACTIVE_LOCATION_UPDATE_PROVIDER_DISABLED_ACTION";
//     String ACTIVE_LOCATION_UPDATE_PROVIDER_ENABLED_ACTION = "com.novoda.location.ACTIVE_LOCATION_UPDATE_PROVIDER_ENABLED_ACTION";
//     
// }
// 
// Path: core/src/main/java/com/novoda/location/LocatorFactory.java
// public class LocatorFactory {
// 	
// 	private static Locator instance; 
// 	
// 	public static Locator getInstance() {
// 		if(instance == null) {
// 			instance = new DefaultLocator();
// 		}
// 		return instance;
// 	}
// 
// 	public static void setLocation(Location location) {
// 		getInstance().setLocation(location);
// 	}
// 
// 	public static Location getLocation() {
// 		return getInstance().getLocation();
// 	}
// 	
// 	public static void reset() {
// 		instance = null;
// 	}
// 
// }


// Path: core/src/main/java/com/novoda/location/receiver/LocationChanged.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import com.novoda.location.Constants;
import com.novoda.location.LocatorFactory;

/**
 * Copyright 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Code modified by Novoda Ltd, 2011.
 */
package com.novoda.location.receiver;



public class LocationChanged extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent i) {
    	if(i == null) {
    		return;
    	}
    	if(providerStatusHasChanged(i)){
    	    broadcastProviderStatusHasChanged(context, i);
    	}
    	
        if (locationHasChanged(i)) {

            LocatorFactory.setLocation(getLocation(i));
