// Path: app/src/main/java/com/chernandezgil/farmacias/Utilities/Constants.java
// public class Constants {
// 
//     public static final String SPACE = " ";
//     public static final String COMMA = ",";
//     public static final String CR = "\n";
//     public static final String EMPTY_STRING = "";
//     public static final String SEMI_COLON=":";
//     public static final int BOTTOM_NAVIGATION_HEIGHT=168;
// 
//     @Retention(RetentionPolicy.SOURCE)
//     @IntDef({SCROLL_DOWN, SCROLL_UP})
//     public @interface ScrollDirection {
//     }
// 
//     public static final int SCROLL_DOWN = 0;
//     public static final int SCROLL_UP = 1;
// 
//     @Retention(RetentionPolicy.SOURCE)
//     @IntDef({MAP_TAB,FAVORITE})
//     public @interface LayoutType {
//     }
// 
//     public static final int MAP_TAB = 0;
//     public static final int FAVORITE = 1;
// }
// 
// Path: app/src/main/java/com/chernandezgil/farmacias/model/Pharmacy.java
// public class Pharmacy extends PharmacyObjectMap implements Parcelable {
// 
//     private boolean optionsRow;
//     int circleColor;
// 
// 
// 
//     public Pharmacy() {
//     }
// 
//     public int getCircleColor() {
//         return circleColor;
//     }
// 
//     public void setCircleColor(int circleColor) {
//         this.circleColor = circleColor;
//     }
// 
//     public boolean isOptionsRow() {
//         return optionsRow;
//     }
// 
//     public void setOptionsRow(boolean optionsRow) {
//         this.optionsRow = optionsRow;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         super.writeToParcel(dest, flags);
//         dest.writeByte(this.optionsRow ? (byte) 1 : (byte) 0);
//         dest.writeInt(this.circleColor);
//     }
// 
//     protected Pharmacy(Parcel in) {
//         super(in);
//         this.optionsRow = in.readByte() != 0;
//         this.circleColor = in.readInt();
//     }
// 
//     public static final Creator<Pharmacy> CREATOR = new Creator<Pharmacy>() {
//         @Override
//         public Pharmacy createFromParcel(Parcel source) {
//             return new Pharmacy(source);
//         }
// 
//         @Override
//         public Pharmacy[] newArray(int size) {
//             return new Pharmacy[size];
//         }
//     };
// }


import android.content.Context;
import android.content.SharedPreferences;
import android.location.Location;
import android.preference.PreferenceManager;
import com.chernandezgil.farmacias.R;
import com.chernandezgil.farmacias.Utilities.Constants;
import com.chernandezgil.farmacias.model.Pharmacy;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
    @Override
    public void saveLocation(Location location) {
        //http://stackoverflow.com/questions/3604849/where-to-save-android-gps-latitude-longitude-points
//        mEditor.putLong(LAT_KEY, Double.doubleToLongBits(location.getLatitude()));
//        mEditor.putLong(LON_KEY,Double.doubleToLongBits(location.getLongitude()));
        String locationObject = location.getLatitude() + Constants.SEMI_COLON + location.getLongitude();
        mEditor.putString(LOCATION_KEY, locationObject);
        mEditor.apply();
    }

    @Override
    public Location getLocation() {
        Location location;
        String locationObject = mPrefs.getString(LOCATION_KEY, "0:0");
        String [] coordinates = locationObject.split(":");
        double latitud = Double.parseDouble(coordinates[0]);
        double longitud = Double.parseDouble(coordinates[1]);
        location = new Location(Constants.EMPTY_STRING);
        location.setLatitude(latitud);
        location.setLongitude(longitud);
        return location;

    }

    @Override
    public int getRadio() {
        return mPrefs.getInt(context.getString(R.string.seek_bar_key),2);
    }

    @Override
