Skip to content

Commit 24ae18d

Browse files
committed
Rehydrate
Signed-off-by: Roman Tsisyk <[email protected]>
1 parent 80069e1 commit 24ae18d

File tree

77 files changed

+984
-759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+984
-759
lines changed

.gitignore

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
bin/
2-
gen/
3-
build/
4-
.settings/
5-
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
65
.DS_Store
7-
.classpath
8-
.cproject
9-
.project
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx
1010
local.properties
11-
lint.xml

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Organic Maps works from *Android SDK version 21 (Android 5)* and above
2525
First step is to clone [repository][linkRepo] or download it as an archive.
2626

2727
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.
28-
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 `OrganicMapsApi` methods (more details below).
28+
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).
2929

3030
## Classes Overview and HOW TO
3131
Core classes you will work with are:
3232

33-
* [app.organicmaps.api.OrganicMapsApi][linkApiClass] - static class with methods such as `showPointOnMap(Activity, double, double, String)` etc.
34-
* [app.organicmaps.api.OMPoint][linkPointClass] - model of POI, includes lat, lon, name, id, and style data.
35-
* [app.organicmaps.api.OMResponse][linkRespClass] - helps you to extract response from Organic Maps by applying `OMResponse.extractFromIntent(Intent)` to Intent. Contains OMPoint data.
33+
* [app.organicmaps.api.Api][linkApiClass] - static class with methods such as `showPointOnMap(Activity, double, double, String)` etc.
34+
* [app.organicmaps.api.Point][linkPointClass] - model of POI, includes lat, lon, name, id, and style data.
35+
* [app.organicmaps.api.Response][linkRespClass] - helps you to extract response from Organic Maps by applying `Response.extractFromIntent(Intent)` to Intent. Contains Point data.
3636

3737
### Show Points on the Map
3838

@@ -48,25 +48,25 @@ The simplest usage:
4848
final double lon = ...;
4949
final String name = ...;
5050
// Ask Organic Maps to show the point
51-
OrganicMapsApi.showPointOnMap(this, lat, lon, name);
51+
Api.showPointOnMap(this, lat, lon, name);
5252
}
5353
...
5454

5555
}
5656

57-
For multiple points use [OMPoint][linkPointClass] class:
57+
For multiple points use [Point][linkPointClass] class:
5858

5959
void showMultiplePoints(List<SomeDomainObject> list)
6060
{
61-
// Convert objects to MMWPoints
62-
final OMPoint[] points = new OMPoint[list.length];
61+
// Convert objects to OM Points
62+
final Point[] points = new Point[list.length];
6363
for (int i = 0; i < list.size; i++)
6464
{
65-
// Get lat, lon, and name from object and assign it to new MMWPoint
66-
points[i] = new OMPoint(lat, lon, name);
65+
// Get lat, lon, and name from object and assign it to new Point
66+
points[i] = new Point(lat, lon, name);
6767
}
6868
// Show all point on the map, you could also provide some title
69-
OrganicMapsApi.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
69+
Api.showPointsOnMap(this, "Look at my points, my points are amazing!", points);
7070
}
7171

7272

@@ -80,18 +80,18 @@ your application when user press "More Info" button :
8080
// Here is how to pass points with ID ant PendingIntent
8181
void showMultiplePointsWithPendingIntent(List<SomeDomainObject> list, PendingIntent pendingIntent)
8282
{
83-
// Convert objects to OMPoints
84-
final OMPoint[] points = new OMPoint[list.length];
83+
// Convert objects to Points
84+
final Point[] points = new Point[list.length];
8585
for (int i = 0; i < list.size; i++)
8686
{
8787
// ||
8888
// ||
8989
// \/
9090
// Now you should specify string ID for each point
91-
points[i] = new OMPoint(lat, lon, name, id);
91+
points[i] = new Point(lat, lon, name, id);
9292
}
9393
// Show all points on the map, you could also provide some title
94-
OrganicMapsApi.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
94+
Api.showPointsOnMap(this, "This title says that user should choose some point", pendingIntent, points);
9595
}
9696

9797
//Code below shows general way to extract response data
@@ -100,7 +100,7 @@ your application when user press "More Info" button :
100100
super.onCreate(savedInstanceState);
101101
setContentView(R.layout.activity_main);
102102
// Handle intent you specified with PandingIntent
103-
// Now it has additional information (OMPoint).
103+
// Now it has additional information (Point).
104104
handleIntent(getIntent());
105105
}
106106

