Updated API example #1
17
.gitignore
vendored
|
@ -1,11 +1,10 @@
|
|||
bin/
|
||||
gen/
|
||||
build/
|
||||
.settings/
|
||||
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea
|
||||
.DS_Store
|
||||
.classpath
|
||||
.cproject
|
||||
.project
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
lint.xml
|
174
README.html
|
@ -1,174 +0,0 @@
|
|||
<h1>maps.me Android API: Getting Started</h1>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>NOTE: We have changed the name of our maps from MapsWithMe to MAPS.ME, but left all references below unchanged.</p>
|
||||
|
||||
<p>MapsWithMe Android API (hereinafter referred to as <em>"API Library"</em> or just <em>"library"</em>)
|
||||
provides interface for client application to perform next tasks:</p>
|
||||
|
||||
<ul>
|
||||
<li>Show one or more points on offline map of <a href="http://maps.me/" title="MAPS.ME">MapsWithMe Application</a></li>
|
||||
<li>Come back to the client application after selecting specific point on the map, by sending <a href="http://developer.android.com/reference/android/app/PendingIntent.html" title="PendingIntent">PendingIntent</a> with point data when user asks for more information by pressing "More Info" button in MapsWithMe Application</li>
|
||||
<li>Map screen branding : your application's icon and name (or custom title) will be placed at the top.</li>
|
||||
</ul>
|
||||
|
||||
<p>Thus, you can provide <strong>two way communication between your application and MapsWithMe</strong>,
|
||||
using MapsWithMe to show points of interest (POI) and providing more information in your app.</p>
|
||||
|
||||
<p>Please refer to <a href="https://github.com/mapswithme/api-android/tree/master/sample-app-capitals" title="Api Source Code">sample application</a> for demo or see
|
||||
our <a href="http://www.guidewithme.com">travel guide apps</a> as an API integration example.</p>
|
||||
|
||||
<h2>Prerequisites</h2>
|
||||
|
||||
<p>It is supposed that you are familiar with Android Development, and you have Android SDK and Eclipse (or another IDE of your choice) installed.
|
||||
You should be familiar with concept of <a href="http://developer.android.com/guide/components/intents-filters.html" title="Intents and Intent Filters">Intents</a>, <a href="http://developer.android.com/tools/projects/index.html#LibraryProjects" title="Android Library Project">library projects</a>, and <a href="http://developer.android.com/reference/android/app/PendingIntent.html" title="PendingIntent">PendingIntents</a> (recommended) as well.
|
||||
Your application must target at least <em>android sdk version 9</em>.</p>
|
||||
|
||||
<h2>Integration</h2>
|
||||
|
||||
<p>First step is to clone <a href="https://github.com/mapswithme/api-android" title="GitHub Repository">repository</a> or download it as an archive.</p>
|
||||
|
||||
<p>When your are done you find two folders: <em>lib</em> and <em>sample-app-capitals</em>. First one is a library project that you should add to your project.
|
||||
You don't need any additional permissions in your AndroidManifest.xml to use API library, so you can write real code straight away, calling for different <code>MapsWithMeApi</code> methods (more details below). </p>
|
||||
|
||||
<h2>Classes Overview and HOW TO</h2>
|
||||
|
||||
<p>Core classes you will work with are:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="lib/src/com/mapswithme/maps/api/MapsWithMeApi.java" title="MapsWithMeApi.java">com.mapswithme.maps.api.MapsWithMeApi</a> - static class with methods such as <code>showPointOnMap(Activity, double, double, String)</code> etc.</li>
|
||||
<li><a href="lib/src/com/mapswithme/maps/api/MWMPoint.java" title="MWMPoint.java">com.mapswithme.maps.api.MWMPoint</a> - model of POI, includes lat, lon, name, id, and style data.</li>
|
||||
<li><a href="lib/src/com/mapswithme/maps/api/MWMResponse.java" title="MWMResponse.java">com.mapswithme.maps.api.MWMResponse</a> - helps you to extract response from MapsWithMe by applying <code>MWMResponse.extractFromIntent(Intent)</code> to Intent. Contains MWMPoint data.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Show Points on the Map</h3>
|
||||
|
||||
<p>The simplest usage:</p>
|
||||
|
||||
<pre><code>public class MyPerfectActivity extends Activity {
|
||||
...
|
||||
|
||||
void showSomethingOnTheMap(SomeDomainObject arg)
|
||||
{
|
||||
// Do some work, create lat, lon, and name for point
|
||||
final double lat = ...;
|
||||
final double lon = ...;
|
||||
final String name = ...;
|
||||
// Ask MapsWithMe to show the point
|
||||
MapsWithMeApi.showPointOnMap(this, lat, lon, name);
|
||||
}
|
||||
...
|
||||
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>For multiple points use <a href="lib/src/com/mapswithme/maps/api/MWMPoint.java" title="MWMPoint.java">MWMPoint</a> class:</p>
|
||||
|
||||
<pre><code>void showMultiplePoints(List<SomeDomainObject> list)
|
||||
{
|
||||
// Convert objects to MMWPoints
|
||||
final MWMPoint[] points = new MWMPoint[list.length];
|
||||
for (int i = 0; i < list.size; i++)
|
||||
{
|
||||
// Get lat, lon, and name from object and assign it to new MMWPoint
|
||||
points[i] = new MWMPoint(lat, lon, name);
|
||||
}
|
||||
// Show all point on the map, you could also provide some title
|
||||
MapsWithMeApi.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<h3>Ask MapsWithMe to Call my App</h3>
|
||||
|
||||
<p>We support PendingIntent interaction (just like Android native
|
||||
NotificationManager does). You should specify ID for each point to
|
||||
distinguish it later, and PentingIntent that MapsWithMe will send back to
|
||||
your application when user press "More Info" button :</p>
|
||||
|
||||
<pre><code>// Here is how to pass points with ID ant PendingIntent
|
||||
void showMultiplePointsWithPendingIntent(List<SomeDomainObject> list, PendingIntent pendingIntent)
|
||||
{
|
||||
// Convert objects to MWMPoints
|
||||
final MWMPoint[] points = new MWMPoint[list.length];
|
||||
for (int i = 0; i < list.size; i++)
|
||||
{
|
||||
// ||
|
||||
// ||
|
||||
// \/
|
||||
// Now you should specify string ID for each point
|
||||
points[i] = new MWMPoint(lat, lon, name, id);
|
||||
}
|
||||
// Show all points on the map, you could also provide some title
|
||||
MapsWithMeApi.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
|
||||
}
|
||||
|
||||
//Code below shows general way to extract response data
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
// Handle intent you specified with PandingIntent
|
||||
// Now it has additional information (MWMPoint).
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent)
|
||||
{
|
||||
super.onNewIntent(intent);
|
||||
// if defined your activity as "SingleTop"- you should use onNewIntent callback
|
||||
handleIntent(intent);
|
||||
}
|
||||
|
||||
void handleIntent(Intent intent)
|
||||
{
|
||||
// Apply MWMResponse extraction method to intent
|
||||
final MWMResponse mwmResponse = MWMResponse.extractFromIntent(this, intent);
|
||||
// Here is your point that user selected
|
||||
final MWMPoint point = mwmResponse.getPoint();
|
||||
// Now, for instance you can do some work depending on point id
|
||||
processUserInteraction(point.getId());
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<h2>FAQ</h2>
|
||||
|
||||
<h4>How should I detect if user has MapsWithMe installed?</h4>
|
||||
|
||||
<p><code>MapsWithMeApi.isMapsWithMeInstalled(Context)</code> will return <code>true</code> if user has <em>Lite</em> or <em>Pro</em> version that supports API call installed.</p>
|
||||
|
||||
<h4>Which versions of MapsWithMe support API calls?</h4>
|
||||
|
||||
<p>All versions since 2.4.0 and above support API calls.</p>
|
||||
|
||||
<h4>What will happen if I call for <code>MapsWithMeApi.showPoint()</code> but MapsWithMe application is not installed?</h4>
|
||||
|
||||
<p>Nothing serious. API library will show simple dialog with gentle offer to download MapsWithMe. You can see how it looks like below. <img src="site/images/dlg.png" alt="Please install us"></p>
|
||||
|
||||
<h2>Sample Code and Application</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://play.google.com/store/apps/details?id=com.mapswithme.capitals" title="Api Demo .apk">Sample Application at Google Play</a></li>
|
||||
<li><a href="https://github.com/mapswithme/api-android/tree/master/sample-app-capitals" title="Api Source Code">Sample Application Source Code</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Support</h2>
|
||||
|
||||
<p>If you have any questions please email to <a href="mailto:api@maps.me" title="MAPS.ME Support Contact">api@mapswith.me</a>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>API Code License</h2>
|
||||
|
||||
<p>Copyright (c) 2014, MapsWithMe GmbH
|
||||
All rights reserved.</p>
|
||||
|
||||
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
|
||||
|
||||
<ul>
|
||||
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
|
||||
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
|
||||
</ul>
|
||||
|
||||
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
|
94
README.md
|
@ -1,40 +1,38 @@
|
|||
# maps.me Android API: Getting Started
|
||||
# Organic Maps Android API: Getting Started
|
||||
|
||||
## Introduction
|
||||
|
||||
NOTE: We have changed the name of our maps from MapsWithMe to MAPS.ME, but left all references below unchanged.
|
||||
|
||||
MapsWithMe Android API (hereinafter referred to as *"API Library"* or just *"library"*)
|
||||
Organic Maps Android API (hereinafter referred to as *"API Library"* or just *"library"*)
|
||||
provides interface for client application to perform next tasks:
|
||||
|
||||
* Show one or more points on offline map of [MapsWithMe Application][linkMwm]
|
||||
* Come back to the client application after selecting specific point on the map, by sending [PendingIntent][linkPIntent] with point data when user asks for more information by pressing "More Info" button in MapsWithMe Application
|
||||
* Show one or more points on offline map of [Organic Maps app][linkOM]
|
||||
* Come back to the client application after selecting specific point on the map, by sending [PendingIntent][linkPIntent] with point data when user asks for more information by pressing "More Info" button in Organic Maps app
|
||||
* Map screen branding : your application's icon and name (or custom title) will be placed at the top.
|
||||
|
||||
Thus, you can provide **two way communication between your application and MapsWithMe**,
|
||||
using MapsWithMe to show points of interest (POI) and providing more information in your app.
|
||||
Thus, you can provide **two way communication between your application and Organic Maps**,
|
||||
using Organic Maps to show points of interest (POI) and providing more information in your app.
|
||||
|
||||
Please refer to [sample application][linkSampleSource] for demo or see
|
||||
our [travel guide apps][linkTravelGuides] as an API integration example.
|
||||
Please refer to [sample application][linkSampleSource] for demo.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
It is supposed that you are familiar with Android Development, and you have Android SDK and Eclipse (or another IDE of your choice) installed.
|
||||
It is supposed that you are familiar with Android Development.
|
||||
You should be familiar with concept of [Intents][linkIntents], [library projects][linkLibProj], and [PendingIntents][linkPIntent] (recommended) as well.
|
||||
Your application must target at least *android sdk version 9*.
|
||||
|
||||
Organic Maps works from *Android SDK version 21 (Android 5)* and above
|
||||
|
||||
## Integration
|
||||
First step is to clone [repository][linkRepo] or download it as an archive.
|
||||
|
||||
When your are done you find two folders: *lib* and *sample-app-capitals*. First one is a library project that you should add to your project.
|
||||
You don't need any additional permissions in your AndroidManifest.xml to use API library, so you can write real code straight away, calling for different `MapsWithMeApi` methods (more details below).
|
||||
You don't need any additional permissions in your AndroidManifest.xml to use API library, so you can write real code straight away, calling for different `Api` methods (more details below).
|
||||
|
||||
## Classes Overview and HOW TO
|
||||
Core classes you will work with are:
|
||||
|
||||
* [com.mapswithme.maps.api.MapsWithMeApi][linkApiClass] - static class with methods such as `showPointOnMap(Activity, double, double, String)` etc.
|
||||
* [com.mapswithme.maps.api.MWMPoint][linkPointClass] - model of POI, includes lat, lon, name, id, and style data.
|
||||
* [com.mapswithme.maps.api.MWMResponse][linkRespClass] - helps you to extract response from MapsWithMe by applying `MWMResponse.extractFromIntent(Intent)` to Intent. Contains MWMPoint data.
|
||||
* [app.organicmaps.api.Api][linkApiClass] - static class with methods such as `showPointOnMap(Activity, double, double, String)` etc.
|
||||
* [app.organicmaps.api.Point][linkPointClass] - model of POI, includes lat, lon, name, id, and style data.
|
||||
* [app.organicmaps.api.Response][linkRespClass] - helps you to extract response from Organic Maps by applying `Response.extractFromIntent(Intent)` to Intent. Contains Point data.
|
||||
|
||||
### Show Points on the Map
|
||||
|
||||
|
@ -49,51 +47,51 @@ The simplest usage:
|
|||
final double lat = ...;
|
||||
final double lon = ...;
|
||||
final String name = ...;
|
||||
// Ask MapsWithMe to show the point
|
||||
MapsWithMeApi.showPointOnMap(this, lat, lon, name);
|
||||
// Ask Organic Maps to show the point
|
||||
Api.showPointOnMap(this, lat, lon, name);
|
||||
}
|
||||
...
|
||||
|
||||
}
|
||||
|
||||
For multiple points use [MWMPoint][linkPointClass] class:
|
||||
For multiple points use [Point][linkPointClass] class:
|
||||
|
||||
void showMultiplePoints(List<SomeDomainObject> list)
|
||||
{
|
||||
// Convert objects to MMWPoints
|
||||
final MWMPoint[] points = new MWMPoint[list.length];
|
||||
// Convert objects to OM Points
|
||||
final Point[] points = new Point[list.length];
|
||||
for (int i = 0; i < list.size; i++)
|
||||
{
|
||||
// Get lat, lon, and name from object and assign it to new MMWPoint
|
||||
points[i] = new MWMPoint(lat, lon, name);
|
||||
// Get lat, lon, and name from object and assign it to new Point
|
||||
points[i] = new Point(lat, lon, name);
|
||||
}
|
||||
// Show all point on the map, you could also provide some title
|
||||
MapsWithMeApi.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
|
||||
Api.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
|
||||
}
|
||||
|
||||
|
||||
### Ask MapsWithMe to Call my App
|
||||
### Ask Organic Maps to Call my App
|
||||
|
||||
We support PendingIntent interaction (just like Android native
|
||||
NotificationManager does). You should specify ID for each point to
|
||||
distinguish it later, and PentingIntent that MapsWithMe will send back to
|
||||
distinguish it later, and PentingIntent that Organic Maps will send back to
|
||||
your application when user press "More Info" button :
|
||||
|
||||
// Here is how to pass points with ID ant PendingIntent
|
||||
void showMultiplePointsWithPendingIntent(List<SomeDomainObject> list, PendingIntent pendingIntent)
|
||||
{
|
||||
// Convert objects to MWMPoints
|
||||
final MWMPoint[] points = new MWMPoint[list.length];
|
||||
// Convert objects to Points
|
||||
final Point[] points = new Point[list.length];
|
||||
for (int i = 0; i < list.size; i++)
|
||||
{
|
||||
// ||
|
||||
// ||
|
||||
// \/
|
||||
// Now you should specify string ID for each point
|
||||
points[i] = new MWMPoint(lat, lon, name, id);
|
||||
points[i] = new Point(lat, lon, name, id);
|
||||
}
|
||||
// Show all points on the map, you could also provide some title
|
||||
MapsWithMeApi.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
|
||||
Api.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
|
||||
}
|
||||
|
||||
//Code below shows general way to extract response data
|
||||
|
@ -102,7 +100,7 @@ your application when user press "More Info" button :
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
// Handle intent you specified with PandingIntent
|
||||
// Now it has additional information (MWMPoint).
|
||||
// Now it has additional information (Point).
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
||||
|
@ -116,35 +114,37 @@ your application when user press "More Info" button :
|
|||
|
||||
void handleIntent(Intent intent)
|
||||
{
|
||||
// Apply MWMResponse extraction method to intent
|
||||
final MWMResponse mwmResponse = MWMResponse.extractFromIntent(this, intent);
|
||||
// Apply Response extraction method to intent
|
||||
final Response mwmResponse = Response.extractFromIntent(this, intent);
|
||||
// Here is your point that user selected
|
||||
final MWMPoint point = mwmResponse.getPoint();
|
||||
final Point point = mwmResponse.getPoint();
|
||||
// Now, for instance you can do some work depending on point id
|
||||
processUserInteraction(point.getId());
|
||||
}
|
||||
|
||||
## FAQ
|
||||
|
||||
#### How should I detect if user has MapsWithMe installed?
|
||||
`MapsWithMeApi.isMapsWithMeInstalled(Context)` will return `true` if user has *Lite* or *Pro* version that supports API call installed.
|
||||
#### How should I detect if user has Organic Maps installed?
|
||||
`Api.isOrganicMapsInstalled(Context)` will return `true` if user has *Lite* or *Pro* version that supports API call installed.
|
||||
|
||||
#### Which versions of MapsWithMe support API calls?
|
||||
#### Which versions of Organic Maps support API calls?
|
||||
All versions since 2.4.0 and above support API calls.
|
||||
|
||||
#### What will happen if I call for `MapsWithMeApi.showPoint()` but MapsWithMe application is not installed?
|
||||
Nothing serious. API library will show simple dialog with gentle offer to download MapsWithMe. You can see how it looks like below.
|
||||
#### What will happen if I call for `Api.showPoint()` but Organic Maps application is not installed?
|
||||
Nothing serious. API library will show simple dialog with gentle offer to download Organic Maps. You can see how it looks like below.
|
||||
|
||||