// Path: app/src/main/java/com/chernandezgil/farmacias/Utilities/Constants.java
// public class Constants {
// 
//     public static final String SPACE = " ";
//     public static final String COMMA = ",";
//     public static final String CR = "\n";
//     public static final String EMPTY_STRING = "";
//     public static final String SEMI_COLON=":";
//     public static final int BOTTOM_NAVIGATION_HEIGHT=168;
// 
//     @Retention(RetentionPolicy.SOURCE)
//     @IntDef({SCROLL_DOWN, SCROLL_UP})
//     public @interface ScrollDirection {
//     }
// 
//     public static final int SCROLL_DOWN = 0;
//     public static final int SCROLL_UP = 1;
// 
//     @Retention(RetentionPolicy.SOURCE)
//     @IntDef({MAP_TAB,FAVORITE})
//     public @interface LayoutType {
//     }
// 
//     public static final int MAP_TAB = 0;
//     public static final int FAVORITE = 1;
// }
// 
// Path: app/src/main/java/com/chernandezgil/farmacias/model/Pharmacy.java
// public class Pharmacy extends PharmacyObjectMap implements Parcelable {
// 
//     private boolean optionsRow;
//     int circleColor;
// 
// 
// 
//     public Pharmacy() {
//     }
// 
//     public int getCircleColor() {
//         return circleColor;
//     }
// 
//     public void setCircleColor(int circleColor) {
//         this.circleColor = circleColor;
//     }
// 
//     public boolean isOptionsRow() {
//         return optionsRow;
//     }
// 
//     public void setOptionsRow(boolean optionsRow) {
//         this.optionsRow = optionsRow;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         super.writeToParcel(dest, flags);
//         dest.writeByte(this.optionsRow ? (byte) 1 : (byte) 0);
//         dest.writeInt(this.circleColor);
//     }
// 
//     protected Pharmacy(Parcel in) {
//         super(in);
//         this.optionsRow = in.readByte() != 0;
//         this.circleColor = in.readInt();
//     }
// 
//     public static final Creator<Pharmacy> CREATOR = new Creator<Pharmacy>() {
//         @Override
//         public Pharmacy createFromParcel(Parcel source) {
//             return new Pharmacy(source);
//         }
// 
//         @Override
//         public Pharmacy[] newArray(int size) {
//             return new Pharmacy[size];
//         }
//     };
// }


// Path: app/src/main/java/com/chernandezgil/farmacias/ui/adapter/PreferencesManagerImp.java
import android.content.Context;
import android.content.SharedPreferences;
import android.location.Location;
import android.preference.PreferenceManager;
import com.chernandezgil.farmacias.R;
import com.chernandezgil.farmacias.Utilities.Constants;
import com.chernandezgil.farmacias.model.Pharmacy;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

    @Override
    public void saveLocation(Location location) {
        //http://stackoverflow.com/questions/3604849/where-to-save-android-gps-latitude-longitude-points
//        mEditor.putLong(LAT_KEY, Double.doubleToLongBits(location.getLatitude()));
//        mEditor.putLong(LON_KEY,Double.doubleToLongBits(location.getLongitude()));
        String locationObject = location.getLatitude() + Constants.SEMI_COLON + location.getLongitude();
        mEditor.putString(LOCATION_KEY, locationObject);
        mEditor.apply();
    }

    @Override
    public Location getLocation() {
        Location location;
        String locationObject = mPrefs.getString(LOCATION_KEY, "0:0");
        String [] coordinates = locationObject.split(":");
        double latitud = Double.parseDouble(coordinates[0]);
        double longitud = Double.parseDouble(coordinates[1]);
        location = new Location(Constants.EMPTY_STRING);
        location.setLatitude(latitud);
        location.setLongitude(longitud);
        return location;

    }

    @Override
    public int getRadio() {
        return mPrefs.getInt(context.getString(R.string.seek_bar_key),2);
    }

    @Override
    public void saveFavoriteList(List<Pharmacy> list) {