// Path: app/src/main/java/comcmput301f16t01/github/carrier/CarrierLocation.java
// public class CarrierLocation extends Location {
//     private String address;
//     private String shortAddress;
// 
//     public CarrierLocation() {
//         // get current location
//         super("");
//     }
// 
//     public CarrierLocation(double latitude, double longitude) {
//         super("");
//         this.setLatitude(latitude);
//         this.setLongitude(longitude);
//     }
// 
//     public String getAddress() {
//         return address;
//     }
// 
//     // see code attribution
//     public void setAddress(String address) {
//         if(!address.equals("")) {
//             this.address = address;
//             // short address is just the first line of the address string
//             this.shortAddress = address.split("\\r?\\n")[0];
//         }
//     }
// 
//     public String getShortAddress() {
//         return shortAddress;
//     }
// 
//     /**
//      * For use when an address is null. Returns a string of a lat/long tuple.
//      * @return String
//      */
//     public String getLatLong() {
//         return "(" + String.format("%.4f",getLatitude()) + ", " +
//                 String.format("%.4f",getLongitude()) + ")";
//     }
// 
//     @Override
//     public String toString() {
//         if(address != null) {
//             if(!address.equals("")) {
//                 return getAddress();
//             } else {
//                 return getLatLong();
//             }
//         } else {
//             return getLatLong();
//         }
//     }
// }


import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.AsyncTask;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Toast;
import com.google.gson.Gson;
import org.osmdroid.api.IMapController;
import org.osmdroid.bonuspack.routing.OSRMRoadManager;
import org.osmdroid.bonuspack.routing.Road;
import org.osmdroid.bonuspack.routing.RoadManager;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.BoundingBox;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.Marker;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayItem;
import org.osmdroid.views.overlay.Polyline;
import org.osmdroid.views.overlay.infowindow.BasicInfoWindow;
import java.util.ArrayList;
import java.util.List;
import comcmput301f16t01.github.carrier.CarrierLocation;
import comcmput301f16t01.github.carrier.R;
package comcmput301f16t01.github.carrier.Requests;




/**
 * <p>The ViewLocationsActivity allows the user to view on a map two start and end locations and
 * the route between them. Giving the user a better idea of what route they will be taking.</p>
 * </br>
 * <p>See code attribution in Wiki: <a href="https://github.com/CMPUT301F16T01/Carrier/wiki/Code-Re-Use#driverviewrequestactivity">DriverViewRequestActivity</a></p>
 * </br>
 * <p>Based on: <a href="https://github.com/MKergall/osmbonuspack/wiki/Tutorial_0">Tutorial_0</a></p>
 * <p>Author: MKergall</p>
 * <p>Retrieved on: November 10th, 2016</p>
 * </br>
 * <p>Updated with: <a href="http://stackoverflow.com/questions/38539637/osmbonuspack-roadmanager-networkonmainthreadexception">OSMBonuspack RoadManager NetworkOnMainThreadException</a></p>
 * <p>Author: <a href="http://stackoverflow.com/users/4670837/yubaraj-poudel">yubaraj poudel</a></p>
 * <p>Posted on: August 6th, 2016</p>
 * <p>Retrieved on: November 10th, 2016</p>
 * </br>
 * <p>Based on: <a href="http://stackoverflow.com/questions/20608590/osmdroid-zooming-to-show-the-whole-pathoverlay">OSMDroid: zooming to show the whole PathOverlay</a></p>
 * <p>Author: <a href="http://stackoverflow.com/users/6769091/thebugger">theBugger</a></p>
 * <p>Posted on: September 30th, 2016</p>
 * <p>Retrieved on: November 24th, 2016</p>
 */
public class ViewLocationsActivity extends AppCompatActivity {
    private final Activity activity = ViewLocationsActivity.this;
// Path: app/src/main/java/comcmput301f16t01/github/carrier/CarrierLocation.java
// public class CarrierLocation extends Location {
//     private String address;
//     private String shortAddress;
// 
//     public CarrierLocation() {
//         // get current location
//         super("");
//     }
// 
//     public CarrierLocation(double latitude, double longitude) {
//         super("");
//         this.setLatitude(latitude);
//         this.setLongitude(longitude);
//     }
// 
//     public String getAddress() {
//         return address;
//     }
// 
//     // see code attribution
//     public void setAddress(String address) {
//         if(!address.equals("")) {
//             this.address = address;
//             // short address is just the first line of the address string
//             this.shortAddress = address.split("\\r?\\n")[0];
//         }
//     }
// 
//     public String getShortAddress() {
//         return shortAddress;
//     }
// 
//     /**
//      * For use when an address is null. Returns a string of a lat/long tuple.
//      * @return String
//      */
//     public String getLatLong() {
//         return "(" + String.format("%.4f",getLatitude()) + ", " +
//                 String.format("%.4f",getLongitude()) + ")";
//     }
// 
//     @Override
//     public String toString() {
//         if(address != null) {
//             if(!address.equals("")) {
//                 return getAddress();
//             } else {
//                 return getLatLong();
//             }
//         } else {
//             return getLatLong();
//         }
//     }
// }


// Path: app/src/main/java/comcmput301f16t01/github/carrier/Requests/ViewLocationsActivity.java
import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.AsyncTask;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Toast;
import com.google.gson.Gson;
import org.osmdroid.api.IMapController;
import org.osmdroid.bonuspack.routing.OSRMRoadManager;
import org.osmdroid.bonuspack.routing.Road;
import org.osmdroid.bonuspack.routing.RoadManager;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.BoundingBox;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.Marker;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayItem;
import org.osmdroid.views.overlay.Polyline;
import org.osmdroid.views.overlay.infowindow.BasicInfoWindow;
import java.util.ArrayList;
import java.util.List;
import comcmput301f16t01.github.carrier.CarrierLocation;
import comcmput301f16t01.github.carrier.R;

package comcmput301f16t01.github.carrier.Requests;




/**
 * <p>The ViewLocationsActivity allows the user to view on a map two start and end locations and
 * the route between them. Giving the user a better idea of what route they will be taking.</p>
 * </br>
 * <p>See code attribution in Wiki: <a href="https://github.com/CMPUT301F16T01/Carrier/wiki/Code-Re-Use#driverviewrequestactivity">DriverViewRequestActivity</a></p>
 * </br>
 * <p>Based on: <a href="https://github.com/MKergall/osmbonuspack/wiki/Tutorial_0">Tutorial_0</a></p>
 * <p>Author: MKergall</p>
 * <p>Retrieved on: November 10th, 2016</p>
 * </br>
 * <p>Updated with: <a href="http://stackoverflow.com/questions/38539637/osmbonuspack-roadmanager-networkonmainthreadexception">OSMBonuspack RoadManager NetworkOnMainThreadException</a></p>
 * <p>Author: <a href="http://stackoverflow.com/users/4670837/yubaraj-poudel">yubaraj poudel</a></p>
 * <p>Posted on: August 6th, 2016</p>
 * <p>Retrieved on: November 10th, 2016</p>
 * </br>
 * <p>Based on: <a href="http://stackoverflow.com/questions/20608590/osmdroid-zooming-to-show-the-whole-pathoverlay">OSMDroid: zooming to show the whole PathOverlay</a></p>
 * <p>Author: <a href="http://stackoverflow.com/users/6769091/thebugger">theBugger</a></p>
 * <p>Posted on: September 30th, 2016</p>
 * <p>Retrieved on: November 24th, 2016</p>
 */
public class ViewLocationsActivity extends AppCompatActivity {
    private final Activity activity = ViewLocationsActivity.this;
    private CarrierLocation start = null;