|
||||
|
||||
## Sample Code and Application
|
||||
|
||||
* [Sample Application at Google Play][linkSampleGooglePlay]
|
||||
* [Sample Application Source Code][linkSampleSource]
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
## API Code License
|
||||
|
||||
Copyright (c) 2022, Organic Maps OÜ.
|
||||
Copyright (c) 2019, MY.COM B.V.
|
||||
Copyright (c) 2013, MapsWithMe GmbH.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
@ -154,14 +154,12 @@ Redistribution and use in source and binary forms, with or without modification,
|
|||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
[linkMwm]: https://maps.me/ "MAPS.ME"
|
||||
[linkOM]: https://organicmaps.app/ "Organic Maps"
|
||||
[linkPIntent]: http://developer.android.com/reference/android/app/PendingIntent.html "PendingIntent"
|
||||
[linkRepo]: https://github.com/mapswithme/api-android "GitHub Repository"
|
||||
[linkRepo]: https://github.com/organicmaps/api-android "GitHub Repository"
|
||||
[linkLibProj]: http://developer.android.com/tools/projects/index.html#LibraryProjects "Android Library Project"
|
||||
[linkIntents]: http://developer.android.com/guide/components/intents-filters.html "Intents and Intent Filters"
|
||||
[linkApiClass]: lib/src/com/mapswithme/maps/api/MapsWithMeApi.java "MapsWithMeApi.java"
|
||||
[linkPointClass]: lib/src/com/mapswithme/maps/api/MWMPoint.java "MWMPoint.java"
|
||||
[linkRespClass]: lib/src/com/mapswithme/maps/api/MWMResponse.java "MWMResponse.java"
|
||||
[linkSampleSource]: https://github.com/mapswithme/api-android/tree/master/sample-app-capitals "Api Source Code"
|
||||
[linkSampleGooglePlay]: http://play.google.com/store/apps/details?id=com.mapswithme.capitals "Api Demo .apk"
|
||||
[linkTravelGuides]: http://www.guidewithme.com
|
||||
[linkApiClass]: lib/src/app/organicmaps/api/Api.java "Api.java"
|
||||
[linkPointClass]: lib/src/app/organicmaps/api/Point.java "Point.java"
|
||||
[linkRespClass]: lib/src/app/organicmaps/api/Response.java "Response.java"
|
||||
[linkSampleSource]: https://github.com/organicmaps/api-android/tree/master/sample-app-capitals "Api Source Code"
|
||||
|
|
9
build.gradle
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.2.1' apply false
|
||||
id 'com.android.library' version '7.2.1' apply false
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
21
gradle.properties
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Mon Jun 06 09:48:49 TRT 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
185
gradlew
vendored
Executable file
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
1
lib/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -1,8 +0,0 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mapwithme.maps.api"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<application />
|
||||
|
||||
</manifest>
|
|
@ -1,19 +1,32 @@
|
|||
apply plugin: 'android-library'
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
// Define these properties in the gradle.properties file in the root project folder
|
||||
compileSdkVersion propTargetSdkVersion.toInteger()
|
||||
buildToolsVersion propBuildToolsVersion
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion propMinSdkVersion.toInteger()
|
||||
targetSdkVersion propTargetSdkVersion.toInteger()
|
||||
minSdk 21
|
||||
targetSdk 32
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="MwmApi" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
0
lib/consumer-rules.pro
Normal file
21
lib/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -1,15 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
android.library=true
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="mwm_should_be_installed">Offline maps are required to proceed. We have partnered with MAPS.ME to provide you with offline maps of the entire world.\nTo continue please download the app:</string>
|
||||
<string name="down_pro">Download MAPS.ME</string>
|
||||
<string name="url_pro">http://maps.me/get</string>
|
||||
</resources>
|
|
@ -1,55 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.maps.api;
|
||||
|
||||
public class Const
|
||||
{
|
||||
|
||||
/* Request extras */
|
||||
static final String AUTHORITY = "com.mapswithme.maps.api";
|
||||
public static final String EXTRA_URL = AUTHORITY + ".url";
|
||||
public static final String EXTRA_TITLE = AUTHORITY + ".title";
|
||||
public static final String EXTRA_API_VERSION = AUTHORITY + ".version";
|
||||
public static final String EXTRA_CALLER_APP_INFO = AUTHORITY + ".caller_app_info";
|
||||
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";
|
||||
public static final String EXTRA_CUSTOM_BUTTON_NAME = AUTHORITY + ".custom_button_name";
|
||||
|
||||
|
||||
/* Response extras */
|
||||
/* Point part-by-part*/
|
||||
public static final String EXTRA_MWM_RESPONSE_POINT_NAME = AUTHORITY + ".point_name";
|
||||
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";
|
||||
static final int API_VERSION = 2;
|
||||
static final String CALLBACK_PREFIX = "mapswithme.client.";
|
||||
|
||||
private Const() {}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.maps.api;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import com.mapwithme.maps.api.R;
|
||||
|
||||
public class DownloadMapsWithMeDialog extends Dialog implements android.view.View.OnClickListener
|
||||
{
|
||||
|
||||
public DownloadMapsWithMeDialog(Activity activity)
|
||||
{
|
||||
super(activity);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.dlg_install_mwm);
|
||||
|
||||
findViewById(R.id.btn_pro).setOnClickListener(this);
|
||||
|
||||
setOwnerActivity(activity);
|
||||
}
|
||||
|
||||
|
||||
public void onDownloadButtonClicked(String url)
|
||||
{
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
getContext().startActivity(i);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
String url = getContext().getString(R.string.url_pro);
|
||||
onDownloadButtonClicked(url);
|
||||
}
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.maps.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* POI wrapper object.
|
||||
* Has its <code>equals()</code> and <code>hashCode()</code> methods overloaded
|
||||
* so could be used in Hash(Map/Set/etc) classes.
|
||||
*/
|
||||
public final class MWMPoint implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
final private double mLat;
|
||||
final private double mLon;
|
||||
final private String mName;
|
||||
private String mId;
|
||||
private Style mStyle;
|
||||
|
||||
public MWMPoint(double lat, double lon, String name)
|
||||
{
|
||||
this(lat, lon, name, null);
|
||||
}
|
||||
|
||||
public MWMPoint(double lat, double lon, String name, String id)
|
||||
{
|
||||
this.mLat = lat;
|
||||
this.mLon = lon;
|
||||
this.mName = name;
|
||||
this.mId = id;
|
||||
}
|
||||
|
||||
public MWMPoint(double lat, double lon, String name, String id, Style style)
|
||||
{
|
||||
this.mLat = lat;
|
||||
this.mLon = lon;
|
||||
this.mName = name;
|
||||
this.mId = id;
|
||||
this.mStyle = style;
|
||||
}
|
||||
|
||||
public double getLat() { return mLat; }
|
||||
public double getLon() { return mLon; }
|
||||
public String getName() { return mName; }
|
||||
public String getId() { return mId; }
|
||||
public Style getStyle() { return mStyle; }
|
||||
|
||||
public String getStyleForUrl() { return (mStyle == null) ? null : mStyle.getName(); }
|
||||
|
||||
/**
|
||||
* Sets string ID for this point. Internally it is not used to distinguish point,
|
||||
* it's purpose to help clients code to associate point with domain objects of their application.
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) { mId = id; }
|
||||
|
||||
/**
|
||||
* Sets the style (appearance) for this point.
|
||||
*
|
||||
* @param style Style to use, or null for default (violet circle).
|
||||
*/
|
||||
public void setStyle(Style style)
|
||||
{
|
||||
this.mStyle = style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "MWMPoint [lat=" + mLat +
|
||||
", lon=" + mLon +
|
||||
", name=" + mName +
|
||||
", id=" + mId +
|
||||
", style=" + mStyle + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(mLat);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(mLon);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((mName == null) ? 0 : mName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Two point are considered
|
||||
* equal if they have they lat, lon, and name attributes equal.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
final MWMPoint other = (MWMPoint) obj;
|
||||
if (Double.doubleToLongBits(mLat) != Double.doubleToLongBits(other.mLat))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(mLon) != Double.doubleToLongBits(other.mLon))
|
||||
return false;
|
||||
|
||||
return mName == null ? other.mName == null : mName.equals(other.mName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported styles for MAPS.ME. Each appears as a small flag of the appropriate colour.
|
||||
*/
|
||||
public enum Style
|
||||
{
|
||||
PlacemarkRed("placemark-red"),
|
||||
PlacemarkBlue("placemark-blue"),
|
||||
PlacemarkPurple("placemark-purple"),
|
||||
PlacemarkYellow("placemark-yellow"),
|
||||
PlacemarkPink("placemark-pink"),
|
||||
PlacemarkBrown("placemark-brown"),
|
||||
PlacemarkGreen("placemark-green"),
|
||||
PlacemarkOrange("placemark-orange");
|
||||
|
||||
private String name;
|
||||
|
||||
private Style(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name as it should appear in the MAPS.ME URL.
|
||||
*/
|
||||
private String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.maps.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class MWMResponse
|
||||
{
|
||||
private MWMPoint mPoint;
|
||||
private double mZoomLevel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return point, for which user requested more information in MapsWithMe application.
|
||||
*/
|
||||
public MWMPoint getPoint() { return mPoint; }
|
||||
public boolean hasPoint() { return mPoint != null; }
|
||||
public double getZoomLevel() { return mZoomLevel; }
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "MWMResponse [SelectedPoint=" + mPoint + "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to extract response data from intent.
|
||||
*
|
||||
* @param context
|
||||
* @param intent
|
||||
* @return
|
||||
*/
|
||||
public static MWMResponse extractFromIntent(Context context, Intent intent)
|
||||
{
|
||||
final MWMResponse response = new MWMResponse();
|
||||
// parse point
|
||||
final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, INVALID_LL);
|
||||
final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, INVALID_LL);
|
||||
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
|
||||
response.mPoint = null;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private final static double INVALID_LL = Double.MIN_VALUE;
|
||||
|
||||
private MWMResponse() {}
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.maps.api;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
public final class MapsWithMeApi
|
||||
{
|
||||
|
||||
/**
|
||||
* Most detailed level, buildings and trees are seen.
|
||||
*/
|
||||
public static final double ZOOM_MAX = 19;
|
||||
/**
|
||||
* Least detailed level, continents are seen.
|
||||
*/
|
||||
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);
|
||||
|
||||
if (isMapsWithMeInstalled(caller))
|
||||
{
|
||||
// Match activity for intent
|
||||
final ActivityInfo aInfo = caller.getPackageManager().resolveActivity(mwmIntent, 0).activityInfo;
|
||||
mwmIntent.setClassName(aInfo.packageName, aInfo.name);
|
||||
caller.startActivity(mwmIntent);
|
||||
}
|
||||
else
|
||||
(new DownloadMapsWithMeDialog(caller)).show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows single point on the map.
|
||||
*
|
||||
* @param caller
|
||||
* @param lat
|
||||
* @param lon
|
||||
* @param name
|
||||
*/
|
||||
public static void showPointOnMap(Activity caller, double lat, double lon, String name)
|
||||
{
|
||||
showPointsOnMap(caller, (String) null, (PendingIntent) null, new MWMPoint(lat, lon, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param name
|
||||
* @param zoomLevel
|
||||
*/
|
||||
public static void showPointOnMap(Activity caller, double lat, double lon, String name, double zoomLevel)
|
||||
{
|
||||
showPointsOnMap(caller, (String) null, zoomLevel, (PendingIntent) null, new MWMPoint(lat, lon, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows set of points on the map.
|
||||
*
|
||||
* @param caller
|
||||
* @param title
|
||||
* @param points
|
||||
*/
|
||||
public static void showPointsOnMap(Activity caller, String title, MWMPoint... points)
|
||||
{
|
||||
showPointsOnMap(caller, title, null, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows set of points on the maps and allows MapsWithMeApplication to send
|
||||
* {@link PendingIntent} provided by client application.
|
||||
*
|
||||
* @param caller
|
||||
* @param title
|
||||
* @param pendingIntent
|
||||
* @param points
|
||||
*/
|
||||
public static void showPointsOnMap(Activity caller, String title, PendingIntent pendingIntent, MWMPoint... points)
|
||||
{
|
||||
showPointsOnMap(caller, title, -1, pendingIntent, points);
|
||||
}
|
||||
|
||||
private static void showPointsOnMap(Activity caller, String title, double zoomLevel, PendingIntent pendingIntent,
|
||||
MWMPoint... points)
|
||||
{
|
||||
final MwmRequest request = new MwmRequest()
|
||||
.setTitle(title)
|
||||
.setZoomLevel(zoomLevel)
|
||||
.setPendingIntent(pendingIntent)
|
||||
.setPoints(points);
|
||||
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.
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMapsWithMeInstalled(Context context)
|
||||
{
|
||||
final Intent intent = new Intent(Const.ACTION_MWM_REQUEST);
|
||||
return context.getPackageManager().resolveActivity(intent, 0) != null;
|
||||
}
|
||||
}
|
8
lib/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="app.organicmaps.api"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<queries>
|
||||
<package android:name="app.organicmaps"/>
|
||||
<package android:name="com.mapswithme.maps"/>
|
||||
</queries>
|
||||
</manifest>
|
154
lib/src/main/java/app/organicmaps/api/Api.java
Normal file
|
@ -0,0 +1,154 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
|
||||
public final class Api
|
||||
{
|
||||
|
||||
/**
|
||||
* Most detailed level, buildings and trees are seen.
|
||||
*/
|
||||
public static final double ZOOM_MAX = 19;
|
||||
/**
|
||||
* Least detailed level, continents are seen.
|
||||
*/
|
||||
public static final double ZOOM_MIN = 1;
|
||||
|
||||
public static void showOrganicMapsUrl(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 Point(lat, lon, name, id));
|
||||
}
|
||||
|
||||
public static void sendRequest(Activity caller, Request request)
|
||||
{
|
||||
final Intent mwmIntent = request.toIntent(caller);
|
||||
|
||||
if (isOrganicMapsInstalled(caller))
|
||||
{
|
||||
caller.startActivity(mwmIntent);
|
||||
}
|
||||
else
|
||||
(new DownloadDialog(caller)).show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows single point on the map.
|
||||
*
|
||||
* @param caller
|
||||
* @param lat
|
||||
* @param lon
|
||||
* @param name
|
||||
*/
|
||||
public static void showPointOnMap(Activity caller, double lat, double lon, String name)
|
||||
{
|
||||
showPointsOnMap(caller, null, (PendingIntent) null, new Point(lat, lon, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows single point on the map using specified zoom level in range from
|
||||
* {@link Api#ZOOM_MIN} to {@link Api#ZOOM_MAX}.
|
||||
*
|
||||
* @param caller
|
||||
* @param lat
|
||||
* @param lon
|
||||
* @param name
|
||||
* @param zoomLevel
|
||||
*/
|
||||
public static void showPointOnMap(Activity caller, double lat, double lon, String name, double zoomLevel)
|
||||
{
|
||||
showPointsOnMap(caller, null, zoomLevel, null, new Point(lat, lon, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows set of points on the map.
|
||||
*
|
||||
* @param caller
|
||||
* @param title
|
||||
* @param points
|
||||
*/
|
||||
public static void showPointsOnMap(Activity caller, String title, Point... points)
|
||||
{
|
||||
showPointsOnMap(caller, title, null, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows set of points on the maps and allows OrganicMapsApplication to send
|
||||
* {@link PendingIntent} provided by client application.
|
||||
*
|
||||
* @param caller
|
||||
* @param title
|
||||
* @param pendingIntent
|
||||
* @param points
|
||||
*/
|
||||
public static void showPointsOnMap(Activity caller, String title, PendingIntent pendingIntent, Point... points)
|
||||
{
|
||||
showPointsOnMap(caller, title, -1, pendingIntent, points);
|
||||
}
|
||||
|
||||
private static void showPointsOnMap(Activity caller, String title, double zoomLevel, PendingIntent pendingIntent,
|
||||
Point... points)
|
||||
{
|
||||
final Request request = new Request()
|
||||
.setTitle(title)
|
||||
.setZoomLevel(zoomLevel)
|
||||
.setPendingIntent(pendingIntent)
|
||||
.setPoints(points);
|
||||
sendRequest(caller, request);
|
||||
}
|
||||
|
||||
public static void pickPoint(Activity caller, String title, PendingIntent pi)
|
||||
{
|
||||
final Request request = new Request()
|
||||
.setTitle(title)
|
||||
.setPickPointMode(true)
|
||||
.setPendingIntent(pi);
|
||||
sendRequest(caller, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects if Organic Maps is installed on the device.
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isOrganicMapsInstalled(Context context)
|
||||
{
|
||||
final Intent intent = new Intent(Const.ACTION_OM_REQUEST);
|
||||
return context.getPackageManager().resolveActivity(intent, 0) != null;
|
||||
}
|
||||
}
|
56
lib/src/main/java/app/organicmaps/api/Const.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api;
|
||||
|
||||
public class Const
|
||||
{
|
||||
|
||||
/* Request extras */
|
||||
static final String AUTHORITY = "com.mapswithme.maps.api";
|
||||
public static final String EXTRA_URL = AUTHORITY + ".url";
|
||||
public static final String EXTRA_TITLE = AUTHORITY + ".title";
|
||||
public static final String EXTRA_API_VERSION = AUTHORITY + ".version";
|
||||
public static final String EXTRA_CALLER_APP_INFO = AUTHORITY + ".caller_app_info";
|
||||
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";
|
||||
public static final String EXTRA_CUSTOM_BUTTON_NAME = AUTHORITY + ".custom_button_name";
|
||||
|
||||
|
||||
/* Response extras */
|
||||
/* Point part-by-part*/
|
||||
public static final String EXTRA_OM_RESPONSE_POINT_NAME = AUTHORITY + ".point_name";
|
||||
public static final String EXTRA_OM_RESPONSE_POINT_LAT = AUTHORITY + ".point_lat";
|
||||
public static final String EXTRA_OM_RESPONSE_POINT_LON = AUTHORITY + ".point_lon";
|
||||
public static final String EXTRA_OM_RESPONSE_POINT_ID = AUTHORITY + ".point_id";
|
||||
public static final String EXTRA_OM_RESPONSE_ZOOM = AUTHORITY + ".zoom_level";
|
||||
|
||||
|
||||
public static final String ACTION_OM_REQUEST = AUTHORITY + ".request";
|
||||
static final int API_VERSION = 2;
|
||||
static final String CALLBACK_PREFIX = "mapswithme.client.";
|
||||
|
||||
private Const() {}
|
||||
}
|
63
lib/src/main/java/app/organicmaps/api/DownloadDialog.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
public class DownloadDialog extends Dialog implements android.view.View.OnClickListener
|
||||
{
|
||||
|
||||
public DownloadDialog(Activity activity)
|
||||
{
|
||||
super(activity);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.dlg_install_mwm);
|
||||
|
||||
findViewById(R.id.btn_pro).setOnClickListener(this);
|
||||
|
||||
setOwnerActivity(activity);
|
||||
}
|
||||
|
||||
|
||||
public void onDownloadButtonClicked(String url)
|
||||
{
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
getContext().startActivity(i);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
String url = getContext().getString(R.string.url);
|
||||
onDownloadButtonClicked(url);
|
||||
}
|
||||
}
|
179
lib/src/main/java/app/organicmaps/api/Point.java
Normal file
|
@ -0,0 +1,179 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* POI wrapper object.
|
||||
* Has its <code>equals()</code> and <code>hashCode()</code> methods overloaded
|
||||
* so could be used in Hash(Map/Set/etc) classes.
|
||||
*/
|
||||
public final class Point implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
final private double mLat;
|
||||
final private double mLon;
|
||||
final private String mName;
|
||||
private String mId;
|
||||
private Style mStyle;
|
||||
|
||||
public Point(double lat, double lon, String name)
|
||||
{
|
||||
this(lat, lon, name, null);
|
||||
}
|
||||
|
||||
public Point(double lat, double lon, String name, String id)
|
||||
{
|
||||
this.mLat = lat;
|
||||
this.mLon = lon;
|
||||
this.mName = name;
|
||||
this.mId = id;
|
||||
}
|
||||
|
||||
public Point(double lat, double lon, String name, String id, Style style)
|
||||
{
|
||||
this.mLat = lat;
|
||||
this.mLon = lon;
|
||||
this.mName = name;
|
||||
this.mId = id;
|
||||
this.mStyle = style;
|
||||
}
|
||||
|
||||
public double getLat() {return mLat;}
|
||||
|
||||
public double getLon() {return mLon;}
|
||||
|
||||
public String getName() {return mName;}
|
||||
|
||||
public String getId() {return mId;}
|
||||
|
||||
/**
|
||||
* Sets string ID for this point. Internally it is not used to distinguish point,
|
||||
* it's purpose to help clients code to associate point with domain objects of their application.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) {mId = id;}
|
||||
|
||||
public Style getStyle() {return mStyle;}
|
||||
|
||||
/**
|
||||
* Sets the style (appearance) for this point.
|
||||
*
|
||||
* @param style Style to use, or null for default (violet circle).
|
||||
*/
|
||||
public void setStyle(Style style)
|
||||
{
|
||||
this.mStyle = style;
|
||||
}
|
||||
|
||||
public String getStyleForUrl() {return (mStyle == null) ? null : mStyle.getName();}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "OMPoint [lat=" + mLat +
|
||||
", lon=" + mLon +
|
||||
", name=" + mName +
|
||||
", id=" + mId +
|
||||
", style=" + mStyle + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(mLat);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(mLon);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((mName == null) ? 0 : mName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Two point are considered
|
||||
* equal if they have they lat, lon, and name attributes equal.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
final Point other = (Point) obj;
|
||||
if (Double.doubleToLongBits(mLat) != Double.doubleToLongBits(other.mLat))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(mLon) != Double.doubleToLongBits(other.mLon))
|
||||
return false;
|
||||
|
||||
return mName == null ? other.mName == null : mName.equals(other.mName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported styles for Organic Maps. Each appears as a small flag of the appropriate colour.
|
||||
*/
|
||||
public enum Style
|
||||
{
|
||||
PlacemarkRed("placemark-red"),
|
||||
PlacemarkBlue("placemark-blue"),
|
||||
PlacemarkPurple("placemark-purple"),
|
||||
PlacemarkYellow("placemark-yellow"),
|
||||
PlacemarkPink("placemark-pink"),
|
||||
PlacemarkBrown("placemark-brown"),
|
||||
PlacemarkGreen("placemark-green"),
|
||||
PlacemarkOrange("placemark-orange");
|
||||
// TODO: Add
|
||||
// placemark-bluegray
|
||||
// placemark-cyan
|
||||
// placemark-deeporange
|
||||
// placemark-deeppurple
|
||||
// placemark-gray
|
||||
// placemark-lightblue
|
||||
// placemark-lime
|
||||
// placemark-teal
|
||||
|
||||
private final String name;
|
||||
|
||||
Style(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name as it should appear in the MAPS.ME URL.
|
||||
*/
|
||||
private String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,32 @@
|
|||
package com.mapswithme.maps.api;
|
||||
/******************************************************************************
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -6,73 +34,123 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
public class MwmRequest
|
||||
public class Request
|
||||
{
|
||||
|
||||
// **
|
||||
private List<MWMPoint> mPoints = new ArrayList<MWMPoint>();
|
||||
private PendingIntent mPendingIntent;
|
||||
private String mTitle;
|
||||
private double mZoomLevel = 1;
|
||||
private boolean mReturnOnBalloonClick;
|
||||
private boolean mPickPoint = false;
|
||||
private String mCustomButtonName = "";
|
||||
private List<Point> mPoints = new ArrayList<>();
|
||||
private PendingIntent mPendingIntent;
|
||||
private String mTitle;
|
||||
private double mZoomLevel = 1;
|
||||
private boolean mReturnOnBalloonClick;
|
||||
private boolean mPickPoint = false;
|
||||
private String mCustomButtonName = "";
|
||||
// **
|
||||
|
||||
public MwmRequest setCustomButtonName(String buttonName)
|
||||
private static StringBuilder createMwmUrl(Context context, String title, double zoomLevel, List<Point> points)
|
||||
{
|
||||
final StringBuilder urlBuilder = new StringBuilder("om://map?");
|
||||
// version
|
||||
urlBuilder.append("v=").append(Const.API_VERSION).append("&");
|
||||
// back url, always not null
|
||||
urlBuilder.append("backurl=").append(getCallbackAction(context)).append("&");
|
||||
// title
|
||||
appendIfNotNull(urlBuilder, "appname", title);
|
||||
// zoom
|
||||
appendIfNotNull(urlBuilder, "z", isValidZoomLevel(zoomLevel) ? String.valueOf(zoomLevel) : null);
|
||||
|
||||
// points
|
||||
for (final Point 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, "id", point.getId());
|
||||
appendIfNotNull(urlBuilder, "s", point.getStyleForUrl());
|
||||
}
|
||||
}
|
||||
|
||||
return urlBuilder;
|
||||
}
|
||||
|
||||
private static String getCallbackAction(Context context)
|
||||
{
|
||||
return Const.CALLBACK_PREFIX + context.getPackageName();
|
||||
}
|
||||
|
||||
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)
|
||||
builder.append(key).append("=").append(Uri.encode(value)).append("&");
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static boolean isValidZoomLevel(double zoom)
|
||||
{
|
||||
return zoom >= Api.ZOOM_MIN && zoom <= Api.ZOOM_MAX;
|
||||
}
|
||||
|
||||
public Request setCustomButtonName(String buttonName)
|
||||
{
|
||||
mCustomButtonName = buttonName != null ? buttonName : "";
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest setTitle(String title)
|
||||
public Request setTitle(String title)
|
||||
{
|
||||
mTitle = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest setPickPointMode(boolean pickPoint)
|
||||
public Request setPickPointMode(boolean pickPoint)
|
||||
{
|
||||
mPickPoint = pickPoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest addPoint(MWMPoint point)
|
||||
public Request addPoint(Point point)
|
||||
{
|
||||
mPoints.add(point);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest addPoint(double lat, double lon, String name, String id)
|
||||
public Request addPoint(double lat, double lon, String name, String id)
|
||||
{
|
||||
return addPoint(new MWMPoint(lat, lon, name, id));
|
||||
return addPoint(new Point(lat, lon, name, id));
|
||||
}
|
||||
|
||||
public MwmRequest setPoints(Collection<MWMPoint> points)
|
||||
public Request setPoints(Collection<Point> points)
|
||||
{
|
||||
mPoints = new ArrayList<MWMPoint>(points);
|
||||
mPoints = new ArrayList<Point>(points);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest setReturnOnBalloonClick(boolean doReturn)
|
||||
// Below are utilities from OrganicMapsApi because we are not "Feature Envy"
|
||||
|
||||
public Request setReturnOnBalloonClick(boolean doReturn)
|
||||
{
|
||||
mReturnOnBalloonClick = doReturn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest setZoomLevel(double zoomLevel)
|
||||
public Request setZoomLevel(double zoomLevel)
|
||||
{
|
||||
mZoomLevel = zoomLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MwmRequest setPendingIntent(PendingIntent pi)
|
||||
public Request setPendingIntent(PendingIntent pi)
|
||||
{
|
||||
mPendingIntent = pi;
|
||||
return this;
|
||||
|
@ -80,7 +158,7 @@ public class MwmRequest
|
|||
|
||||
public Intent toIntent(Context context)
|
||||
{
|
||||
final Intent mwmIntent = new Intent(Const.ACTION_MWM_REQUEST);
|
||||
final Intent mwmIntent = new Intent(Const.ACTION_OM_REQUEST);
|
||||
|
||||
// url
|
||||
final String mwmUrl = createMwmUrl(context, mTitle, mZoomLevel, mPoints).toString();
|
||||
|
@ -105,70 +183,12 @@ public class MwmRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* @Hidden
|
||||
* This method is internal only.
|
||||
* @Hidden This method is internal only.
|
||||
* Used for compatibility.
|
||||
*/
|
||||
MwmRequest setPoints(MWMPoint[] points)
|
||||
Request setPoints(Point[] points)
|
||||
{
|
||||
return setPoints(Arrays.asList(points));
|
||||
}
|
||||
|
||||
// Below are utilities from MapsWithMeApi because we are not "Feature Envy"
|
||||
|
||||
private static StringBuilder createMwmUrl(Context context, String title, double zoomLevel, List<MWMPoint> points)
|
||||
{
|
||||
final StringBuilder urlBuilder = new StringBuilder("mapswithme://map?");
|
||||
// version
|
||||
urlBuilder.append("v=").append(Const.API_VERSION).append("&");
|
||||
// back url, always not null
|
||||
urlBuilder.append("backurl=").append(getCallbackAction(context)).append("&");
|
||||
// title
|
||||
appendIfNotNull(urlBuilder, "appname", title);
|
||||
// zoom
|
||||
appendIfNotNull(urlBuilder, "z", isValidZoomLevel(zoomLevel) ? String.valueOf(zoomLevel) : null);
|
||||
|
||||
// points
|
||||
for (final 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, "id", point.getId());
|
||||
appendIfNotNull(urlBuilder, "s", point.getStyleForUrl());
|
||||
}
|
||||
}
|
||||
|
||||
return urlBuilder;
|
||||
}
|
||||
|
||||
private static String getCallbackAction(Context context)
|
||||
{
|
||||
return Const.CALLBACK_PREFIX + context.getPackageName();
|
||||
}
|
||||
|
||||
@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)
|
||||
builder.append(key).append("=").append(Uri.encode(value)).append("&");
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static boolean isValidZoomLevel(double zoom)
|
||||
{
|
||||
return zoom >= MapsWithMeApi.ZOOM_MIN && zoom <= MapsWithMeApi.ZOOM_MAX;
|
||||
}
|
||||
|
||||
}
|
78
lib/src/main/java/app/organicmaps/api/Response.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class Response
|
||||
{
|
||||
private final static double INVALID_LL = Double.MIN_VALUE;
|
||||
private Point mPoint;
|
||||
private double mZoomLevel;
|
||||
|
||||
private Response() {}
|
||||
|
||||
/**
|
||||
* Factory method to extract response data from intent.
|
||||
*
|
||||
* @param context
|
||||
* @param intent
|
||||
* @return
|
||||
*/
|
||||
public static Response extractFromIntent(Context context, Intent intent)
|
||||
{
|
||||
final Response response = new Response();
|
||||
// parse point
|
||||
final double lat = intent.getDoubleExtra(Const.EXTRA_OM_RESPONSE_POINT_LAT, INVALID_LL);
|
||||
final double lon = intent.getDoubleExtra(Const.EXTRA_OM_RESPONSE_POINT_LON, INVALID_LL);
|
||||
final String name = intent.getStringExtra(Const.EXTRA_OM_RESPONSE_POINT_NAME);
|
||||
final String id = intent.getStringExtra(Const.EXTRA_OM_RESPONSE_POINT_ID);
|
||||
|
||||
// parse additional info
|
||||
response.mZoomLevel = intent.getDoubleExtra(Const.EXTRA_OM_RESPONSE_ZOOM, 9);
|
||||
|
||||
if (lat != INVALID_LL && lon != INVALID_LL)
|
||||
response.mPoint = new Point(lat, lon, name, id);
|
||||
else
|
||||
response.mPoint = null;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return point, for which user requested more information in Organic Maps application.
|
||||
*/
|
||||
public Point getPoint() {return mPoint;}
|
||||
|
||||
public boolean hasPoint() {return mPoint != null;}
|
||||
|
||||
public double getZoomLevel() {return mZoomLevel;}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Response [SelectedPoint=" + mPoint + "]";
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
@ -22,9 +22,8 @@
|
|||
OF SUCH DAMAGE.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -52,8 +51,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_green_selector"
|
||||
android:text="@string/down_pro" />
|
||||
android:text="@string/download" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</ScrollView>
|
6
lib/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="mwm_should_be_installed">Organic Maps app is required to proceed. We have integrated with Organic Maps to provide you with offline maps of the entire world.\nTo continue please download the app:</string>
|
||||
<string name="download">Download Organic Maps</string>
|
||||
<string name="url">https://omaps.app/get?api</string>
|
||||
</resources>
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e -u -x
|
||||
|
||||
## This script converts .md file to .html and opens it in browser.
|
||||
## Please install next gems to use it:
|
||||
## gem install redcarpet
|
||||
## gem install github-markup
|
||||
|
||||
github-markup README.md > README.html
|
||||
open README.html
|
1
sample-app-capitals/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -1,19 +1,35 @@
|
|||
apply plugin: 'android'
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
// Define these properties in the gradle.properties file in the root project folder
|
||||
compileSdkVersion propTargetSdkVersion.toInteger()
|
||||
buildToolsVersion propBuildToolsVersion
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion propMinSdkVersion.toInteger()
|
||||
targetSdkVersion propTargetSdkVersion.toInteger()
|
||||
applicationId "app.organicmaps.api.sample.capitals"
|
||||
minSdk 21
|
||||
targetSdk 32
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation project(path: ':lib')
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="MwmApi" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
21
sample-app-capitals/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -1,15 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
android.library.reference.1=../lib
|
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 37 KiB |
|
@ -1,10 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
|
@ -21,36 +20,29 @@
|
|||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mapswithme.capitals"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="9"
|
||||
android:targetSdkVersion="21" />
|
||||
<manifest package="app.organicmaps.api.sample.capitals"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.capitals.CapitalsListActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".CapitalsListActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.capitals.CityDetailsActivity"
|
||||
android:label="@string/app_name" >
|
||||
android:launchMode="singleTop" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".CityDetailsActivity"
|
||||
android:launchMode="singleTop" />
|
||||
|
||||
</application>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,5 +1,6 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
@ -20,7 +21,7 @@
|
|||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.capitals;
|
||||
package app.organicmaps.api.sample.capitals;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Context;
|
||||
|
@ -32,8 +33,8 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mapswithme.maps.api.MWMPoint;
|
||||
import com.mapswithme.maps.api.MapsWithMeApi;
|
||||
import app.organicmaps.api.Point;
|
||||
import app.organicmaps.api.Api;
|
||||
|
||||
public class CapitalsListActivity extends ListActivity
|
||||
{
|
||||
|
@ -48,28 +49,24 @@ public class CapitalsListActivity extends ListActivity
|
|||
mCityAdapter = new CityAdapter(this, City.CAPITALS);
|
||||
setListAdapter(mCityAdapter);
|
||||
|
||||
findViewById(R.id.btn_all).setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) { showCityOnMWMMap(City.CAPITALS); }
|
||||
});
|
||||
findViewById(R.id.btn_all).setOnClickListener(v -> showCityOnOMMap(City.CAPITALS));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id)
|
||||
{
|
||||
showCityOnMWMMap(mCityAdapter.getItem(position));
|
||||
showCityOnOMMap(mCityAdapter.getItem(position));
|
||||
}
|
||||
|
||||
private void showCityOnMWMMap(City ... cities)
|
||||
private void showCityOnOMMap(City ... cities)
|
||||
{
|
||||
MWMPoint[] points = new MWMPoint[cities.length];
|
||||
Point[] points = new Point[cities.length];
|
||||
for (int i = 0; i < cities.length; i++)
|
||||
points[i] = cities[i].toMWMPoint();
|
||||
points[i] = cities[i].toPoint();
|
||||
|
||||
final String title = cities.length == 1 ? cities[0].getName() : "Capitals of the World";
|
||||
MapsWithMeApi.showPointsOnMap(this, title, CityDetailsActivity.getPendingIntent(this), points);
|
||||
Api.showPointsOnMap(this, title, CityDetailsActivity.getPendingIntent(this), points);
|
||||
}
|
||||
|
||||
private static class CityAdapter extends ArrayAdapter<City>
|
||||
|
@ -86,9 +83,9 @@ public class CapitalsListActivity extends ListActivity
|
|||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
final TextView subText = (TextView) view.findViewById(android.R.id.text2);
|
||||
final TextView subText = view.findViewById(android.R.id.text2);
|
||||
final City city = data[position];
|
||||
subText.setText(city.getCountryCode() + "/" + city.getTimeZone());
|
||||
subText.setText(String.format("%s/%s", city.getCountryCode(), city.getTimeZone()));
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -1,28 +1,29 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.capitals;
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api.sample.capitals;
|
||||
|
||||
import com.mapswithme.maps.api.MWMPoint;
|
||||
import app.organicmaps.api.Point;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
@ -56,7 +57,7 @@ public class City
|
|||
|
||||
@Override
|
||||
public String toString() { return name; }
|
||||
public MWMPoint toMWMPoint() { return new MWMPoint(lat, lon, name, id); }
|
||||
public Point toPoint() { return new Point(lat, lon, name, id); }
|
||||
|
||||
public String getId() { return id; }
|
||||
public String getName() { return name; }
|
||||
|
@ -69,7 +70,7 @@ public class City
|
|||
public String getAltNames() { return altNames; }
|
||||
|
||||
|
||||
public static City fromMWMPoint(MWMPoint point)
|
||||
public static City fromPoint(Point point)
|
||||
{
|
||||
City result = null;
|
||||
final String id = point.getId();
|
|
@ -1,26 +1,27 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
Copyright (c) 2013, MapsWithMe GmbH. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package com.mapswithme.capitals;
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer. Redistributions in binary form must
|
||||
reproduce the above copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided with the
|
||||
distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
package app.organicmaps.api.sample.capitals;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -31,12 +32,12 @@ import android.view.View;
|
|||
import android.view.View.OnClickListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mapswithme.maps.api.MWMResponse;
|
||||
import com.mapswithme.maps.api.MapsWithMeApi;
|
||||
import app.organicmaps.api.Response;
|
||||
import app.organicmaps.api.Api;
|
||||
|
||||
public class CityDetailsActivity extends Activity
|
||||
{
|
||||
public static String EXTRA_FROM_MWM = "from-maps-with-me";
|
||||
public static String EXTRA_FROM_ORGANICMAPS = "from-organicmaps";
|
||||
|
||||
private TextView mName;
|
||||
private TextView mAltNames;
|
||||
|
@ -54,8 +55,8 @@ public class CityDetailsActivity extends Activity
|
|||
public static PendingIntent getPendingIntent(Context context)
|
||||
{
|
||||
final Intent i = new Intent(context, CityDetailsActivity.class);
|
||||
i.putExtra(EXTRA_FROM_MWM, true);
|
||||
return PendingIntent.getActivity(context, 0, i, 0);
|
||||
i.putExtra(EXTRA_FROM_ORGANICMAPS, true);
|
||||
return PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_IMMUTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,9 +81,8 @@ public class CityDetailsActivity extends Activity
|
|||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
MapsWithMeApi
|
||||
.showPointsOnMap(CityDetailsActivity.this,mCity.getName(),
|
||||
CityDetailsActivity.getPendingIntent(CityDetailsActivity.this),mCity.toMWMPoint());
|
||||
Api.showPointsOnMap(CityDetailsActivity.this,mCity.getName(),
|
||||
CityDetailsActivity.getPendingIntent(CityDetailsActivity.this),mCity.toPoint());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -98,10 +98,10 @@ public class CityDetailsActivity extends Activity
|
|||
|
||||
private void handleIntent(Intent intent)
|
||||
{
|
||||
if (intent.getBooleanExtra(EXTRA_FROM_MWM, false))
|
||||
if (intent.getBooleanExtra(EXTRA_FROM_ORGANICMAPS, false))
|
||||
{
|
||||
final MWMResponse response = MWMResponse.extractFromIntent(this, intent);
|
||||
mCity = City.fromMWMPoint(response.getPoint());
|
||||
final Response response = Response.extractFromIntent(this, intent);
|
||||
mCity = City.fromPoint(response.getPoint());
|
||||
|
||||
if (mCity != null)
|
||||
{
|
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108"
|
||||
android:tint="#006C35">
|
||||
<group android:scaleX="2.931552"
|
||||
android:scaleY="2.931552"
|
||||
android:translateX="18.821377"
|
||||
android:translateY="18.821377">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M14,12l-2,2l-2,-2l2,-2L14,12zM12,6l2.12,2.12l2.5,-2.5L12,1L7.38,5.62l2.5,2.5L12,6zM6,12l2.12,-2.12l-2.5,-2.5L1,12l4.62,4.62l2.5,-2.5L6,12zM18,12l-2.12,2.12l2.5,2.5L23,12l-4.62,-4.62l-2.5,2.5L18,12zM12,18l-2.12,-2.12l-2.5,2.5L12,23l4.62,-4.62l-2.5,-2.5L12,18z"/>
|
||||
</group>
|
||||
</vector>
|
|
@ -1,5 +1,5 @@
|
|||
<!--
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
@ -43,6 +43,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/show_all"
|
||||
android:drawableLeft="@drawable/ic_launcher"/>
|
||||
android:drawableLeft="@mipmap/ic_launcher"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,5 +1,5 @@
|
|||
<!--
|
||||
Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
|
||||
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
@ -39,8 +39,8 @@
|
|||
android:id="@+id/showOnMap"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_launcher"
|
||||
android:text="@string/open_with_mapswithme" />
|
||||
android:drawableLeft="@mipmap/ic_launcher"
|
||||
android:text="@string/open_with_organicmaps" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -189,4 +189,4 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</ScrollView>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
BIN
sample-app-capitals/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
BIN
sample-app-capitals/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
BIN
sample-app-capitals/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 5.3 KiB |
BIN
sample-app-capitals/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 8.8 KiB |
BIN
sample-app-capitals/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">maps.me capitals</string>
|
||||
<string name="show_all">Show all capitals with maps.me</string>
|
||||
<string name="open_with_mapswithme">Open with maps.me</string>
|
||||
<string name="app_name">Organic Maps Capitals</string>
|
||||
<string name="show_all">Show all capitals with Organic Maps</string>
|
||||
<string name="open_with_organicmaps">Open with Organic Maps</string>
|
||||
<string name="name">Name:</string>
|
||||
<string name="alternative_names">Alternative names:</string>
|
||||
<string name="lat">Lat:</string>
|
17
settings.gradle
Normal file
|
@ -0,0 +1,17 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "Organic Maps API"
|
||||
include ':sample-app-capitals'
|
||||
include ':lib'
|