// Path: adal-location/src/main/java/com/massivedisaster/location/listener/OnLocationManager.java
// public interface OnLocationManager {
// 
//     /**
//      * Called if location manager retrieve the user position
//      *
//      * @param location           The user location
//      * @param isLastKnowLocation True if a location its given from the last know position
//      */
//     void onLocationFound(Location location, boolean isLastKnowLocation);
// 
//     /**
//      * Called if the request gives an error
//      *
//      * @param locationError The location error
//      */
//     void onLocationError(LocationError locationError);
// 
//     /**
//      * Called if user don't permissions to get location
//      */
//     void onPermissionsDenied();
// 
//     /**
//      * Called if provider is enabled
//      */
//     void onProviderEnabled();
// 
//     /**
//      * Called if provider is disabled
//      */
//     void onProviderDisabled();
// 
//     /**
//      * Called if location manager stop request update
//      */
//     void onStopRequestUpdate();
// }
// 
// Path: adal-location/src/main/java/com/massivedisaster/location/utils/LocationError.java
// public enum LocationError {
//     TIMEOUT,
//     DISABLED,
//     REQUEST_NEEDED,
//     REQUEST_UPDATES_ENABLED
// }


import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationSettingsResponse;
import com.google.android.gms.location.LocationSettingsStatusCodes;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.massivedisaster.location.listener.OnLocationManager;
import com.massivedisaster.location.utils.LocationError;
import android.content.IntentSender;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.util.Log;
                            if (mOnLocationManager != null) {
                                mOnLocationManager.onLocationError(LocationError.DISABLED);
                            }
                        }
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        int statusCode = ((ApiException) e).getStatusCode();
                        switch (statusCode) {
                            case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
                                try {
                                    if (getActivity() != null) {
                                        ResolvableApiException rae = (ResolvableApiException) e;
                                        rae.startResolutionForResult(getActivity(), REQUEST_CHECK_SETTINGS);
                                    }
                                } catch (IntentSender.SendIntentException e1) {
                                    Log.e(getClass().getSimpleName(), e1.toString());
                                }
                                mRequestingLocationUpdates = false;
                                if (mOnLocationManager != null) {
                                    mOnLocationManager.onProviderDisabled();
                                }
                                break;
                            default:
                                mRequestingLocationUpdates = false;
                                if (mOnLocationManager != null) {
                                    mOnLocationManager.onLocationError(LocationError.DISABLED);
                                }
// Path: adal-location/src/main/java/com/massivedisaster/location/listener/OnLocationManager.java
// public interface OnLocationManager {
// 
//     /**
//      * Called if location manager retrieve the user position
//      *
//      * @param location           The user location
//      * @param isLastKnowLocation True if a location its given from the last know position
//      */
//     void onLocationFound(Location location, boolean isLastKnowLocation);
// 
//     /**
//      * Called if the request gives an error
//      *
//      * @param locationError The location error
//      */
//     void onLocationError(LocationError locationError);
// 
//     /**
//      * Called if user don't permissions to get location
//      */
//     void onPermissionsDenied();
// 
//     /**
//      * Called if provider is enabled
//      */
//     void onProviderEnabled();
// 
//     /**
//      * Called if provider is disabled
//      */
//     void onProviderDisabled();
// 
//     /**
//      * Called if location manager stop request update
//      */
//     void onStopRequestUpdate();
// }
// 
// Path: adal-location/src/main/java/com/massivedisaster/location/utils/LocationError.java
// public enum LocationError {
//     TIMEOUT,
//     DISABLED,
//     REQUEST_NEEDED,
//     REQUEST_UPDATES_ENABLED
// }


// Path: adal-location/src/main/java/com/massivedisaster/location/LocationManager.java
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationSettingsResponse;
import com.google.android.gms.location.LocationSettingsStatusCodes;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.massivedisaster.location.listener.OnLocationManager;
import com.massivedisaster.location.utils.LocationError;
import android.content.IntentSender;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.util.Log;

                            if (mOnLocationManager != null) {
                                mOnLocationManager.onLocationError(LocationError.DISABLED);
                            }
                        }
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        int statusCode = ((ApiException) e).getStatusCode();
                        switch (statusCode) {
                            case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
                                try {
                                    if (getActivity() != null) {
                                        ResolvableApiException rae = (ResolvableApiException) e;
                                        rae.startResolutionForResult(getActivity(), REQUEST_CHECK_SETTINGS);
                                    }
                                } catch (IntentSender.SendIntentException e1) {
                                    Log.e(getClass().getSimpleName(), e1.toString());
                                }
                                mRequestingLocationUpdates = false;
                                if (mOnLocationManager != null) {
                                    mOnLocationManager.onProviderDisabled();
                                }
                                break;
                            default:
                                mRequestingLocationUpdates = false;
                                if (mOnLocationManager != null) {
                                    mOnLocationManager.onLocationError(LocationError.DISABLED);
                                }
                                break;