// Path: app/src/main/java/team6/iguide/BusLocation/BusLocation.java
// public class BusLocation {
// 
//     @SerializedName("get_vehicles")
//     @Expose
//     private List<GetVehicle> getVehicles = new ArrayList<GetVehicle>();
// 
//     /**
//      *
//      * @return
//      * The getVehicles
//      */
//     public List<GetVehicle> getGetVehicles() {
//         return getVehicles;
//     }
// 
//     /**
//      *
//      * @param getVehicles
//      * The get_vehicles
//      */
//     public void setGetVehicles(List<GetVehicle> getVehicles) {
//         this.getVehicles = getVehicles;
//     }
// 
// }
// 
// Path: app/src/main/java/team6/iguide/IssueDataModel/IssueDataModel.java
// public class IssueDataModel {
// 
//     @SerializedName("markers")
//     @Expose
//     private List<IssueMarker> markers = new ArrayList<IssueMarker>();
// 
//     public List<IssueMarker> getMarkers() {
//         return markers;
//     }
// 
//     public void setMarkers(List<IssueMarker> markers) {
//         this.markers = markers;
//     }
// 
// }


import android.app.ActionBar;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.os.Handler;
import android.provider.SearchRecentSuggestions;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ExpandableListView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.gson.Gson;
import com.mapbox.mapboxsdk.api.ILatLng;
import com.mapbox.mapboxsdk.events.DelayedMapListener;
import com.mapbox.mapboxsdk.events.MapListener;
import com.mapbox.mapboxsdk.events.RotateEvent;
import com.mapbox.mapboxsdk.events.ScrollEvent;
import com.mapbox.mapboxsdk.events.ZoomEvent;
import com.mapbox.mapboxsdk.geometry.BoundingBox;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.overlay.MapEventsOverlay;
import com.mapbox.mapboxsdk.overlay.MapEventsReceiver;
import com.mapbox.mapboxsdk.overlay.Marker;
import com.mapbox.mapboxsdk.overlay.TilesOverlay;
import com.mapbox.mapboxsdk.tileprovider.MapTileLayerBase;
import com.mapbox.mapboxsdk.tileprovider.MapTileLayerBasic;
import com.mapbox.mapboxsdk.tileprovider.tilesource.MapboxTileLayer;
import com.mapbox.mapboxsdk.views.MapView;
import org.json.JSONObject;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import team6.iguide.BusLocation.BusLocation;
import team6.iguide.IssueDataModel.IssueDataModel;
                ), true, true);
                break;
            case 4:
                mv.getOverlays().add(0, erpExpressTiles);
                padding = 0.005;
                mv.zoomToBoundingBox(new BoundingBox(
                        29.72886830436441 + padding, // North
                        -95.32023668289185 + padding, // East
                        29.716345843815365 - padding,// South
                        -95.34223079681395 - padding // West
                ), true, true);
                break;
        }
        // Refresh map so it shows the overlay
        mv.invalidate();
    }

    @SuppressWarnings("unchecked")
    private void updateCurrentBusLocation(String URI, final int busRoute) {
        // This method is used to fetch json, parse it, and then update/create the list that tells
        // where to move the bus markers next.

        // we begin by fetching the json data using volley
        JsonObjectRequest req = new JsonObjectRequest(URI, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {

                // Parse the JSON response
                Gson gson = new Gson();
                String busData = response.toString();
// Path: app/src/main/java/team6/iguide/BusLocation/BusLocation.java
// public class BusLocation {
// 
//     @SerializedName("get_vehicles")
//     @Expose
//     private List<GetVehicle> getVehicles = new ArrayList<GetVehicle>();
// 
//     /**
//      *
//      * @return
//      * The getVehicles
//      */
//     public List<GetVehicle> getGetVehicles() {
//         return getVehicles;
//     }
// 
//     /**
//      *
//      * @param getVehicles
//      * The get_vehicles
//      */
//     public void setGetVehicles(List<GetVehicle> getVehicles) {
//         this.getVehicles = getVehicles;
//     }
// 
// }
// 
// Path: app/src/main/java/team6/iguide/IssueDataModel/IssueDataModel.java
// public class IssueDataModel {
// 
//     @SerializedName("markers")
//     @Expose
//     private List<IssueMarker> markers = new ArrayList<IssueMarker>();
// 
//     public List<IssueMarker> getMarkers() {
//         return markers;
//     }
// 
//     public void setMarkers(List<IssueMarker> markers) {
//         this.markers = markers;
//     }
// 
// }


// Path: app/src/main/java/team6/iguide/MainActivity.java
import android.app.ActionBar;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.os.Handler;
import android.provider.SearchRecentSuggestions;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ExpandableListView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.gson.Gson;
import com.mapbox.mapboxsdk.api.ILatLng;
import com.mapbox.mapboxsdk.events.DelayedMapListener;
import com.mapbox.mapboxsdk.events.MapListener;
import com.mapbox.mapboxsdk.events.RotateEvent;
import com.mapbox.mapboxsdk.events.ScrollEvent;
import com.mapbox.mapboxsdk.events.ZoomEvent;
import com.mapbox.mapboxsdk.geometry.BoundingBox;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.overlay.MapEventsOverlay;
import com.mapbox.mapboxsdk.overlay.MapEventsReceiver;
import com.mapbox.mapboxsdk.overlay.Marker;
import com.mapbox.mapboxsdk.overlay.TilesOverlay;
import com.mapbox.mapboxsdk.tileprovider.MapTileLayerBase;
import com.mapbox.mapboxsdk.tileprovider.MapTileLayerBasic;
import com.mapbox.mapboxsdk.tileprovider.tilesource.MapboxTileLayer;
import com.mapbox.mapboxsdk.views.MapView;
import org.json.JSONObject;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import team6.iguide.BusLocation.BusLocation;
import team6.iguide.IssueDataModel.IssueDataModel;

                ), true, true);
                break;
            case 4:
                mv.getOverlays().add(0, erpExpressTiles);
                padding = 0.005;
                mv.zoomToBoundingBox(new BoundingBox(
                        29.72886830436441 + padding, // North
                        -95.32023668289185 + padding, // East
                        29.716345843815365 - padding,// South
                        -95.34223079681395 - padding // West
                ), true, true);
                break;
        }
        // Refresh map so it shows the overlay
        mv.invalidate();
    }

    @SuppressWarnings("unchecked")
    private void updateCurrentBusLocation(String URI, final int busRoute) {
        // This method is used to fetch json, parse it, and then update/create the list that tells
        // where to move the bus markers next.

        // we begin by fetching the json data using volley
        JsonObjectRequest req = new JsonObjectRequest(URI, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {

                // Parse the JSON response
                Gson gson = new Gson();
                String busData = response.toString();
                BusLocation busInfo = gson.fromJson(busData, BusLocation.class);