Compare commits

..

1 commit
master ... dev

Author SHA1 Message Date
Alex Zolotarev
73c9d939c6 Increased target API version to 19 2013-11-12 14:37:13 +03:00
108 changed files with 1382 additions and 1737 deletions

3
.github/FUNDING.yml vendored
View file

@ -1,3 +0,0 @@
github: organicmaps
liberapay: OrganicMaps
custom: ["https://organicmaps.app/donate"]

17
.gitignore vendored
View file

@ -1,10 +1,11 @@
*.iml
.gradle
/local.properties
/.idea
bin/
gen/
build/
.settings/
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
.classpath
.cproject
.project
local.properties
lint.xml

175
README.html Normal file
View file

@ -0,0 +1,175 @@
<h1>MapsWithMe Android API: Getting Started</h1>
<h2>Introduction</h2>
<p>MapsWithMe Android API (hereinafter referred to as <em>&quot;API Library&quot;</em> or just <em>&quot;library&quot;</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://mapswith.me/" title="MapsWithMe">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 &quot;More Info&quot; button in MapsWithMe Application</li>
<li>Map screen branding : your application&#39;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="sample-app-capitals" title="Api Source Code">sample application</a> for demo.</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 7</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&#39;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, and id 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&lt;SomeDomainObject&gt; list)
{
// Convert objects to MMWPoints
final MWMPoint[] points = new MWMPoint[list.length];
for (int i = 0; i &lt; 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, &quot;Look at my points, my points are amazing!&quot;, 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 &quot;More Info&quot; button :</p>
<pre><code>// Here is how to pass points with ID ant PendingIntent
void showMultiplePointsWithPendingIntent(List&lt;SomeDomainObject&gt; list, PendingIntent pendingIntent)
{
// Convert objects to MMWPoints
final MWMPoint[] points = new MWMPoint[list.length];
for (int i = 0; i &lt; 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, &quot;This title says that user should choose some point&quot;, 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 &quot;SingleTop&quot;- 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>Both <em>Lite</em> and <em>Pro</em> versions since 2.4.0 are 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>
<h4>If user has both <em>Lite</em> and <em>Pro</em> versions which one will be called?</h4>
<p>MapsWithMe Pro will serve your request in the case if both <em>Lite</em> and <em>Pro</em> versions installed. </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="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@mapswith.me" title="MapsWithMe Support Contact">api@mapswith.me</a>.</p>
<hr>
<h2>API Code License</h2>
<p>Copyright (c) 2013, 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 &quot;AS IS&quot; 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>

111
README.md
View file

@ -1,39 +1,36 @@
# Organic Maps Android API: Getting Started
# MapsWithMe Android API: Getting Started
## Introduction
Organic Maps Android API (hereinafter referred to as *"API Library"* or just *"library"*)
MapsWithMe 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 [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
* 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
* 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 Organic Maps**,
using Organic Maps to show points of interest (POI) and providing more information in your app.
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.
Please refer to [sample application][linkSampleSource] for demo.
**Note**: this library provides convenience wrappers for [deep links](https://omaps.app/api). Your application can also use deep links directly without including the library as a dependency. You can look at the library implementation for ideas on how to do that.
## Prerequisites
It is supposed that you are familiar with Android Development.
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 [Intents][linkIntents], [library projects][linkLibProj], and [PendingIntents][linkPIntent] (recommended) as well.
Organic Maps works from *Android SDK version 21 (Android 5)* and above
Your application must target at least *android sdk version 7*.
## 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 `Api` 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 `MapsWithMeApi` methods (more details below).
## Classes Overview and HOW TO
##Classes Overview and HOW TO
Core classes you will work with are:
* [app.organicmaps.api.Point][linkPointClass] - model of POI, includes lat, lon, name, id, and style data.
* [app.organicmaps.api.PickPointResponse][linkRespClass] - helps you to extract response from Organic Maps by applying `Response.extractFromIntent(Intent)` to Intent. Contains Point data.
* [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, and id data.
* [com.mapswithme.maps.api.MWMResponse][linkRespClass] - helps you to extract response from MapsWithMe by applying `MWMResponse.extractFromIntent(Intent)` to Intent. Contains MWMPoint data.
### Show Points on the Map
@ -48,51 +45,51 @@ The simplest usage:
final double lat = ...;
final double lon = ...;
final String name = ...;
// Ask Organic Maps to show the point
Api.showPointOnMap(this, lat, lon, name);
// Ask MapsWithMe to show the point
MapsWithMeApi.showPointOnMap(this, lat, lon, name);
}
...
}
For multiple points use [Point][linkPointClass] class:
For multiple points use [MWMPoint][linkPointClass] class:
void showMultiplePoints(List<SomeDomainObject> list)
{
// Convert objects to OM Points
final Point[] points = new Point[list.length];
// 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 Point
points[i] = new Point(lat, lon, name);
// 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
Api.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
MapsWithMeApi.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
}
### Ask Organic Maps to Call my App
### Ask MapsWithMe 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 PendingIntent that Organic Maps will send back to
distinguish it later, and PentingIntent that MapsWithMe 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 Points
final Point[] points = new Point[list.length];
// Convert objects to MMWPoints
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 Point(lat, lon, name, id);
points[i] = new MWMPoint(lat, lon, name, id);
}
// Show all points on the map, you could also provide some title
Api.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
MapsWithMeApi.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
}
//Code below shows general way to extract response data
@ -101,7 +98,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 (Point).
// Now it has additional information (MWMPoint).
handleIntent(getIntent());
}
@ -115,39 +112,39 @@ your application when user press "More Info" button :
void handleIntent(Intent intent)
{
// Apply Response extraction method to intent
final Response mwmResponse = Response.extractFromIntent(this, intent);
// Apply MWMResponse extraction method to intent
final MWMResponse mwmResponse = MWMResponse.extractFromIntent(this, intent);
// Here is your point that user selected
final Point point = mwmResponse.getPoint();
final MWMPoint point = mwmResponse.getPoint();
// Now, for instance you can do some work depending on point id
processUserInteraction(point.getId());
}
## FAQ
#### Which versions of Organic Maps support API calls?
#### 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.
All versions since 2022-07-26 and above support API calls.
#### Which versions of MapsWithMe support API calls?
Both *Lite* and *Pro* versions since 2.4.0 and above support API calls.
#### What will happen if I call for `Api.showPoint()` but Organic Maps application is not installed?
#### 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. ![Please install us](site/images/dlg.png)
Nothing serious. API library will show simple dialog with gentle offer to download Organic Maps. You can see how it looks like below.
![Please install us](site/images/dlg.png)
#### If user has both *Lite* and *Pro* versions which one will be called?
MapsWithMe Pro will serve your request in the case if both *Lite* and *Pro* versions installed.
## Sample Code and Application
* [Sample Application at Google Play][linkSampleGooglePlay]
* [Sample Application Source Code][linkSampleSource]
## Support
If you have any questions please email to [api@mapswith.me][linkSupport].
-------------------------------------------------------------------------------
## API Code License
Copyright (c) 2024, Organic Maps OÜ.
Copyright (c) 2019, MY.COM B.V.
Copyright (c) 2013, MapsWithMe GmbH.
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:
@ -157,12 +154,14 @@ 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.
[linkOM]: https://organicmaps.app/ "Organic Maps"
[linkPIntent]: https://developer.android.com/reference/android/app/PendingIntent.html "PendingIntent"
[linkRepo]: https://github.com/organicmaps/api-android "GitHub Repository"
[linkLibProj]: https://developer.android.com/tools/projects/index.html#LibraryProjects "Android Library Project"
[linkIntents]: https://developer.android.com/guide/components/intents-filters.html "Intents and Intent Filters"
[linkApiClass]: lib/src/main/java/app/organicmaps/api/OrganicMapsApi.java "OrganicMapsApi.java"
[linkPointClass]: lib/src/main/java/app/organicmaps/api/Point.java "Point.java"
[linkRespClass]: lib/src/main/java/app/organicmaps/api/PickPointResponse.java "PickPointResponse.java"
[linkSampleSource]: https://github.com/organicmaps/api-android/tree/master/sample-app-capitals "Api Source Code"
[linkMwm]: http://mapswith.me/ "MapsWithMe"
[linkPIntent]: http://developer.android.com/reference/android/app/PendingIntent.html "PendingIntent"
[linkRepo]: https://github.com/mapswithme/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"
[linkSupport]: mailto:api@mapswith.me "MapsWithMe Support Contact"
[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"

View file

@ -1,15 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.5.1' apply false
id 'com.android.library' version '8.5.1' apply false
}
project.ext {
minSdkVersion = 21
targetSdkVersion = 34
javaVersion = JavaVersion.VERSION_11
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View file

@ -1,21 +0,0 @@
# 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

Binary file not shown.

View file

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored
View file

@ -1,185 +0,0 @@
#!/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
View file

@ -1,89 +0,0 @@
@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
View file

@ -1 +0,0 @@
/build

10
lib/AndroidManifest.xml Normal file
View file

@ -0,0 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapwithme.maps.api"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19" />
</manifest>

View file

@ -1,35 +1,27 @@
plugins {
id 'com.android.library'
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
namespace 'app.organicmaps.api'
compileSdk project.targetSdkVersion
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdk project.minSdkVersion
targetSdk project.targetSdkVersion
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
consumerProguardFiles "consumer-rules.pro"
}
instrumentTest.setRoot('tests')
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
compileOptions {
sourceCompatibility project.javaVersion
targetCompatibility project.javaVersion
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
}

92
lib/build.xml Normal file
View file

@ -0,0 +1,92 @@
<?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>

View file

20
lib/proguard-project.txt Normal file
View file

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# 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 *;
#}

View file

@ -1,21 +0,0 @@
# 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

15
lib/project.properties Normal file
View file

@ -0,0 +1,15 @@
# 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-19
android.library=true

View file

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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:
@ -22,8 +22,9 @@
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"
@ -51,8 +52,18 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/btn_green_selector"
android:text="@string/download" />
android:text="@string/down_pro" />
<Button
android:id="@+id/btn_lite"
style="@style/promoButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/btn_gray_selector"
android:padding="6dp"
android:text="@string/down_lite" />
</LinearLayout>
</ScrollView>
</ScrollView>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="mwm_should_be_installed">Offline maps are required to proceed. We have partnered with MapsWithMe to provide you with offline maps of the entire world.\nTo continue please download the app:</string>
<string name="down_lite">Download MapsWithMe Lite (free)</string>
<string name="down_pro">Download MapsWithMe Pro</string>
<string name="url_pro">http://mapswith.me/get</string>
<string name="url_lite">http://mapswith.me/app</string>
</resources>

View file

@ -0,0 +1,55 @@
/******************************************************************************
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() {}
}

View file

@ -0,0 +1,65 @@
/******************************************************************************
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_lite).setOnClickListener(this);
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(v.getId() == R.id.btn_lite ? R.string.url_lite : R.string.url_pro);
onDownloadButtonClicked(url);
}
}

View file

@ -0,0 +1,107 @@
/******************************************************************************
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 it's <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;
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 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; }
@Override
public String toString()
{
return "MWMPoint [lat=" + mLat + ", lon=" + mLon + ", name=" + mName + ", id=" + mId + "]";
}
@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);
}
}

View file

@ -0,0 +1,78 @@
/******************************************************************************
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.DownloadManager.Request;
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() {}
}

View file

@ -0,0 +1,159 @@
/******************************************************************************
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;
}
}

View file

@ -0,0 +1,173 @@
package com.mapswithme.maps.api;
import java.util.ArrayList;
import java.util.Arrays;
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
{
// **
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 = "";
// **
public MwmRequest setCustomButtonName(String buttonName)
{
mCustomButtonName = buttonName != null ? buttonName : "";
return this;
}
public MwmRequest setTitle(String title)
{
mTitle = title;
return this;
}
public MwmRequest setPickPointMode(boolean pickPoint)
{
mPickPoint = pickPoint;
return this;
}
public MwmRequest addPoint(MWMPoint point)
{
mPoints.add(point);
return this;
}
public MwmRequest addPoint(double lat, double lon, String name, String id)
{
return addPoint(new MWMPoint(lat, lon, name, id));
}
public MwmRequest setPoints(Collection<MWMPoint> points)
{
mPoints = new ArrayList<MWMPoint>(points);
return this;
}
public MwmRequest setReturnOnBalloonClick(boolean doReturn)
{
mReturnOnBalloonClick = doReturn;
return this;
}
public MwmRequest setZoomLevel(double zoomLevel)
{
mZoomLevel = zoomLevel;
return this;
}
public MwmRequest setPendingIntent(PendingIntent pi)
{
mPendingIntent = pi;
return this;
}
public Intent toIntent(Context context)
{
final Intent mwmIntent = new Intent(Const.ACTION_MWM_REQUEST);
// url
final String mwmUrl = createMwmUrl(context, mTitle, mZoomLevel, mPoints).toString();
mwmIntent.putExtra(Const.EXTRA_URL, mwmUrl);
// title
mwmIntent.putExtra(Const.EXTRA_TITLE, mTitle);
// more
mwmIntent.putExtra(Const.EXTRA_RETURN_ON_BALLOON_CLICK, mReturnOnBalloonClick);
// pick point
mwmIntent.putExtra(Const.EXTRA_PICK_POINT, mPickPoint);
// custom button name
mwmIntent.putExtra(Const.EXTRA_CUSTOM_BUTTON_NAME, mCustomButtonName);
final boolean hasIntent = mPendingIntent != null;
mwmIntent.putExtra(Const.EXTRA_HAS_PENDING_INTENT, hasIntent);
if (hasIntent)
mwmIntent.putExtra(Const.EXTRA_CALLER_PENDING_INTENT, mPendingIntent);
addCommonExtras(context, mwmIntent);
return mwmIntent;
}
/**
* @Hidden
* This method is internal only.
* Used for compatibility.
*/
MwmRequest setPoints(MWMPoint[] 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());
}
}
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;
}
}

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<!-- packages we want to see using the package manager need to be declared starting with targetSDK 30, and we need to use specific strings / cannot use @string/xxx notation -->
<package android:name="app.organicmaps"/>
</queries>
</manifest>

