package com.quickblox.q_municate_core.utils;

import android.net.Uri;

import com.google.gson.Gson;

public class MapUtils {
    private static final String URI_SCHEME_MAP = "https://maps.googleapis.com/maps/api/staticmap?";
    private static final String ZOOM = "15";
    private static final String SIZE = "600x300";
    private static final String MAPTYPE = "roadmap";
    private static final String COLOR = "blue";
    //api static map key should be generated in your developers google console
    private static final String KEY = "AIzaSyC68nhqEWQaXQJqr422kpimzR7XuJuRndg";

    public static final String EXTRA_LOCATION_LATITUDE = "location_latitude";
    public static final String EXTRA_LOCATION_LONGITUDE = "location_longitude";

    private static String generateURI(double latitude, double longitude) {
        Uri.Builder builder = new Uri.Builder();
        builder.appendQueryParameter("zoom", ZOOM)
                .appendQueryParameter("size", SIZE)
                .appendQueryParameter("maptype", MAPTYPE)
                .appendQueryParameter("markers", "color:" + COLOR + "%7Clabel:S%7C" + latitude + "," + longitude)
                .appendQueryParameter("key", KEY);

        return URI_SCHEME_MAP + builder.build().getQuery();
    }

    public static String generateLocationData(double latitude, double longitude) {
//         "data":"{\"lat\":\"50.014141\",\"lng\":\"36.229058\"}"
        String s = "";
        return s;
    }

    public static String getRemoteUri(String location) {
        String locations = "\"lat\":\"50.014141\",\"lng\":\"36.229058\"";
        //"lat":"50.014141","lng":"36.229058"
        String lat = location.substring(7, 16);
        String lng = location.substring(25, 34);
        Gson gson = new Gson();

        return generateURI().replaceAll("&amp;(?!&)", "&");
    }
}
@@ -92,16 +92,86 @@
 on.Gson;
+%0Aimport com.google.gson.JsonObject;%0Aimport com.google.gson.JsonParser;
 %0A%0Apublic
@@ -1483,39 +1483,222 @@
     
-String s = %22%22;%0A        return s
+JsonObject innerObject = new JsonObject();%0A        innerObject.addProperty(%22lat%22, String.valueOf(latitude));%0A        innerObject.addProperty(%22lng%22, String.valueOf(longitude));%0A%0A        return innerObject.toString()
 ;%0A  
@@ -1755,24 +1755,26 @@
 location) %7B%0A
+//
         Stri
@@ -1789,16 +1789,17 @@
 ions = %22
+%7B
 %5C%22lat%5C%22:
@@ -1833,16 +1833,17 @@
 229058%5C%22
+%7D
 %22;%0A     
@@ -1849,171 +1849,210 @@
     
-//%22lat%22:%2250.014141%22,%22lng%22:%2236.229058%22%0A        String lat = location.substring(7, 16);%0A        String lng = location.substring(25, 34);%0A        Gson gson = new Gson
+JsonParser jsonParser = new JsonParser();%0A        JsonObject jo = (JsonObject)jsonParser.parse(location);%0A        double lat = jo.get(%22lat%22).getAsDouble();%0A        double lng = jo.get(%22lng%22).getAsDouble
 ();%0A
@@ -2079,16 +2079,24 @@
 rateURI(
+lat, lng
 ).replac

update MapUtils