@@ -114,35 +114,37 @@ your application when user press "More Info" button :
114114

115115
void handleIntent(Intent intent)
116116
{
117-
// Apply OMResponse extraction method to intent
118-
final OMResponse mwmResponse = OMResponse.extractFromIntent(this, intent);
117+
// Apply Response extraction method to intent
118+
final Response mwmResponse = Response.extractFromIntent(this, intent);
119119
// Here is your point that user selected
120-
final OMPoint point = mwmResponse.getPoint();
120+
final Point point = mwmResponse.getPoint();
121121
// Now, for instance you can do some work depending on point id
122122
processUserInteraction(point.getId());
123123
}
124124

125125
## FAQ
126126

127127
#### How should I detect if user has Organic Maps installed?
128-
`OrganicMapsApi.isOrganicMapsInstalled(Context)` will return `true` if user has *Lite* or *Pro* version that supports API call installed.
128+
`Api.isOrganicMapsInstalled(Context)` will return `true` if user has *Lite* or *Pro* version that supports API call installed.
129129

130130
#### Which versions of Organic Maps support API calls?
131131
All versions since 2.4.0 and above support API calls.
132132

133-
#### What will happen if I call for `OrganicMapsApi.showPoint()` but Organic Maps application is not installed?
133+
#### What will happen if I call for `Api.showPoint()` but Organic Maps application is not installed?
134134
Nothing serious. API library will show simple dialog with gentle offer to download Organic Maps. You can see how it looks like below.
135135

136136
![Please install us](site/images/dlg.png)
137137

138138
## Sample Code and Application
139139

140-
* [Sample Application at Google Play][linkSampleGooglePlay]
141140
* [Sample Application Source Code][linkSampleSource]
142141

143142
-------------------------------------------------------------------------------
144143
## API Code License
144+
145+
Copyright (c) 2022, Organic Maps OÜ.
145146
Copyright (c) 2019, MY.COM B.V.
147+
Copyright (c) 2013, MapsWithMe GmbH.
146148
All rights reserved.
147149

148150
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -154,12 +156,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
154156

155157
[linkOM]: https://organicmaps.app/ "Organic Maps"
156158
[linkPIntent]: http://developer.android.com/reference/android/app/PendingIntent.html "PendingIntent"
157-
[linkRepo]: https://github.com/mapswithme/api-android "GitHub Repository"
159+
[linkRepo]: https://github.com/organicmaps/api-android "GitHub Repository"
158160
[linkLibProj]: http://developer.android.com/tools/projects/index.html#LibraryProjects "Android Library Project"
159161
[linkIntents]: http://developer.android.com/guide/components/intents-filters.html "Intents and Intent Filters"
160-
[linkApiClass]: lib/src/com/mapswithme/maps/api/OrganicMapsApi.java "OrganicMapsApi.java"
161-
[linkPointClass]: lib/src/com/mapswithme/maps/api/OMPoint.java "OMPoint.java"
162-
[linkRespClass]: lib/src/com/mapswithme/maps/api/OMResponse.java "OMResponse.java"
163-
[linkSampleSource]: https://github.com/mapswithme/api-android/tree/master/sample-app-capitals "Api Source Code"
164-
[linkSampleGooglePlay]: http://play.google.com/store/apps/details?id=com.mapswithme.capitals "Api Demo .apk"
165-
[linkTravelGuides]: http://www.guidewithme.com
162+
[linkApiClass]: lib/src/app/organicmaps/api/Api.java "Api.java"
163+
[linkPointClass]: lib/src/app/organicmaps/api/Point.java "Point.java"
164+
[linkRespClass]: lib/src/app/organicmaps/api/Response.java "Response.java"
165+
[linkSampleSource]: https://github.com/organicmaps/api-android/tree/master/sample-app-capitals "Api Source Code"

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
id 'com.android.application' version '7.2.1' apply false
4+
id 'com.android.library' version '7.2.1' apply false
5+
}
6+
7+
task clean(type: Delete) {
8+
delete rootProject.buildDir
9+
}