View file

@ -1,43 +0,0 @@
/*
Copyright (c) 2022, Organic Maps . 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
{
// Common
static final String API_SCHEME = "om://";
static final String AUTHORITY = "app.organicmaps.api";
static final String EXTRA_PREFIX = AUTHORITY + ".extra";
// Request extras
public static final String EXTRA_PICK_POINT = EXTRA_PREFIX + ".PICK_POINT";
// Response extras
public static final String EXTRA_POINT_NAME = EXTRA_PREFIX + ".POINT_NAME";
public static final String EXTRA_POINT_LAT = EXTRA_PREFIX + ".POINT_LAT";
public static final String EXTRA_POINT_LON = EXTRA_PREFIX + ".POINT_LON";
public static final String EXTRA_POINT_ID = EXTRA_PREFIX + ".POINT_ID";
public static final String EXTRA_ZOOM_LEVEL = EXTRA_PREFIX + ".ZOOM_LEVEL";
private Const() {}
}

View file

@ -1,55 +0,0 @@
/*
Copyright (c) 2022, Organic Maps . 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.Intent;
import android.net.Uri;
import androidx.annotation.NonNull;
public class CrosshairRequest
{
private String mAppName;
public CrosshairRequest setAppName(String appName)
{
mAppName = appName;
return this;
}
public @NonNull
Intent toIntent()
{
final StringBuilder builder = new StringBuilder(Const.API_SCHEME);
builder.append("crosshair?");
// title
if (mAppName != null)
builder.append("appname").append("=").append(Uri.encode(mAppName)).append("&");
final Uri uri = Uri.parse(builder.toString());
final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.putExtra(Const.EXTRA_PICK_POINT, true);
return intent;
}
}

View file

@ -1,64 +0,0 @@
/*
Copyright (c) 2022, Organic Maps . 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);
}
}

View file

@ -1,111 +0,0 @@
/*
Copyright (c) 2022, Organic Maps . 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.Intent;
import android.net.Uri;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
public class MapRequest
{
private List<Point> mPoints = new ArrayList<>();
private String mAppName;
private double mZoomLevel;
// pick point mode
private boolean mPickPointMode;
public @NonNull MapRequest
setAppName(String appName)
{
mAppName = appName;
return this;
}
public @NonNull
MapRequest addPoint(Point point)
{
mPoints.add(point);
return this;
}
public @NonNull
MapRequest setPoints(Collection<Point> points)
{
mPoints = new ArrayList<>(points);
return this;
}
public @NonNull
MapRequest setZoomLevel(double zoomLevel)
{
mZoomLevel = zoomLevel;
return this;
}
public @NonNull MapRequest setPickPointMode(boolean pickPointMode)
{
mPickPointMode = pickPointMode;
return this;
}
public @NonNull
Intent toIntent()
{
final StringBuilder builder = new StringBuilder(Const.API_SCHEME);
builder.append("map?");
// title
if (mAppName != null)
builder.append("appname").append("=").append(Uri.encode(mAppName)).append("&");
// zoom
if (mZoomLevel != 0.0)
builder.append("z").append("=").append(mZoomLevel).append("&");
// points
for (final Point point : mPoints)
{
if (point != null)
{
builder.append("ll=").append(String.format(Locale.US, "%f,%f&", point.getLat(), point.getLon()));
if (point.getName() != null)
builder.append("n").append("=").append(Uri.encode(point.getName())).append("&");
if (point.getId() != null)
builder.append("id").append("=").append(Uri.encode(point.getId())).append("&");
if (point.getStyle() != null)
builder.append("s").append("=").append(Uri.encode(point.getStyle().getName())).append("&");
}
}
final Uri uri = Uri.parse(builder.toString());
final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (mPickPointMode)
intent.putExtra(Const.EXTRA_PICK_POINT, true);
return intent;
}
}

View file

@ -1,60 +0,0 @@
package app.organicmaps.api;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import java.util.ArrayList;
public class OrganicMapsApi {
static final String PACKAGE_NAME_RELEASE = "app.organicmaps";
static final String PACKAGE_NAME_DEBUG = "app.organicmaps.debug";
static final String PACKAGE_NAME_BETA = "app.organicmaps.beta";
private OrganicMapsApi() {
// utility class
}
public static void showPointOnMap(final Activity activity, final double lat, final double lon, final String name) {
final ArrayList<Point> points = new ArrayList<>(1);
points.add(new Point(lat, lon, name));
showPointsOnMap(activity, name, points);
}
public static void showPointsOnMap(final Activity activity, final String name, final ArrayList<Point> points) {
final Intent intent = new MapRequest()
.setPoints(points)
.setAppName(name)
.toIntent();
sendRequest(activity, intent);
};
public static void sendRequest(final Activity caller, final Intent intent) {
if (canHandleOrganicMapsIntents(caller)) {
caller.startActivity(intent);
} else {
new DownloadDialog(caller).show();
}
}
/**
* Detects if any handler for OrganicMaps intents is installed on the device
*/
public static boolean canHandleOrganicMapsIntents(final Context context) {
final ComponentName c = new MapRequest().toIntent().resolveActivity(context.getPackageManager());
return c != null;
}
/**
* Detects if one of the specific OrganicMaps packages is installed
*/
public static boolean isOrganicMapsPackageInstalled(final Context context) {
final PackageManager pm = context.getPackageManager();
return (pm.getLaunchIntentForPackage(PACKAGE_NAME_RELEASE) != null
|| pm.getLaunchIntentForPackage(PACKAGE_NAME_BETA) != null
|| pm.getLaunchIntentForPackage(PACKAGE_NAME_DEBUG) != null);
}
}

