diff --git a/api/android/lib/res/drawable-hdpi/button.png b/api/android/lib/res/drawable-hdpi/button.png
new file mode 100644
index 0000000000..423db24bf5
Binary files /dev/null and b/api/android/lib/res/drawable-hdpi/button.png differ
diff --git a/api/android/lib/res/drawable-hdpi/button_pressed.png b/api/android/lib/res/drawable-hdpi/button_pressed.png
new file mode 100644
index 0000000000..036791b512
Binary files /dev/null and b/api/android/lib/res/drawable-hdpi/button_pressed.png differ
diff --git a/api/android/lib/res/drawable-hdpi/logo.png b/api/android/lib/res/drawable-hdpi/logo.png
new file mode 100644
index 0000000000..74d9051fe1
Binary files /dev/null and b/api/android/lib/res/drawable-hdpi/logo.png differ
diff --git a/api/android/lib/res/drawable-ldpi/button.png b/api/android/lib/res/drawable-ldpi/button.png
new file mode 100644
index 0000000000..672b2266a6
Binary files /dev/null and b/api/android/lib/res/drawable-ldpi/button.png differ
diff --git a/api/android/lib/res/drawable-ldpi/button_pressed.png b/api/android/lib/res/drawable-ldpi/button_pressed.png
new file mode 100644
index 0000000000..0d76e072e7
Binary files /dev/null and b/api/android/lib/res/drawable-ldpi/button_pressed.png differ
diff --git a/api/android/lib/res/drawable-ldpi/logo.png b/api/android/lib/res/drawable-ldpi/logo.png
new file mode 100644
index 0000000000..232ffb163a
Binary files /dev/null and b/api/android/lib/res/drawable-ldpi/logo.png differ
diff --git a/api/android/lib/res/drawable-mdpi/button.png b/api/android/lib/res/drawable-mdpi/button.png
new file mode 100644
index 0000000000..3ed5455cc0
Binary files /dev/null and b/api/android/lib/res/drawable-mdpi/button.png differ
diff --git a/api/android/lib/res/drawable-mdpi/button_pressed.png b/api/android/lib/res/drawable-mdpi/button_pressed.png
new file mode 100644
index 0000000000..b1d4f8b86a
Binary files /dev/null and b/api/android/lib/res/drawable-mdpi/button_pressed.png differ
diff --git a/api/android/lib/res/drawable-mdpi/logo.png b/api/android/lib/res/drawable-mdpi/logo.png
new file mode 100644
index 0000000000..87e4ad28da
Binary files /dev/null and b/api/android/lib/res/drawable-mdpi/logo.png differ
diff --git a/api/android/lib/res/drawable-xhdpi/button.png b/api/android/lib/res/drawable-xhdpi/button.png
new file mode 100644
index 0000000000..5d37f7ce3b
Binary files /dev/null and b/api/android/lib/res/drawable-xhdpi/button.png differ
diff --git a/api/android/lib/res/drawable-xhdpi/button_pressed.png b/api/android/lib/res/drawable-xhdpi/button_pressed.png
new file mode 100644
index 0000000000..d93986f3c8
Binary files /dev/null and b/api/android/lib/res/drawable-xhdpi/button_pressed.png differ
diff --git a/api/android/lib/res/drawable-xhdpi/logo.png b/api/android/lib/res/drawable-xhdpi/logo.png
new file mode 100644
index 0000000000..6385ceab0d
Binary files /dev/null and b/api/android/lib/res/drawable-xhdpi/logo.png differ
diff --git a/api/android/lib/res/drawable-xxhdpi/button.png b/api/android/lib/res/drawable-xxhdpi/button.png
new file mode 100644
index 0000000000..f550647b71
Binary files /dev/null and b/api/android/lib/res/drawable-xxhdpi/button.png differ
diff --git a/api/android/lib/res/drawable-xxhdpi/button_pressed.png b/api/android/lib/res/drawable-xxhdpi/button_pressed.png
new file mode 100644
index 0000000000..5c24725eb2
Binary files /dev/null and b/api/android/lib/res/drawable-xxhdpi/button_pressed.png differ
diff --git a/api/android/lib/res/drawable-xxhdpi/logo.png b/api/android/lib/res/drawable-xxhdpi/logo.png
new file mode 100644
index 0000000000..1e085b02c4
Binary files /dev/null and b/api/android/lib/res/drawable-xxhdpi/logo.png differ
diff --git a/api/android/lib/res/drawable/background_pattern.xml b/api/android/lib/res/drawable/background_pattern.xml
new file mode 100644
index 0000000000..88af2b7dd1
--- /dev/null
+++ b/api/android/lib/res/drawable/background_pattern.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/api/android/lib/res/drawable/download_btn_selector.xml b/api/android/lib/res/drawable/download_btn_selector.xml
new file mode 100644
index 0000000000..f2018ba43c
--- /dev/null
+++ b/api/android/lib/res/drawable/download_btn_selector.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/api/android/lib/res/drawable/pattern.png b/api/android/lib/res/drawable/pattern.png
new file mode 100644
index 0000000000..33b8d96389
Binary files /dev/null and b/api/android/lib/res/drawable/pattern.png differ
diff --git a/api/android/lib/res/layout/dlg_install_mwm.xml b/api/android/lib/res/layout/dlg_install_mwm.xml
new file mode 100644
index 0000000000..1dc8905d2e
--- /dev/null
+++ b/api/android/lib/res/layout/dlg_install_mwm.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/android/lib/res/values/dimen.xml b/api/android/lib/res/values/dimen.xml
new file mode 100644
index 0000000000..7e88b862cf
--- /dev/null
+++ b/api/android/lib/res/values/dimen.xml
@@ -0,0 +1,5 @@
+
+
+ 24dp
+ 12dp
+
diff --git a/api/android/lib/res/values/strings.xml b/api/android/lib/res/values/strings.xml
new file mode 100644
index 0000000000..d3981d2203
--- /dev/null
+++ b/api/android/lib/res/values/strings.xml
@@ -0,0 +1,7 @@
+
+
+ http://www.mapswithme.com/get/
+ MapsWithMe
+ We have partnered with MapsWithMe to provide you with offline maps of the entire world.
+ To continue please\ndownload the app
+
diff --git a/api/android/lib/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java b/api/android/lib/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java
new file mode 100644
index 0000000000..648e473687
--- /dev/null
+++ b/api/android/lib/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java
@@ -0,0 +1,37 @@
+package com.mapswithme.maps.api;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.view.View;
+
+import com.mapwithme.maps.api.R;
+
+public class DownloadMapsWithMeDialog extends Dialog implements android.view.View.OnClickListener
+{
+
+ public DownloadMapsWithMeDialog(Context context)
+ {
+ super(context);
+
+ setTitle(R.string.mapswithme);
+ setContentView(R.layout.dlg_install_mwm);
+ findViewById(R.id.download).setOnClickListener(this);
+ }
+
+
+ public void onDownloadButtonClicked(){
+ Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(getContext().getString(R.string.downolad_url)));
+ getContext().startActivity(i);
+ dismiss();
+ }
+
+
+ @Override
+ public void onClick(View v)
+ {
+ if (v.getId() == R.id.download)
+ onDownloadButtonClicked();
+ }
+}
diff --git a/api/android/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java b/api/android/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java
index f456b211cc..99cac09135 100644
--- a/api/android/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java
+++ b/api/android/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java
@@ -1,15 +1,15 @@
package com.mapswithme.maps.api;
+import java.util.Locale;
+
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
-import android.widget.Toast;
-
-import java.util.Locale;
//TODO add javadoc for public interface
public final class MapsWithMeApi
@@ -20,7 +20,7 @@ public final class MapsWithMeApi
/**
* Shows single point on the map.
- *
+ *
* @param caller
* @param lat
* @param lon
@@ -30,12 +30,12 @@ public final class MapsWithMeApi
{
showPointsOnMap(caller, (String)null, (PendingIntent)null, new MWMPoint(lat, lon, name));
}
-
-
- /**
- * Shows single point on the map using specified
+
+
+ /**
+ * Shows single point on the map using specified
* zoom level in range from {@link MapsWithMeApi#ZOOM_MIN} to {@link MapsWithMeApi#ZOOM_MAX}.
- *
+ *
* @param caller
* @param lat
* @param lon
@@ -49,7 +49,7 @@ public final class MapsWithMeApi
/**
* Shows set of points on the map.
- *
+ *
* @param caller
* @param title
* @param points
@@ -62,7 +62,7 @@ public final class MapsWithMeApi
/**
* Shows set of points on the maps
* and allows MapsWithMeApplication to send {@link PendingIntent} provided by client application.
- *
+ *
* @param caller
* @param title
* @param pendingIntent
@@ -72,11 +72,11 @@ public final class MapsWithMeApi
{
showPointsOnMap(caller, title, -1, pendingIntent, points);
}
-
+
/**
* Detects if any version (Lite, Pro) of MapsWithMe, which supports
* API calls are installed on the device.
- *
+ *
* @param context
* @return
*/
@@ -85,16 +85,16 @@ public final class MapsWithMeApi
final Intent intent = new Intent(Const.ACTION_MWM_REQUEST);
return context.getPackageManager().resolveActivity(intent, 0) != null;
}
-
- // Internal only code
-
+
+ // Internal only code
+
private static void showPointsOnMap(Activity caller, String title, double zoomLevel, PendingIntent pendingIntent, MWMPoint... points)
{
final Intent mwmIntent = new Intent(Const.ACTION_MWM_REQUEST);
-
+
mwmIntent.putExtra(Const.EXTRA_URL, createMwmUrl(caller, title, zoomLevel, points).toString());
mwmIntent.putExtra(Const.EXTRA_TITLE, title);
-
+
final boolean hasIntent = pendingIntent != null;
mwmIntent.putExtra(Const.EXTRA_HAS_PENDING_INTENT, hasIntent);
if (hasIntent)
@@ -109,11 +109,13 @@ public final class MapsWithMeApi
mwmIntent.setClassName(aInfo.packageName, aInfo.name);
caller.startActivity(mwmIntent);
}
- //TODO this is temporally solution, add dialog
- else
- Toast.makeText(caller, "MapsWithMe is not installed.", Toast.LENGTH_LONG).show();
+ else
+ {
+ final DownloadMapsWithMeDialog dialog = new DownloadMapsWithMeDialog(caller);
+ dialog.show();
+ }
}
-
+
static StringBuilder createMwmUrl(Context context, String title, double zoomLevel, MWMPoint ... points)
{
StringBuilder urlBuilder = new StringBuilder("mapswithme://map?");
@@ -129,20 +131,20 @@ public final class MapsWithMeApi
appendIfNotNull(urlBuilder, "appname", title);
// zoom
appendIfNotNull(urlBuilder, "z", isValidZoomLevel(zoomLevel) ? String.valueOf(zoomLevel) : null);
-
+
// points
for (MWMPoint point : points)
{
if (point != null)
- {
+ {
urlBuilder.append("ll=")
.append(String.format(Locale.US, "%f,%f&", point.getLat(), point.getLon()));
-
+
appendIfNotNull(urlBuilder, "n", point.getName());
appendIfNotNull(urlBuilder, "u", point.getId());
}
}
-
+
return urlBuilder;
}
@@ -151,14 +153,14 @@ public final class MapsWithMeApi
return Const.CALLBACK_PREFIX + context.getPackageName();
}
- private static Intent addCommonExtras(Context context, Intent intent)
+ @SuppressLint("NewApi") private static Intent addCommonExtras(Context context, Intent intent)
{
intent.putExtra(Const.EXTRA_CALLER_APP_INFO, context.getApplicationInfo());
intent.putExtra(Const.EXTRA_API_VERSION, Const.API_VERSION);
return intent;
}
-
+
private static StringBuilder appendIfNotNull(StringBuilder builder, String key, String value)
{
if (value != null)
@@ -166,10 +168,10 @@ public final class MapsWithMeApi
.append("=")
.append(Uri.encode(value))
.append("&");
-
+
return builder;
}
-
+
private static boolean isValidZoomLevel(double zoom)
{
return zoom >= ZOOM_MIN && zoom <= ZOOM_MAX;