gradle.properties

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app"s APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Enables namespacing of each library's R class so that its R class includes only the
19+
# resources declared in the library itself and none from the library's dependencies,
20+
# thereby reducing the size of the R class for that library
21+
android.nonTransitiveRClass=true

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Jun 06 09:48:49 TRT 2022
2+
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
#!/usr/bin/env sh
2+
3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
##############################################################################
20+
##
21+
## Gradle start up script for UN*X
22+
##
23+
##############################################################################
24+
25+
# Attempt to set APP_HOME
26+
# Resolve links: $0 may be a link
27+
PRG="$0"
28+
# Need this for relative symlinks.
29+
while [ -h "$PRG" ] ; do
30+
ls=`ls -ld "$PRG"`
31+
link=`expr "$ls" : '.*-> \(.*\)$'`
32+
if expr "$link" : '/.*' > /dev/null; then
33+
PRG="$link"
34+
else
35+
PRG=`dirname "$PRG"`"/$link"
36+
fi
37+
done
38+
SAVED="`pwd`"
39+
cd "`dirname \"$PRG\"`/" >/dev/null
40+
APP_HOME="`pwd -P`"
41+
cd "$SAVED" >/dev/null
42+
43+
APP_NAME="Gradle"
44+
APP_BASE_NAME=`basename "$0"`
45+
46+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48+
49+
# Use the maximum available, or set MAX_FD != -1 to use that value.
50+
MAX_FD="maximum"
51+
52+
warn () {
53+
echo "$*"
54+
}
55+
56+
die () {
57+
echo
58+
echo "$*"
59+
echo
60+
exit 1
61+
}
62+
63+
# OS specific support (must be 'true' or 'false').
64+
cygwin=false
65+
msys=false
66+
darwin=false
67+
nonstop=false
68+
case "`uname`" in
69+
CYGWIN* )
70+
cygwin=true
71+
;;
72+
Darwin* )
73+
darwin=true
74+
;;
75+
MINGW* )
76+
msys=true
77+
;;
78+
NONSTOP* )
79+
nonstop=true
80+
;;
81+
esac
82+
83+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84+
85+
86+
# Determine the Java command to use to start the JVM.
87+
if [ -n "$JAVA_HOME" ] ; then
88+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89+
# IBM's JDK on AIX uses strange locations for the executables
90+
JAVACMD="$JAVA_HOME/jre/sh/java"
91+
else
92+
JAVACMD="$JAVA_HOME/bin/java"
93+
fi
94+
if [ ! -x "$JAVACMD" ] ; then
95+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96+
97+
Please set the JAVA_HOME variable in your environment to match the
98+
location of your Java installation."
99+
fi
100+
else
101+
JAVACMD="java"
102+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103+
104+
Please set the JAVA_HOME variable in your environment to match the
105+
location of your Java installation."
106+
fi
107+
108+
# Increase the maximum file descriptors if we can.
109+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110+
MAX_FD_LIMIT=`ulimit -H -n`
111+
if [ $? -eq 0 ] ; then
112+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113+
MAX_FD="$MAX_FD_LIMIT"
114+
fi
115+
ulimit -n $MAX_FD
116+
if [ $? -ne 0 ] ; then
117+
warn "Could not set maximum file descriptor limit: $MAX_FD"
118+
fi
119+
else
120+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121+
fi
122+
fi
123+
124+
# For Darwin, add options to specify how the application appears in the dock
125+
if $darwin; then
126+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127+
fi
128+
129+
# For Cygwin or MSYS, switch paths to Windows format before running java
130+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
134+
JAVACMD=`cygpath --unix "$JAVACMD"`
135+
136+
# We build the pattern for arguments to be converted via cygpath
137+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138+
SEP=""
139+
for dir in $ROOTDIRSRAW ; do
140+
ROOTDIRS="$ROOTDIRS$SEP$dir"
141+
SEP="|"
142+
done
143+
OURCYGPATTERN="(^($ROOTDIRS))"
144+
# Add a user-defined pattern to the cygpath arguments
145+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147+
fi
148+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
149+
i=0
150+
for arg in "$@" ; do
151+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153+
154+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156+
else
157+
eval `echo args$i`="\"$arg\""
158+
fi
159+
i=`expr $i + 1`
160+
done
161+
case $i in
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172+
esac
173+
fi
174+
175+
# Escape application args
176+
save () {
177+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178+
echo " "
179+
}
180+
APP_ARGS=`save "$@"`
181+
182+
# Collect all arguments for the java command, following the shell quoting and substitution rules
183+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184+
185+
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)