From ba328f7cb9d8633b6a8e8d299a0f17715d4c9e17 Mon Sep 17 00:00:00 2001 From: d-kunin Date: Wed, 4 Sep 2013 19:31:42 +0300 Subject: [PATCH 1/6] [and] Pick point API feature. --- lib/AndroidManifest.xml | 5 +++++ lib/src/com/mapswithme/maps/api/Const.java | 1 + lib/src/com/mapswithme/maps/api/MapsWithMeApi.java | 9 +++++++++ lib/src/com/mapswithme/maps/api/MwmRequest.java | 9 +++++++++ 4 files changed, 24 insertions(+) diff --git a/lib/AndroidManifest.xml b/lib/AndroidManifest.xml index ed54f28..bc1f234 100644 --- a/lib/AndroidManifest.xml +++ b/lib/AndroidManifest.xml @@ -2,4 +2,9 @@ package="com.mapwithme.maps.api" android:versionCode="1" android:versionName="1.0" > + + + \ No newline at end of file diff --git a/lib/src/com/mapswithme/maps/api/Const.java b/lib/src/com/mapswithme/maps/api/Const.java index 3393e47..609f338 100644 --- a/lib/src/com/mapswithme/maps/api/Const.java +++ b/lib/src/com/mapswithme/maps/api/Const.java @@ -34,6 +34,7 @@ public class Const public static final String EXTRA_HAS_PENDING_INTENT = AUTHORITY + ".has_pen_intent"; public static final String EXTRA_CALLER_PENDING_INTENT = AUTHORITY + ".pending_intent"; public static final String EXTRA_RETURN_ON_BALLOON_CLICK = AUTHORITY + ".return_on_balloon_click"; + public static final String EXTRA_PICK_POINT = AUTHORITY + ".pick_point"; /* Response extras */ diff --git a/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java b/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java index 0600628..e7fd9cd 100644 --- a/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java +++ b/lib/src/com/mapswithme/maps/api/MapsWithMeApi.java @@ -135,6 +135,15 @@ public final class MapsWithMeApi sendRequest(caller, request); } + public static void pickPoint(Activity caller, String title, PendingIntent pi) + { + final MwmRequest request = new MwmRequest() + .setTitle(title) + .setPickPointMode(true) + .setPendingIntent(pi); + sendRequest(caller, request); + } + /** * Detects if any version (Lite, Pro) of MapsWithMe, which supports API calls * are installed on the device. diff --git a/lib/src/com/mapswithme/maps/api/MwmRequest.java b/lib/src/com/mapswithme/maps/api/MwmRequest.java index 61e53b6..10a65da 100644 --- a/lib/src/com/mapswithme/maps/api/MwmRequest.java +++ b/lib/src/com/mapswithme/maps/api/MwmRequest.java @@ -21,6 +21,7 @@ public class MwmRequest private String mTitle; private double mZoomLevel = 1; private boolean mReturnOnBalloonClick; + private boolean mPickPoint = false; // ** public MwmRequest setTitle(String title) @@ -29,6 +30,12 @@ public class MwmRequest return this; } + MwmRequest setPickPointMode(boolean pickPoint) + { + mPickPoint = pickPoint; + return this; + } + public MwmRequest addPoint(MWMPoint point) { mPoints.add(point); @@ -75,6 +82,8 @@ public class MwmRequest mwmIntent.putExtra(Const.EXTRA_TITLE, mTitle); // more mwmIntent.putExtra(Const.EXTRA_RETURN_ON_BALLOON_CLICK, mReturnOnBalloonClick); + // pick point + mwmIntent.putExtra(Const.EXTRA_PICK_POINT, mPickPoint); final boolean hasIntent = mPendingIntent != null; mwmIntent.putExtra(Const.EXTRA_HAS_PENDING_INTENT, hasIntent); From d78358d9360c6280d700e11b154511b3b962dba1 Mon Sep 17 00:00:00 2001 From: d-kunin Date: Mon, 9 Sep 2013 13:27:58 +0300 Subject: [PATCH 2/6] [build] Added gradle build script --- .gitignore | 2 ++ lib/build.gradle | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 lib/build.gradle diff --git a/.gitignore b/.gitignore index ecd80c9..dda549a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ bin/ gen/ +build/ .settings/ +.DS_Store .classpath .cproject .project diff --git a/lib/build.gradle b/lib/build.gradle new file mode 100644 index 0000000..070e6de --- /dev/null +++ b/lib/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'android-library' + +dependencies { + compile fileTree(dir: 'libs', include: '*.jar') +} + +android { + compileSdkVersion 18 + buildToolsVersion "18.0.1" + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + resources.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + } + + instrumentTest.setRoot('tests') + + debug.setRoot('build-types/debug') + release.setRoot('build-types/release') + } +} From 2c2d693b1f3c57062acfddb01655b365ec02801e Mon Sep 17 00:00:00 2001 From: d-kunin Date: Tue, 10 Sep 2013 13:19:44 +0300 Subject: [PATCH 3/6] [feature] custom button title support --- lib/src/com/mapswithme/maps/api/Const.java | 1 + lib/src/com/mapswithme/maps/api/MwmRequest.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/src/com/mapswithme/maps/api/Const.java b/lib/src/com/mapswithme/maps/api/Const.java index 609f338..72d0418 100644 --- a/lib/src/com/mapswithme/maps/api/Const.java +++ b/lib/src/com/mapswithme/maps/api/Const.java @@ -35,6 +35,7 @@ public class Const public static final String EXTRA_CALLER_PENDING_INTENT = AUTHORITY + ".pending_intent"; public static final String EXTRA_RETURN_ON_BALLOON_CLICK = AUTHORITY + ".return_on_balloon_click"; public static final String EXTRA_PICK_POINT = AUTHORITY + ".pick_point"; + public static final String EXTRA_CUSTOM_BUTTON_NAME = AUTHORITY + ".custom_button_name"; /* Response extras */ diff --git a/lib/src/com/mapswithme/maps/api/MwmRequest.java b/lib/src/com/mapswithme/maps/api/MwmRequest.java index 10a65da..b922828 100644 --- a/lib/src/com/mapswithme/maps/api/MwmRequest.java +++ b/lib/src/com/mapswithme/maps/api/MwmRequest.java @@ -22,15 +22,25 @@ public class MwmRequest private double mZoomLevel = 1; private boolean mReturnOnBalloonClick; private boolean mPickPoint = false; + private String mCustomButtonName = ""; // ** + public MwmRequest setCustomButtonName(String buttonName) + { + if (buttonName != null) + mCustomButtonName = buttonName; + else + mCustomButtonName = ""; + return this; + } + public MwmRequest setTitle(String title) { mTitle = title; return this; } - MwmRequest setPickPointMode(boolean pickPoint) + public MwmRequest setPickPointMode(boolean pickPoint) { mPickPoint = pickPoint; return this; @@ -84,6 +94,8 @@ public class MwmRequest mwmIntent.putExtra(Const.EXTRA_RETURN_ON_BALLOON_CLICK, mReturnOnBalloonClick); // pick point mwmIntent.putExtra(Const.EXTRA_PICK_POINT, mPickPoint); + // custom button name + mwmIntent.putExtra(Const.EXTRA_CUSTOM_BUTTON_NAME, mCustomButtonName); final boolean hasIntent = mPendingIntent != null; mwmIntent.putExtra(Const.EXTRA_HAS_PENDING_INTENT, hasIntent); From 0942accaa7d7f4795a368e3b3eaf40785aa48cc3 Mon Sep 17 00:00:00 2001 From: d-kunin Date: Tue, 10 Sep 2013 16:50:29 +0300 Subject: [PATCH 4/6] [codereview] --- lib/src/com/mapswithme/maps/api/MwmRequest.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/src/com/mapswithme/maps/api/MwmRequest.java b/lib/src/com/mapswithme/maps/api/MwmRequest.java index b922828..7a2335d 100644 --- a/lib/src/com/mapswithme/maps/api/MwmRequest.java +++ b/lib/src/com/mapswithme/maps/api/MwmRequest.java @@ -27,10 +27,7 @@ public class MwmRequest public MwmRequest setCustomButtonName(String buttonName) { - if (buttonName != null) - mCustomButtonName = buttonName; - else - mCustomButtonName = ""; + mCustomButtonName = buttonName != null ? buttonName : ""; return this; } From fc852085dfcc097538b2aaf0b9ddcc497427df7c Mon Sep 17 00:00:00 2001 From: d-kunin Date: Wed, 11 Sep 2013 19:41:21 +0300 Subject: [PATCH 5/6] [feature] Added zoom level as return param. --- lib/src/com/mapswithme/maps/api/Const.java | 1 + lib/src/com/mapswithme/maps/api/MWMResponse.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/src/com/mapswithme/maps/api/Const.java b/lib/src/com/mapswithme/maps/api/Const.java index 72d0418..8fbd196 100644 --- a/lib/src/com/mapswithme/maps/api/Const.java +++ b/lib/src/com/mapswithme/maps/api/Const.java @@ -44,6 +44,7 @@ public class Const public static final String EXTRA_MWM_RESPONSE_POINT_LAT = AUTHORITY + ".point_lat"; public static final String EXTRA_MWM_RESPONSE_POINT_LON = AUTHORITY + ".point_lon"; public static final String EXTRA_MWM_RESPONSE_POINT_ID = AUTHORITY + ".point_id"; + public static final String EXTRA_MWM_RESPONSE_ZOOM = AUTHORITY + ".zoom_level"; public static final String ACTION_MWM_REQUEST = AUTHORITY + ".request"; diff --git a/lib/src/com/mapswithme/maps/api/MWMResponse.java b/lib/src/com/mapswithme/maps/api/MWMResponse.java index 5219229..2e3db84 100644 --- a/lib/src/com/mapswithme/maps/api/MWMResponse.java +++ b/lib/src/com/mapswithme/maps/api/MWMResponse.java @@ -22,12 +22,14 @@ ******************************************************************************/ package com.mapswithme.maps.api; +import android.app.DownloadManager.Request; import android.content.Context; import android.content.Intent; public class MWMResponse { private MWMPoint mPoint; + private double mZoomLevel; /** * @@ -35,6 +37,7 @@ public class MWMResponse */ public MWMPoint getPoint() { return mPoint; } public boolean hasPoint() { return mPoint != null; } + public double getZoomLevel() { return mZoomLevel; } @Override public String toString() @@ -58,6 +61,9 @@ public class MWMResponse final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME); final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID); + // parse additional info + response.mZoomLevel = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_ZOOM, 9); + if (lat != INVALID_LL && lon != INVALID_LL) response.mPoint = new MWMPoint(lat, lon, name, id); else From 550b7c7619ecec9cdb76cd3e3e1b50ca71f51319 Mon Sep 17 00:00:00 2001 From: d-kunin Date: Wed, 14 Aug 2013 17:06:01 +0300 Subject: [PATCH 6/6] Promo dialog fixes --- lib/res/layout/dlg_install_mwm.xml | 32 ++++++++++++------------------ lib/res/values/strings.xml | 6 +++--- lib/res/values/styles.xml | 10 ++++++++++ 3 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 lib/res/values/styles.xml diff --git a/lib/res/layout/dlg_install_mwm.xml b/lib/res/layout/dlg_install_mwm.xml index a074d57..0d174a8 100644 --- a/lib/res/layout/dlg_install_mwm.xml +++ b/lib/res/layout/dlg_install_mwm.xml @@ -43,33 +43,27 @@ android:layout_weight="0" android:gravity="center" android:text="@string/mwm_should_be_installed" - android:textColor="@android:color/black"/> - -