[and] Url parsing from GWM.

This commit is contained in:
d-kunin 2013-08-18 21:57:31 +03:00
parent a1e3b2fc31
commit 68033ae0a5

View file

@ -27,6 +27,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
public final class MapsWithMeApi
@ -41,6 +42,19 @@ public final class MapsWithMeApi
*/
public static final double ZOOM_MIN = 1;
public static void showMapsWithMeUrl(Activity caller, PendingIntent pendingIntent, double zoomLevel, String url)
{
final Uri uri = Uri.parse(url);
final String latlon[] = uri.getQueryParameter("ll").split(",");
final double lat = Double.parseDouble(latlon[0]);
final double lon = Double.parseDouble(latlon[1]);
final String name = uri.getQueryParameter("n");
final String id = uri.getQueryParameter("id");
showPointsOnMap(caller, name, zoomLevel, pendingIntent, new MWMPoint(lat, lon, name, id));
}
public static void sendRequest(Activity caller, MwmRequest request)
{
final Intent mwmIntent = request.toIntent(caller);