View file

@ -1,75 +0,0 @@
/*
Copyright (c) 2022, Organic Maps . 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.Intent;
import android.os.Bundle;
public class PickPointResponse
{
private Point mPoint;
private double mZoomLevel;
private PickPointResponse() {}
/**
* Factory method to extract response from intent.
*
* @param intent an intent to extra data from
* @return PointResponse
*/
public static PickPointResponse extractFromIntent(final Intent intent)
{
final PickPointResponse response = new PickPointResponse();
final Bundle extras = intent.getExtras();
final double lat = extras.getDouble(Const.EXTRA_POINT_LAT);
final double lon = extras.getDouble(Const.EXTRA_POINT_LON);
final String name = extras.getString(Const.EXTRA_POINT_NAME);
final String id = extras.getString(Const.EXTRA_POINT_ID);
response.mPoint = new Point(lat, lon, name, id);
response.mZoomLevel = extras.getDouble(Const.EXTRA_ZOOM_LEVEL);
return response;
}
/**
* @return selected point
*/
public Point getPoint()
{
return mPoint;
}
/**
* @return current zoom level
*/
public double getZoomLevel()
{
return mZoomLevel;
}
@Override
public String toString()
{
return "PointResponse [Point=" + mPoint + "]";
}
}

View file

@ -1,173 +0,0 @@
/*
Copyright (c) 2022, Organic Maps . 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 androidx.annotation.NonNull;
import java.io.Serializable;
import java.util.Objects;
/**
* 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 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 point 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;
}
@Override
@NonNull
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 Objects.equals(mName, 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.
*/
public String getName()
{
return name;
}
}
}

