// Path: app/src/main/java/fyp/hkust/facet/model/Shop.java
// public class Shop implements Serializable{
// 
//     private String name, address, district, area, brandID, image;
//     private Double latitude, longitude;
// 
//     public Shop() {
//     }
// 
//     public Shop(String name, String address, String district, String area, String image, Double latitude, Double longitude) {
//         this.name = name;
//         this.address = address;
//         this.district = district;
//         this.area = area;
//         this.latitude = latitude;
//         this.longitude = longitude;
//         this.image = image;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getAddress() {
//         return address;
//     }
// 
//     public void setAddress(String address) {
//         this.address = address;
//     }
// 
//     public String getDistrict() {
//         return district;
//     }
// 
//     public void setDistrict(String district) {
//         this.district = district;
//     }
// 
//     public String getArea() {
//         return area;
//     }
// 
//     public void setArea(String area) {
//         this.area = area;
//     }
// 
//     public Double getLatitude() {
//         return latitude;
//     }
// 
//     public void setLatitude(Double latitude) {
//         this.latitude = latitude;
//     }
// 
//     public Double getLongitude() {
//         return longitude;
//     }
// 
//     public void setLongitude(Double longitude) {
//         this.longitude = longitude;
//     }
// 
//     public String getBrandID() {
//         return brandID;
//     }
// 
//     public void setBrandID(String brandID) {
//         this.brandID = brandID;
//     }
// 
//     public String getImage() {
//         return image;
//     }
// 
//     public void setImage(String image) {
//         this.image = image;
//     }
// }
// 
// Path: app/src/main/java/fyp/hkust/facet/util/FontManager.java
// public class FontManager {
// 
//     public static final String ROOT = "fonts/",
//             CUSTOM_FONT = "robotoLight.ttf",
//             APP_FONT = ROOT + "robotoLight.ttf",
//             TITLE_FONT = "Lobster.otf";
// 
//     public static Typeface getTypeface(Context context, String font) {
//         return Typeface.createFromAsset(context.getAssets(), font);
//     }
// 
//     public static void markAsIconContainer(View v, Typeface typeface) {
//         if (v instanceof ViewGroup) {
//             ViewGroup vg = (ViewGroup) v;
//             for (int i = 0; i < vg.getChildCount(); i++) {
//                 View child = vg.getChildAt(i);
//                 markAsIconContainer(child,typeface);
//             }
//         } else if (v instanceof TextView) {
//             ((TextView) v).setTypeface(typeface);
//         }
//     }
// 
// 
// }


import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.directions.route.AbstractRouting;
import com.directions.route.Route;
import com.directions.route.RouteException;
import com.directions.route.Routing;
import com.directions.route.RoutingListener;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
import fyp.hkust.facet.R;
import fyp.hkust.facet.model.Shop;
import fyp.hkust.facet.util.FontManager;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
////         Start marker
////        MarkerOptions options = new MarkerOptions();
////        options.position(start);
////        options.icon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue));
////        mMap.addMarker(options);
////
////        // End marker
////        options = new MarkerOptions();
////        options.position(end);
////        options.icon(BitmapDescriptorFactory.fromResource(R.drawable.end_green));
////        mMap.addMarker(options);
//
//    }

    @Override
    public void onRoutingFailure(RouteException e) {
        // The Routing request failed
//        progressDialog.dismiss();
//        if(e != null) {
//            Toast.makeText(this, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
//        }else {
//            Toast.makeText(this, "Something went wrong, Try again", Toast.LENGTH_SHORT).show();
//        }
    }

    @Override
    public void onRoutingCancelled() {
        Log.i("LOG_TAG", "Routing was cancelled.");
    }

// Path: app/src/main/java/fyp/hkust/facet/model/Shop.java
// public class Shop implements Serializable{
// 
//     private String name, address, district, area, brandID, image;
//     private Double latitude, longitude;
// 
//     public Shop() {
//     }
// 
//     public Shop(String name, String address, String district, String area, String image, Double latitude, Double longitude) {
//         this.name = name;
//         this.address = address;
//         this.district = district;
//         this.area = area;
//         this.latitude = latitude;
//         this.longitude = longitude;
//         this.image = image;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getAddress() {
//         return address;
//     }
// 
//     public void setAddress(String address) {
//         this.address = address;
//     }
// 
//     public String getDistrict() {
//         return district;
//     }
// 
//     public void setDistrict(String district) {
//         this.district = district;
//     }
// 
//     public String getArea() {
//         return area;
//     }
// 
//     public void setArea(String area) {
//         this.area = area;
//     }
// 
//     public Double getLatitude() {
//         return latitude;
//     }
// 
//     public void setLatitude(Double latitude) {
//         this.latitude = latitude;
//     }
// 
//     public Double getLongitude() {
//         return longitude;
//     }
// 
//     public void setLongitude(Double longitude) {
//         this.longitude = longitude;
//     }
// 
//     public String getBrandID() {
//         return brandID;
//     }
// 
//     public void setBrandID(String brandID) {
//         this.brandID = brandID;
//     }
// 
//     public String getImage() {
//         return image;
//     }
// 
//     public void setImage(String image) {
//         this.image = image;
//     }
// }
// 
// Path: app/src/main/java/fyp/hkust/facet/util/FontManager.java
// public class FontManager {
// 
//     public static final String ROOT = "fonts/",
//             CUSTOM_FONT = "robotoLight.ttf",
//             APP_FONT = ROOT + "robotoLight.ttf",
//             TITLE_FONT = "Lobster.otf";
// 
//     public static Typeface getTypeface(Context context, String font) {
//         return Typeface.createFromAsset(context.getAssets(), font);
//     }
// 
//     public static void markAsIconContainer(View v, Typeface typeface) {
//         if (v instanceof ViewGroup) {
//             ViewGroup vg = (ViewGroup) v;
//             for (int i = 0; i < vg.getChildCount(); i++) {
//                 View child = vg.getChildAt(i);
//                 markAsIconContainer(child,typeface);
//             }
//         } else if (v instanceof TextView) {
//             ((TextView) v).setTypeface(typeface);
//         }
//     }
// 
// 
// }


// Path: app/src/main/java/fyp/hkust/facet/activity/NearbyLocationActivity.java
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.directions.route.AbstractRouting;
import com.directions.route.Route;
import com.directions.route.RouteException;
import com.directions.route.Routing;
import com.directions.route.RoutingListener;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
import fyp.hkust.facet.R;
import fyp.hkust.facet.model.Shop;
import fyp.hkust.facet.util.FontManager;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;

////         Start marker
////        MarkerOptions options = new MarkerOptions();
////        options.position(start);
////        options.icon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue));
////        mMap.addMarker(options);
////
////        // End marker
////        options = new MarkerOptions();
////        options.position(end);
////        options.icon(BitmapDescriptorFactory.fromResource(R.drawable.end_green));
////        mMap.addMarker(options);
//
//    }

    @Override
    public void onRoutingFailure(RouteException e) {
        // The Routing request failed
//        progressDialog.dismiss();
//        if(e != null) {
//            Toast.makeText(this, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
//        }else {
//            Toast.makeText(this, "Something went wrong, Try again", Toast.LENGTH_SHORT).show();
//        }
    }

    @Override
    public void onRoutingCancelled() {
        Log.i("LOG_TAG", "Routing was cancelled.");
    }

    public void statusCheck() {