View file

@ -1,6 +0,0 @@
<?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>

11
readme_to_html.sh Executable file
View file

@ -0,0 +1,11 @@
#!/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

View file

@ -1 +0,0 @@
/build

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2022, Organic Maps OÜ. All rights reserved.
Copyright (c) 2013, MapsWithMe GmbH. 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
@ -20,28 +21,36 @@
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" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<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.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=".CityDetailsActivity"
android:launchMode="singleTop" />
<activity
android:name="com.mapswithme.capitals.CityDetailsActivity"
android:label="@string/app_name" >
android:launchMode="singleTop" >
</activity>
</application>
</application>
</manifest>
</manifest>

View file

@ -1,37 +0,0 @@
plugins {
id 'com.android.application'
}
android {
namespace 'app.organicmaps.api.sample.capitals'
compileSdk project.targetSdkVersion
defaultConfig {
applicationId "app.organicmaps.api.sample.capitals"
minSdk project.minSdkVersion
targetSdk project.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility project.javaVersion
targetCompatibility project.javaVersion
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation project(path: ':lib')
}

View file

@ -0,0 +1,92 @@
<?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>

View file

@ -1,21 +0,0 @@
# 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

View file

@ -0,0 +1,15 @@
# 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-19
android.library.reference.1=../lib

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -1,5 +1,5 @@
<!--
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:
@ -43,6 +43,6 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/show_all"
android:drawableLeft="@mipmap/ic_launcher"/>
android:drawableLeft="@drawable/ic_launcher"/>
</LinearLayout>

View file

@ -1,5 +1,5 @@
<!--
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:
@ -39,8 +39,8 @@
android:id="@+id/showOnMap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@mipmap/ic_launcher"
android:text="@string/open_with_organicmaps" />
android:drawableLeft="@drawable/ic_launcher"
android:text="@string/open_with_mapswithme" />
<LinearLayout
android:layout_width="match_parent"
@ -189,4 +189,4 @@
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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="app_name">MapsWithMeCapitals</string>
<string name="show_all">Show All Capitals with MapsWithMe</string>
<string name="open_with_mapswithme">Open With MapsWithMe</string>
<string name="name">Name:</string>
<string name="alternative_names">Alternative names:</string>
<string name="lat">Lat:</string>
@ -12,6 +12,5 @@
<string name="population">Population:</string>
<string name="time_zone">Time Zone:</string>
<string name="elevation">Elevation:</string>
<string name="cancelled">Cancelled</string>
</resources>

View file

@ -1,6 +1,5 @@
/*
Copyright (c) 2022, Organic Maps . All rights reserved.
Copyright (c) 2013, MapsWithMe GmbH. 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,28 +19,24 @@
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;
******************************************************************************/
package com.mapswithme.capitals;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import app.organicmaps.api.Point;
import app.organicmaps.api.MapRequest;
import java.util.ArrayList;
import com.mapswithme.maps.api.MWMPoint;
import com.mapswithme.maps.api.MapsWithMeApi;
public class CapitalsListActivity extends ListActivity
{
private static final int REQ_CODE_CITY = 1;
CityAdapter mCityAdapter;
@Override
@ -53,39 +48,28 @@ public class CapitalsListActivity extends ListActivity
mCityAdapter = new CityAdapter(this, City.CAPITALS);
setListAdapter(mCityAdapter);
findViewById(R.id.btn_all).setOnClickListener(v -> showCityOnOMMap(City.CAPITALS));
findViewById(R.id.btn_all).setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) { showCityOnMWMMap(City.CAPITALS); }
});
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
showCityOnOMMap(mCityAdapter.getItem(position));
showCityOnMWMMap(mCityAdapter.getItem(position));
}
private void showCityOnOMMap(City ... cities)
private void showCityOnMWMMap(City ... cities)
{
final ArrayList<Point> points = new ArrayList<>(cities.length);
for (City city : cities)
points.add(city.toPoint());
MWMPoint[] points = new MWMPoint[cities.length];
for (int i = 0; i < cities.length; i++)
points[i] = cities[i].toMWMPoint();
final String title = cities.length == 1 ? cities[0].getName() : "Capitals of the World";
final Intent intent = new MapRequest()
.setPoints(points)
.setAppName(title)
.toIntent();
this.startActivityForResult(intent, REQ_CODE_CITY);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode != REQ_CODE_CITY || resultCode != RESULT_OK)
return;
final Intent intent = new Intent(this, CityDetailsActivity.class);
intent.putExtra(CityDetailsActivity.EXTRA_POINT, data);
MapsWithMeApi.showPointsOnMap(this, title, CityDetailsActivity.getPendingIntent(this), points);
}
private static class CityAdapter extends ArrayAdapter<City>
@ -102,9 +86,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 = view.findViewById(android.R.id.text2);
final TextView subText = (TextView) view.findViewById(android.R.id.text2);
final City city = data[position];
subText.setText(String.format("%s/%s", city.getCountryCode(), city.getTimeZone()));
subText.setText(city.getCountryCode() + "/" + city.getTimeZone());
return view;
}
}

View file

@ -1,29 +1,28 @@
/*
Copyright (c) 2022, Organic Maps . All rights reserved.
Copyright (c) 2013, MapsWithMe GmbH. 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 app.organicmaps.api.sample.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 com.mapswithme.capitals;
import app.organicmaps.api.Point;
import com.mapswithme.maps.api.MWMPoint;
import java.util.Arrays;
import java.util.Comparator;
@ -55,8 +54,9 @@ public class City
this.altNames = altNames;
}
public String toString() { return name; }
public Point toPoint() { return new Point(lat, lon, name, id); }
@Override
public String toString() { return name; }
public MWMPoint toMWMPoint() { return new MWMPoint(lat, lon, name, id); }
public String getId() { return id; }
public String getName() { return name; }
@ -69,7 +69,7 @@ public class City
public String getAltNames() { return altNames; }
public static City fromPoint(Point point)
public static City fromMWMPoint(MWMPoint point)
{
City result = null;
final String id = point.getId();

View file

@ -0,0 +1,123 @@
/******************************************************************************
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.capitals;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
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;
public class CityDetailsActivity extends Activity
{
public static String EXTRA_FROM_MWM = "from-maps-with-me";
private TextView mName;
private TextView mAltNames;
private TextView mCountry;
private TextView mLat;
private TextView mLon;
private TextView mElev;
private TextView mPopulation;
private TextView mTimeZone;
private City mCity;
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);
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.city_details_activity);
mName = (TextView) findViewById(R.id.name);
mAltNames = (TextView) findViewById(R.id.altNames);
mCountry = (TextView) findViewById(R.id.cCode);
mLat = (TextView) findViewById(R.id.lat);
mLon = (TextView) findViewById(R.id.lon);
mElev = (TextView) findViewById(R.id.elevation);
mPopulation = (TextView) findViewById(R.id.population);
mTimeZone = (TextView) findViewById(R.id.timeZone);
findViewById(R.id.showOnMap).setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
MapsWithMeApi
.showPointsOnMap(CityDetailsActivity.this,mCity.getName(),
CityDetailsActivity.getPendingIntent(CityDetailsActivity.this),mCity.toMWMPoint());
}
});
handleIntent(getIntent());
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
handleIntent(intent);
}
private void handleIntent(Intent intent)
{
if (intent.getBooleanExtra(EXTRA_FROM_MWM, false))
{
final MWMResponse response = MWMResponse.extractFromIntent(this, intent);
mCity = City.fromMWMPoint(response.getPoint());
if (mCity != null)
{
mName.setText(mCity.getName());
mAltNames.setText(mCity.getAltNames());
mCountry.setText(mCity.getCountryCode());
mLat.setText(mCity.getLat() + "");
mLon.setText(mCity.getLon() + "");
final String evel = mCity.getElevation() != -9999 ? String.valueOf(mCity.getElevation()) : "No Data";
mElev.setText(evel);
final String popul = mCity.getPopulation() != -1 ? String.valueOf(mCity.getPopulation()) : "No Data";
mPopulation.setText(popul);
mTimeZone.setText(mCity.getTimeZone());
}
}
}
}

View file

@ -1,115 +0,0 @@
/*
Copyright (c) 2022-2023, Organic Maps . 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.sample.capitals;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import androidx.annotation.NonNull;
import app.organicmaps.api.PickPointResponse;
import app.organicmaps.api.Point;
import app.organicmaps.api.MapRequest;
public class CityDetailsActivity extends Activity
{
private static final int REQ_CODE_CITY = 1;
public static String EXTRA_POINT = "point";
private TextView mName;
private TextView mAltNames;
private TextView mCountry;
private TextView mLat;
private TextView mLon;
private TextView mElev;
private TextView mPopulation;
private TextView mTimeZone;
private City mCity;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.city_details_activity);
mName = findViewById(R.id.name);
mAltNames = findViewById(R.id.altNames);
mCountry = findViewById(R.id.cCode);
mLat = findViewById(R.id.lat);
mLon = findViewById(R.id.lon);
mElev = findViewById(R.id.elevation);
mPopulation = findViewById(R.id.population);
mTimeZone = findViewById(R.id.timeZone);
findViewById(R.id.showOnMap).setOnClickListener(v -> {
final Intent intent = new MapRequest()
.addPoint(mCity.toPoint())
.setAppName(getString(R.string.app_name))
.toIntent();
startActivityForResult(intent, REQ_CODE_CITY);
});
final Intent data = getIntent().getParcelableExtra(EXTRA_POINT);
handleResponse(data);
}
private void handleResponse(final @NonNull Intent data)
{
final PickPointResponse response = PickPointResponse.extractFromIntent(data);
final Point point = response.getPoint();
mCity = City.fromPoint(point);
if (mCity != null)
{
mName.setText(mCity.getName());
mAltNames.setText(mCity.getAltNames());
mCountry.setText(mCity.getCountryCode());
mLat.setText(String.valueOf(mCity.getLat()));
mLon.setText(String.valueOf(mCity.getLon()));
final String level = mCity.getElevation() != -9999 ? String.valueOf(mCity.getElevation()) : "No Data";
mElev.setText(level);
final String population = mCity.getPopulation() != -1 ? String.valueOf(mCity.getPopulation()) : "No Data";
mPopulation.setText(population);
mTimeZone.setText(mCity.getTimeZone());
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode != REQ_CODE_CITY || resultCode != RESULT_OK)
return;
handleResponse(data);
}
}

View file

@ -1,15 +0,0 @@
<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>

View file

@ -1,5 +0,0 @@
<?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>

View file

@ -1,5 +0,0 @@
<?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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View file

@ -1 +0,0 @@
/build

View file

@ -1,36 +0,0 @@
plugins {
id 'com.android.application'
}
android {
namespace 'app.organicmaps.api.sample.pick_point'
compileSdk project.targetSdkVersion
defaultConfig {
applicationId "app.organicmaps.api.sample.pick_point"
minSdk project.minSdkVersion
targetSdk project.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility project.javaVersion
targetCompatibility project.javaVersion
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
dependencies {
implementation 'com.google.android.material:material:1.12.0'
implementation project(path: ':lib')
}

View file

@ -1,21 +0,0 @@
# 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

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/Theme.AppCompat"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -1,83 +0,0 @@
/******************************************************************************
Copyright (c) 2022, Organic Maps . 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.sample.pick_point;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import app.organicmaps.api.CrosshairRequest;
import app.organicmaps.api.DownloadDialog;
import app.organicmaps.api.PickPointResponse;
import app.organicmaps.api.Point;
public class MainActivity extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ActivityResultLauncher<Intent> pickPoint = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> onPointSelected(result.getResultCode(), result.getData()));
findViewById(R.id.pick_point).setOnClickListener(v -> {
final Intent request = new CrosshairRequest().setAppName(getString(R.string.app_name))
.toIntent();
if (getApplicationContext().getPackageManager().resolveActivity(request, 0) == null)
{
new DownloadDialog(this).show();
return;
}
pickPoint.launch(request);
});
}
protected void onPointSelected(int resultCode, Intent data)
{
if (resultCode == RESULT_CANCELED)
{
Toast.makeText(this, getString(R.string.cancelled), Toast.LENGTH_LONG).show();
return;
}
else if (resultCode != RESULT_OK)
{
throw new AssertionError("Unsupported resultCode: " + resultCode);
}
final PickPointResponse response = PickPointResponse.extractFromIntent(data);
final Point point = response.getPoint();
final String message = getString(R.string.result, point.getLat(), point.getLon(), point.getId(), point.getName(), response.getZoomLevel());
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
}

View file

@ -1,30 +0,0 @@
<vector xmlns:aapt="http://schemas.android.com/aapt"
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>

View file

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<Button
android:id="@+id/pick_point"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pick_point" />
</LinearLayout>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Some files were not shown because too many files have changed in this diff Show more